aboutsummaryrefslogtreecommitdiff
path: root/log-tree.c
Commit message (Collapse)AuthorAge
* Teach all of log family --left-right output.Junio C Hamano2006-12-17
| | | | | | | | | | This makes reviewing git log --left-right --merge --no-merges -p a lot more pleasant. Signed-off-by: Junio C Hamano <junkio@cox.net>
* Make git-cherry handle root treesRene Scharfe2006-10-26
| | | | | | | | | | | | | | | | | | | This patch on top of 'next' makes built-in git-cherry handle root commits. It moves the static function log-tree.c::diff_root_tree() to tree-diff.c and makes it more similar to diff_tree_sha1() by shuffling around arguments and factoring out the call to log_tree_diff_flush(). Consequently the name is changed to diff_root_tree_sha1(). It is a version of diff_tree_sha1() that compares the empty tree (= root tree) against a single 'real' tree. This function is then used in get_patch_id() to compute patch IDs for initial commits instead of SEGFAULTing, as the current code does if confronted with parentless commits. Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <junkio@cox.net>
* log-tree.c: cleanup a bit append_signoff()Franck Bui-Huu2006-08-30
| | | | | | | | | | | | | | | This patch clean up append_signoff() by moving specific code that looks up for "^[-A-Za-z]+: [^@]+@" pattern into a function. It also stops the primary search when the cursor oversteps 'buf + at' limit. This patch changes slightly append_signoff() behaviour too. If we detect any Signed-off-by pattern during the primary search, we needn't to do a pattern research after. Signed-off-by: Franck Bui-Huu <vagabon.xyz@gmail.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
* Add --relative-date option to the revision interfaceJonas Fonseca2006-08-28
| | | | | | | Exposes the infrastructure from 9a8e35e98793af086f05d1ca9643052df9b44a74. Signed-off-by: Jonas Fonseca <fonseca@diku.dk> Signed-off-by: Junio C Hamano <junkio@cox.net>
* Add a newline before appending "Signed-off-by: " lineFranck Bui-Huu2006-08-13
| | | | | | | | | | Whef the last line of the commit log message does not end with "^[-A-Za-z]+: [^@]+@", append a newline after it to separate the body of the commit log message from the run of sign-off and ack lines. e.g. "Signed-off-by: A U Thor <au.thor@example.com>" or "Acked-by: Me <myself@example.org>". Signed-off-by: Junio C Hamano <junkio@cox.net>
* log-tree: show_log() should respect the setting of diffopt->line_terminationRyan Anderson2006-08-07
| | | | | Signed-off-by: Ryan Anderson <ryan@michonline.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
* Merge branch 'jt/format-patch'Junio C Hamano2006-07-25
|\ | | | | | | | | | | | | | | * jt/format-patch: builtin-log: typefix for recent format-patch changes. Add option to set initial In-Reply-To/References Add option to enable threading headers git-format-patch: Make the second and subsequent mails replies to the first
| * git-format-patch: Make the second and subsequent mails replies to the firstJosh Triplett2006-07-14
| | | | | | | | | | | | | | | | | | | | Add message_id and ref_message_id fields to struct rev_info, used in show_log with CMIT_FMT_EMAIL to set Message-Id and In-Reply-To/References respectively. Use these in git-format-patch to make the second and subsequent patch mails replies to the first patch mail. Signed-off-by: Josh Triplett <josh@freedesktop.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
* | Always reset the color _before_ printing out the newlineJohannes Schindelin2006-07-24
| | | | | | | | | | | | | | | | This patch brings the benefits of part of v1.4.1-rc2~37 to the "commit" colorizing patch. Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
* | Colorize 'commit' lines in log uiJeff King2006-07-24
|/ | | | | | | | | | | | | | When paging through the output of git-whatchanged, the color cues help to visually navigate within a diff. However, it is difficult to notice when a new commit starts, because the commit and log are shown in the "normal" color. This patch colorizes the 'commit' line, customizable through diff.colors.commit and defaulting to yellow. As a side effect, some of the diff color engine (slot enum, get_color) has become accessible outside of diff.c. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <junkio@cox.net>
* Fix some more diff options changes.Junio C Hamano2006-06-27
| | | | | | | | | | | | | | | | | | This fixes various problems in the new diff options code. - Fix --cc/-c --patch; it showed two-tree diff used internally. - Use "---\n" only where it matters -- that is, use it immediately after the commit log text when we show a commit log and something else before the patch text. - Do not output spurious extra "\n"; have an extra newline after the commit log text always when we have diff output and we are not doing oneline. - When running a pickaxe you need to go recursive. Signed-off-by: Junio C Hamano <junkio@cox.net>
* Add msg_sep to diff_optionsTimo Hirvonen2006-06-26
| | | | | | | | | | | | | Add msg_sep variable to struct diff_options. msg_sep is printed after commit message. Default is "\n", format-patch sets it to "---\n". This also removes the second argument from show_log() because all callers derived it from the first argument: show_log(rev, rev->loginfo, ... Signed-off-by: Timo Hirvonen <tihirvon@gmail.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
* Merge with_raw, with_stat and summary variables to output_formatTimo Hirvonen2006-06-26
| | | | | | | DIFF_FORMAT_* are now bit-flags instead of enumerated values. Signed-off-by: Timo Hirvonen <tihirvon@gmail.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
* format-patch: resurrect extra headers from configJohannes Schindelin2006-06-02
| | | | | | | | | | | | Once again, if you have [format] headers = "Origamization: EvilEmpire\n" format-patch will add these headers just after the "Subject:" line. Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
* format-patch --signoffJunio C Hamano2006-05-31
| | | | | | This resurrects --signoff option to format-patch. Signed-off-by: Junio C Hamano <junkio@cox.net>
* Merge branch 'js/fmt-patch'Junio C Hamano2006-05-24
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This makes "git format-patch" a built-in. * js/fmt-patch: git-rebase: use canonical A..B syntax to format-patch git-format-patch: now built-in. fmt-patch: Support --attach fmt-patch: understand old <his> notation Teach fmt-patch about --keep-subject Teach fmt-patch about --numbered fmt-patch: implement -o <dir> fmt-patch: output file names to stdout Teach fmt-patch to write individual files. Use RFC2822 dates from "git fmt-patch". git-fmt-patch: thinkofix to show [PATCH] properly. rename internal format-patch wip Minor tweak on subject line in --pretty=email Tentative built-in format-patch.
| * fmt-patch: Support --attachJohannes Schindelin2006-05-21
| | | | | | | | | | | | | | | | | | | | | | | | | | This patch touches a couple of files, because it adds options to print a custom text just after the subject of a commit, and just after the diffstat. [jc: made "many dashes" used as the boundary leader into a single variable, to reduce the possibility of later tweaks to miscount the number of dashes to break it.] Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
| * Merge branch 'master' into js/fmt-patchJunio C Hamano2006-05-06
| |\ | |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * master: (109 commits) t1300-repo-config: two new config parsing tests. Another config file parsing fix. update-index: plug memory leak from prefix_path() checkout-index: plug memory leak from prefix_path() update-index --unresolve: work from a subdirectory. pack-object: squelch eye-candy on non-tty core.prefersymlinkrefs: use symlinks for .git/HEAD repo-config: trim white-space before comment Fix for config file section parsing. Clarify git-cherry documentation. Update git-unpack-objects documentation. Fix up docs where "--" isn't displayed correctly. Several trivial documentation touch ups. git-svn 1.0.0 git-svn: documentation updates delta: stricter constness Makefile: do not link rev-list any specially. builtin-push: --all and --tags _are_ explicit refspecs builtin-log/whatchanged/show: make them official. show-branch: omit uninteresting merges. ...
| * Teach fmt-patch about --keep-subjectJohannes Schindelin2006-05-05
| | | | | | | | | | Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
| * Teach fmt-patch about --numberedJohannes Schindelin2006-05-05
| | | | | | | | | | Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
| * Tentative built-in format-patch.Junio C Hamano2006-04-18
| | | | | | | | | | | | | | | | This only does --stdout right now. To write into separate files with pretty-printed filenames like the real thing does, it needs a bit mroe work. Signed-off-by: Junio C Hamano <junkio@cox.net>
* | Fix "git-log --parents" breakage post v1.3.0Linus Torvalds2006-05-03
|/ | | | | | | | Post 1.3.0 "git log" forgets to list parent commits on the first line when --parents is given. git-cvsserver relied on it. Signed-off-by: Linus Torvalds <torvalds@osdl.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
* Log message printout cleanups (#3): fix --pretty=onelineLinus Torvalds2006-04-17
| | | | | | | | | | | | | | | | | | | | | | | | | This option is very special, since pretty_print_commit() will _remove_ the newline at the end of it, so we want to have an extra separator between the things. I added a honking big comment this time, so that (a) I don't forget this _again_ (I broke "oneline" several times during this printout cleanup), and so that people can understand _why_ the code does what it does. Now, arguably the alternate fix is to always have the '\n' at the end in pretty-print-commit, but git-rev-list depends on the current behaviour (but we could have git-rev-list remove it, whatever). With the big comment, the code hopefully doesn't get broken again. And now things like git log --pretty=oneline --cc --patch-with-stat works (even if that is admittedly a totally insane combination: if you want the patch, having the "oneline" log format is just crazy, but hey, it _works_. Even insane people are people). Signed-off-by: Junio C Hamano <junkio@cox.net>
* Log message printout cleanups (#2)Linus Torvalds2006-04-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Here's a further patch on top of the previous one with cosmetic improvements (no "real" code changes, just trivial updates): - it gets the "---" before a diffstat right, including for the combined merge case. Righ now the logic is that we always use "---" when we have a diffstat, and an empty line otherwise. That's how I visually prefer it, but hey, it can be tweaked later. - I made "diff --cc/combined" add the "---/+++" header lines too. The thing won't be mistaken for a valid diff, since the "@@" lines have too many "@" characters (three or more), but it just makes it visually match a real diff, which at least to me makes a big difference in readability. Without them, it just looks very "wrong". I guess I should have taken the filename from each individual entry (and had one "---" file per parent), but I didn't even bother to try to see how that works, so this was the simple thing. With this, doing a git log --cc --patch-with-stat looks quite readable, I think. The only nagging issue - as far as I'm concerned - is that diffstats for merges are pretty questionable the way they are done now. I suspect it would be better to just have the _first_ diffstat, and always make the merge diffstat be the one for "result against first parent". Signed-off-by: Junio C Hamano <junkio@cox.net>
* Log message printout cleanupsLinus Torvalds2006-04-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On Sun, 16 Apr 2006, Junio C Hamano wrote: > > In the mid-term, I am hoping we can drop the generate_header() > callchain _and_ the custom code that formats commit log in-core, > found in cmd_log_wc(). Ok, this was nastier than expected, just because the dependencies between the different log-printing stuff were absolutely _everywhere_, but here's a patch that does exactly that. The patch is not very easy to read, and the "--patch-with-stat" thing is still broken (it does not call the "show_log()" thing properly for merges). That's not a new bug. In the new world order it _should_ do something like if (rev->logopt) show_log(rev, rev->logopt, "---\n"); but it doesn't. I haven't looked at the --with-stat logic, so I left it alone. That said, this patch removes more lines than it adds, and in particular, the "cmd_log_wc()" loop is now a very clean: while ((commit = get_revision(rev)) != NULL) { log_tree_commit(rev, commit); free(commit->buffer); commit->buffer = NULL; } so it doesn't get much prettier than this. All the complexity is entirely hidden in log-tree.c, and any code that needs to flush the log literally just needs to do the "if (rev->logopt) show_log(...)" incantation. I had to make the combined_diff() logic take a "struct rev_info" instead of just a "struct diff_options", but that part is pretty clean. This does change "git whatchanged" from using "diff-tree" as the commit descriptor to "commit", and I changed one of the tests to reflect that new reality. Otherwise everything still passes, and my other tests look fine too. Signed-off-by: Linus Torvalds <torvalds@osdl.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
* Fixes for option parsingLinus Torvalds2006-04-16
| | | | | | | | | | | Make sure "git show" always show the header, regardless of whether there is a diff or not. Also, make sure "always_show_header" actually works, since generate_header only tested it in one out of three return paths. Signed-off-by: Linus Torvalds <torvalds@osdl.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
* log/whatchanged/show - log formatting cleanup.Junio C Hamano2006-04-16
| | | | | | | | This moves the decision to print the log message, while diff options are in effect, to log-tree. It gives behaviour closer to the traditional one. Signed-off-by: Junio C Hamano <junkio@cox.net>
* Common option parsing for "git log --diff" and friendsLinus Torvalds2006-04-14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This basically does a few things that are sadly somewhat interdependent, and nontrivial to split out - get rid of "struct log_tree_opt" The fields in "log_tree_opt" are moved into "struct rev_info", and all users of log_tree_opt are changed to use the rev_info struct instead. - add the parsing for the log_tree_opt arguments to "setup_revision()" - make setup_revision set a flag (revs->diff) if the diff-related arguments were used. This allows "git log" to decide whether it wants to show diffs or not. - make setup_revision() also initialize the diffopt part of rev_info (which we had from before, but we just didn't initialize it) - make setup_revision() do all the "finishing touches" on it all (it will do the proper flag combination logic, and call "diff_setup_done()") Now, that was the easy and straightforward part. The slightly more involved part is that some of the programs that want to use the new-and-improved rev_info parsing don't actually want _commits_, they may want tree'ish arguments instead. That meant that I had to change setup_revision() to parse the arguments not into the "revs->commits" list, but into the "revs->pending_objects" list. Then, when we do "prepare_revision_walk()", we walk that list, and create the sorted commit list from there. This actually cleaned some stuff up, but it's the less obvious part of the patch, and re-organized the "revision.c" logic somewhat. It actually paves the way for splitting argument parsing _entirely_ out of "revision.c", since now the argument parsing really is totally independent of the commit walking: that didn't use to be true, since there was lots of overlap with get_commit_reference() handling etc, now the _only_ overlap is the shared (and trivial) "add_pending_object()" thing. However, I didn't do that file split, just because I wanted the diff itself to be smaller, and show the actual changes more clearly. If this gets accepted, I'll do further cleanups then - that includes the file split, but also using the new infrastructure to do a nicer "git diff" etc. Even in this form, it actually ends up removing more lines than it adds. It's nice to note how simple and straightforward this makes the built-in "git log" command, even though it continues to support all the diff flags too. It doesn't get much simpler that this. I think this is worth merging soonish, because it does allow for future cleanup and even more sharing of code. However, it obviously touches "revision.c", which is subtle. I've tested that it passes all the tests we have, and it passes my "looks sane" detector, but somebody else should also give it a good look-over. [jc: squashed the original and three "oops this too" updates, with another fix-up.] Signed-off-by: Linus Torvalds <torvalds@osdl.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
* log-tree: separate major part of diff-tree.Junio C Hamano2006-04-09
This separates out the part that deals with one-commit diff-tree (and --stdin form) into a separate log-tree module. There are two goals with this. The more important one is to be able to make this part available to "git log --diff", so that we can have a native "git whatchanged" command. Another is to simplify the commit log generation part simpler. Signed-off-by: Junio C Hamano <junkio@cox.net>