summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2006-04-18git.c: LOGSIZE is unused after log printing cleanup.Junio C Hamano
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-18Log message printout cleanups (#3): fix --pretty=onelineLinus Torvalds
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>
2006-04-18Log message printout cleanups (#2)Linus Torvalds
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>
2006-04-17Log message printout cleanupsLinus Torvalds
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>
2006-04-17rev-list --header: output format fixJunio C Hamano
Initial fix prepared by Johannes, but I did it slightly differently. Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-16Fixes for option parsingLinus Torvalds
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>
2006-04-16log/whatchanged/show - log formatting cleanup.Junio C Hamano
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>
2006-04-16Simplify common default options setup for built-in log family.Junio C Hamano
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-16Merge branch 'master' into lt/logoptJunio C Hamano
* master: pager: do not fork a pager if PAGER is set to empty. diff-options: add --patch-with-stat diff-files --stat: do not dump core with unmerged index. Support "git cmd --help" syntax diff --stat: do not do its own three-dashes. diff-tree: typefix. GIT v1.3.0-rc4 xdiff: post-process hunks to make them consistent.
2006-04-16pager: do not fork a pager if PAGER is set to empty.Johannes Schindelin
This skips an extra pipe, and helps debugging tremendously. [jc: PAGER=cat is a questionable hack and should be done as a separate patch. ] Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-16Tentative built-in "git show"Linus Torvalds
This uses the "--no-walk" flag that I never actually implemented (but I'm sure I mentioned it) to make "git show" be essentially the same thing as "git whatchanged --no-walk". It just refuses to add more interesting parents to the revision walking history, so you don't actually get any history, you just get the commit you asked for. I was going to add "--no-walk" as a real argument flag to git-rev-list too, but I'm not sure anybody actually needs it. Although it might be useful for porcelain, so I left the door open. [jc: ported to the unified option structure by Linus] Signed-off-by: Linus Torvalds <torvalds@osdl.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-16Built-in git-whatchanged.Junio C Hamano
Split internal "git log" into reusable piece and add "git whatchanged". This is based on the option parsing unification work Linus did. Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-16rev-list option parser fix.Junio C Hamano
The big option parser unification broke rev-list the big way; this makes it use options from the parsed revs structure. Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-16Split init_revisions() out of setup_revisions()Junio C Hamano
Merging all three option parsers related to whatchanged is unarguably the right thing, but the fallout was too big to scare me away. Let's try it once again, but once step at time. This splits out init_revisions() call from setup_revisions(), so that the callers can set different defaults to match the traditional benaviour. The rev-list command is still broken in a big way, which is the topic of next step. Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-16diff-options: add --patch-with-statJohannes Schindelin
With this option, git prepends a diffstat in front of the patch. Since I really, really do not know what a diffstat of a combined diff ("merge diff") should look like, the diffstat is not generated for these. Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-16diff-files --stat: do not dump core with unmerged index.Junio C Hamano
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-16Support "git cmd --help" syntaxLinus Torvalds
The "--help" argument is special, in that it is (along with "--version") in that is taken by the "git" program itself rather than the sub-command, and thus we've had the syntax "git --help cmd". However, as anybody who has ever used CVS or some similar devil-spawn program, it's confusing as h*ll when options before the sub-command act differently from options after the sub-command, so this quick hack just makes it acceptable to do "git cmd --help" instead, and get the exact same result. It may be hacky, but it's simple and does the trick. Of course, this does not help if you use one of the non-builtin commands without using the "git" helper. Ie you won't be getting a man-page just because you do "git-rev-list --help". Don't expect us to be quite _that_ helpful. Signed-off-by: Linus Torvalds <torvalds@osdl.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-15diff --stat: do not do its own three-dashes.Junio C Hamano
I missed that "git-diff-* --stat" spits out three-dash separator on its own without being asked. Remove it. When we output commit log followed by diff, perhaps --patch-with-stat, for downstream consumer, we _would_ want the three-dash between the message and the diff material, but that logic belongs to the caller, not diff generator. Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-15diff-tree: typefix.Junio C Hamano
Recent diff_tree_setup_paths() update made it take a second argument of type "struct diff_options", but we passed another struct that happenes to have that type at the beginning by mistake. Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-15GIT v1.3.0-rc4v1.3.0-rc4Junio C Hamano
I've merged everything I think is ready for 1.3.0, so this is the final round -- hopefully I can release this with minimum last-minute fixup as v1.3.0 early next week. Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-15Merge branch 'dl/xdiff'Junio C Hamano
* dl/xdiff: xdiff: post-process hunks to make them consistent.
2006-04-15Fix up rev-list option parsing.Junio C Hamano
rev-list does not take diff options, so barf after seeing some. Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-15Fix up default abbrev in setup_revisions() argument parser.Junio C Hamano
The default abbreviation precision should be DEFAULT_ABBREV as before. Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-15Common option parsing for "git log --diff" and friendsLinus Torvalds
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>
2006-04-15Merge branch 'js/diffstat'Junio C Hamano
* js/diffstat: diff --stat: no need to ask funcnames nor context. diff-options: add --stat (take 2) diff-options: add --stat (take 2)
2006-04-15Merge branch 'jc/fix5500'Junio C Hamano
* jc/fix5500: t5500: test fix
2006-04-15Clean up trailing whitespace when pretty-printing commitsLinus Torvalds
Partly because we've messed up and now have some commits with trailing whitespace, but partly because this also just simplifies the code, let's remove trailing whitespace from the end when pretty-printing commits. Signed-off-by: Linus Torvalds <torvalds@osdl.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-14"git cmd -h" for shell scripts.Junio C Hamano
Wrappers that use sh-setup took --help but not -h. Noticed by Sébastien Pierre. Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-14git-log <diff-options> <paths> documentationJunio C Hamano
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-14Retire git-log.sh (take #4)Junio C Hamano
Noticed by Johannes. We do not install it anymore, but still have been shipping the source, which was crazy. Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-14stripspace: incomplete line fix (take #2)Junio C Hamano
This fixes f4ee3eb68906f079dea45de4f1bbb03d68189eb3 breakage, which added an extra trailing blank line after stripping trailing blank lines by mistake. Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-14t5500: test fixJunio C Hamano
Relying on eye-candy progress bar was fragile to begin with. Run fetch-pack with -k option, and count the objects that are in the pack that were transferred from the other end. Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-14diff --stat: no need to ask funcnames nor context.Junio C Hamano
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-14Fix-up previous expr changes.Junio C Hamano
The regexp on the right hand side of expr : operator somehow was broken. expr 'z+pu:refs/tags/ko-pu' : 'z\+\(.*\)' does not strip '+'; write 'z+\(.*\)' instead. We probably should switch to shell based substring post 1.3.0; that's not bashism but just POSIX anyway. Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-13diff-options: add --stat (take 2)Johannes Schindelin
... and a fix for an invalid free(): Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-13xdiff: post-process hunks to make them consistent.Davide Libenzi
2006-04-13diff-options: add --stat (take 2)Johannes Schindelin
Now, you can say "git diff --stat" (to get an idea how many changes are uncommitted), or "git log --stat". Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-13Shell utilities: Guard against expr' magic tokens.Mark Wooding
Some words, e.g., `match', are special to expr(1), and cause strange parsing effects. Track down all uses of expr and mangle the arguments so that this isn't a problem. Signed-off-by: Mark Wooding <mdw@distorted.org.uk> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-13t3600-rm: skip failed-remove test when we cannot make an unremovable file.Junio C Hamano
When running t3600-rm test under fakeroot (or as root), we cannot make a file unremovable with "chmod a-w .". Detect this case early and skip that test. Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-13Use less memory in "git log"Linus Torvalds
This trivially avoids keeping the commit message data around after we don't need it any more, avoiding a continually growing "git log" memory footprint. It's not a huge deal, but it's somewhat noticeable. For the current kernel tree, doing a full "git log" I got - before: /usr/bin/time git log > /dev/null 0.81user 0.02system 0:00.84elapsed 100%CPU (0avgtext+0avgdata 0maxresident)k 0inputs+0outputs (0major+8851minor)pagefaults 0swaps - after: /usr/bin/time git log > /dev/null 0.79user 0.03system 0:00.83elapsed 100%CPU (0avgtext+0avgdata 0maxresident)k 0inputs+0outputs (0major+5039minor)pagefaults 0swaps ie the touched pages dropped from 8851 to 5039. For the historic kernel archive, the numbers are 18357->11037 minor page faults. We could/should in theory free the commits themselves, but that's really a lot harder, since during revision traversal we may hit the same commit twice through different children having it as a parent, even after we've shown it once (when that happens, we'll silently ignore it next time, but we still need the "struct commit" to know). And as the commit message data is clearly the biggest part of the commit, this is the really easy 60% solution. Signed-off-by: Linus Torvalds <torvalds@osdl.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-13git-log: do not output excess blank line between commitsJunio C Hamano
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-13Makefile: $(MAKE) check-docsJunio C Hamano
This target lists undocumented commands, and/or whose document is not referenced from the main git documentation. For now, there are some exceptions I added primarily because I lack the energy to document them myself: - merge backends (we should really document them) - ssh-push/ssh-pull (does anybody still use them?) - annotate and blame (maybe after one of them eats the other ;-) Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-13Documentation: add a couple of missing docs.Junio C Hamano
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-12Merge branch 'jc/combine' into nextJunio C Hamano
* jc/combine: stripspace: make sure not to leave an incomplete line. git-commit: do not muck with commit message when no_edit is set. When showing a commit message, do not lose an incomplete line. Retire t5501-old-fetch-and-upload test. combine-diff: type fix.
2006-04-12Merge branch 'master' into jc/combineJunio C Hamano
* master: stripspace: make sure not to leave an incomplete line. git-commit: do not muck with commit message when no_edit is set. When showing a commit message, do not lose an incomplete line. Retire t5501-old-fetch-and-upload test.
2006-04-12combine-diff: type fix.Junio C Hamano
The variable hunk_end points at a line number, which is represented as unsigned long by all the other variables. Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-12stripspace: make sure not to leave an incomplete line.Junio C Hamano
When dealing with a commit log message for human consumption, it never makes sense to keep a log that ends with an incomplete line, so make it a part of the clean-up process done by git-stripspace. Acked-by: Linus Torvalds <torvalds@osdl.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-12git-commit: do not muck with commit message when no_edit is set.Junio C Hamano
Spotted by Linus and Darrin Thompson. When we took a commit message from -F <file> with an incomplete line, we appended "git status" output, which ended up attaching a lone "#" at the end. We still need the "do we have anything to commit?" check by running "status" (which has to know what to do in different cases with -i/-o/-a), but there is no point appending its output to the proposed commit message given by the user. Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-12When showing a commit message, do not lose an incomplete line.Linus Torvalds
2006-04-11Retire t5501-old-fetch-and-upload test.Junio C Hamano
Signed-off-by: Junio C Hamano <junkio@cox.net>