Commit graph

4217 commits

Author SHA1 Message Date
Paul Mackerras e7da347520 gitk: Fix bug caused by missing commitlisted elements
This bug was reported by Yann Dirson, and results in an 'Error:
expected boolean value but got ""' dialog when scrolling to the bottom
of the graph under some circumstances.  The issue is that git-rev-list
isn't outputting all the boundary commits when it is asked for commits
affecting only certain files.  We already cope with that by adding the
missing boundary commits in addextraid, but there we weren't adding a
0 to the end of the commitlisted list when we added the extra id to
the end of the displayorder list.

This fixes it by appending 0 to commitlisted in addextraid, thus keeping
commitlisted and displayorder in sync.

Signed-off-by: Paul Mackerras <paulus@samba.org>
2006-04-17 10:27:59 +10:00
Linus Torvalds 78fff6ebba Fixes for option parsing
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-16 15:34:37 -07:00
Junio C Hamano 5bc4ce5896 reading $GIT_DIR/info/graft - skip comments correctly.
Noticed by Yann Dirson.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-16 14:24:56 -07:00
Junio C Hamano cb8f64b4e3 log/whatchanged/show - log formatting cleanup.
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-16 03:35:38 -07:00
Junio C Hamano d4ed9793fd Simplify common default options setup for built-in log family.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-16 02:42:00 -07:00
Junio C Hamano b2934926dd Merge branch 'master' into lt/logopt
* 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-16 02:31:11 -07:00
Junio C Hamano caef71a535 Do not fork PAGER=cat
Unless the user has a nonstandard "cat" command that does not
meow like a cat, this should not break anything and would save an
extra pipe.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-16 01:46:08 -07:00
Johannes Schindelin 402461aab1 pager: do not fork a pager if PAGER is set to empty.
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-16 01:40:04 -07:00
Linus Torvalds ba1d45051e Tentative built-in "git show"
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-16 00:13:38 -07:00
Junio C Hamano 5b84f4d87a Built-in git-whatchanged.
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-16 00:07:41 -07:00
Junio C Hamano 7594c4b2d7 rev-list option parser fix.
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-15 23:48:27 -07:00
Junio C Hamano 6b9c58f466 Split init_revisions() out of setup_revisions()
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-15 23:46:36 -07:00
Johannes Schindelin 2935327394 diff-options: add --patch-with-stat
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-15 19:30:27 -07:00
Junio C Hamano cbdda02404 diff-files --stat: do not dump core with unmerged index.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-15 19:22:48 -07:00
Linus Torvalds 1cd95087c3 Support "git cmd --help" syntax
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-15 18:17:46 -07:00
Junio C Hamano 6f4780f9df diff --stat: do not do its own three-dashes.
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-15 14:06:42 -07:00
Junio C Hamano 5069b1cf61 diff-tree: typefix.
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-15 03:22:00 -07:00
Junio C Hamano 42b5c78845 GIT v1.3.0-rc4
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-14 23:21:34 -07:00
Junio C Hamano 170abc81a0 Merge branch 'dl/xdiff'
* dl/xdiff:
  xdiff: post-process hunks to make them consistent.
2006-04-14 22:58:17 -07:00
Junio C Hamano 8c1f0b44c5 Fix up rev-list option parsing.
rev-list does not take diff options, so barf after seeing some.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-14 22:43:34 -07:00
Junio C Hamano 8e8f998739 Fix up default abbrev in setup_revisions() argument parser.
The default abbreviation precision should be DEFAULT_ABBREV as before.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-14 22:42:31 -07:00
Linus Torvalds cd2bdc5309 Common option parsing for "git log --diff" and friends
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-14 21:56:55 -07:00
Junio C Hamano afcb536f28 Merge branch 'js/diffstat'
* 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-14 21:55:23 -07:00
Junio C Hamano a3cc31fb05 Merge branch 'jc/fix5500'
* jc/fix5500:
  t5500: test fix
2006-04-14 21:55:22 -07:00
Junio C Hamano 4e1dc64009 rev-list --bisect: limit list before bisecting.
I noticed bisect does not work well without both good and bad.
Running this script in git.git repository would give you quite
different results:

	#!/bin/sh
        initial=e83c5163316f89bfbde7d9ab23ca2e25604af290

        mid0=`git rev-list --bisect ^$initial --all`

        git rev-list $mid0 | wc -l
        git rev-list ^$mid0 --all | wc -l

        mid1=`git rev-list --bisect --all`

        git rev-list $mid1 | wc -l
        git rev-list ^$mid1 --all | wc -l

The $initial commit is the very first commit you made.  The
first midpoint bisects things evenly as designed, but the latter
does not.

The reason I got interested in this was because I was wondering
if something like the following would help people converting a
huge repository from foreign SCM, or preparing a repository to
be fetched over plain dumb HTTP only:

        #!/bin/sh

        N=4
        P=.git/objects/pack
        bottom=

        while test 0 \< $N
        do
                N=$((N-1))
                if test -z "$bottom"
                then
                        newbottom=`git rev-list --bisect --all`
                else
                        newbottom=`git rev-list --bisect ^$bottom --all`
                fi
                if test -z "$bottom"
                then
                        rev_list="$newbottom"
                elif test 0 = $N
                then
                        rev_list="^$bottom --all"
                else
                        rev_list="^$bottom $newbottom"
                fi
                p=$(git rev-list --unpacked --objects $rev_list |
                    git pack-objects $P/pack)
                git show-index <$P/pack-$p.idx | wc -l
                bottom=$newbottom
        done

The idea is to pack older half of the history to one pack, then
older half of the remaining history to another, to continue a
few times, using finer granularity as we get closer to the tip.

This may not matter, since for a truly huge history, running
bisect number of times could be quite time consuming, and we
might be better off running "git rev-list --all" once into a
temporary file, and manually pick cut-off points from the
resulting list of commits.  After all we are talking about
"approximately half" for such an usage, and older history does
not matter much.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-14 21:52:50 -07:00
Linus Torvalds 40c2fe003c Clean up trailing whitespace when pretty-printing commits
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 21:46:08 -07:00
Junio C Hamano cad1ed9535 "git cmd -h" for shell scripts.
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-14 15:54:51 -07:00
Junio C Hamano e51c3b5006 git-log <diff-options> <paths> documentation
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-14 12:59:09 -07:00
Junio C Hamano e3a125a94d Retire git-log.sh (take #4)
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-14 12:48:45 -07:00
Junio C Hamano 5cf7e21fbc stripspace: incomplete line fix (take #2)
This fixes f4ee3eb689 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-14 12:41:51 -07:00
Junio C Hamano 7f732c632f t5500: test fix
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-13 22:28:06 -07:00
Junio C Hamano 84981f9ad9 diff --stat: no need to ask funcnames nor context.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-13 21:35:54 -07:00
Junio C Hamano dfdcb558ec Fix-up previous expr changes.
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-13 19:05:38 -07:00
Johannes Schindelin ece634d147 diff-options: add --stat (take 2)
... and a fix for an invalid free():


Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-13 16:50:02 -07:00
Davide Libenzi 295ba2fb89 xdiff: post-process hunks to make them consistent. 2006-04-13 16:48:45 -07:00
Johannes Schindelin d75f7952ef diff-options: add --stat (take 2)
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-13 16:48:24 -07:00
Mark Wooding f327dbced2 Shell utilities: Guard against expr' magic tokens.
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-13 16:45:48 -07:00
Junio C Hamano 2283645b85 t3600-rm: skip failed-remove test when we cannot make an unremovable file.
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-13 11:57:57 -07:00
Linus Torvalds f43ba60e2c Use less memory in "git log"
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-13 11:26:56 -07:00
Junio C Hamano d53352422b git-log: do not output excess blank line between commits
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-13 00:26:21 -07:00
Junio C Hamano 8c989ec528 Makefile: $(MAKE) check-docs
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-13 00:21:47 -07:00
Junio C Hamano c16e30c088 Documentation: add a couple of missing docs.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-13 00:21:06 -07:00
Junio C Hamano 02376287ff Merge branch 'jc/combine' into next
* 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-12 13:24:48 -07:00
Junio C Hamano 3103c00520 Merge branch 'master' into jc/combine
* 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-12 13:24:04 -07:00
Junio C Hamano 8bc7574b63 combine-diff: type fix.
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-12 13:23:50 -07:00
Junio C Hamano f4ee3eb689 stripspace: make sure not to leave an incomplete line.
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-12 13:10:27 -07:00
Junio C Hamano 475443c848 git-commit: do not muck with commit message when no_edit is set.
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-12 11:45:18 -07:00
Linus Torvalds 684958ae61 When showing a commit message, do not lose an incomplete line. 2006-04-12 11:31:23 -07:00
Junio C Hamano 5ca64e488f Retire t5501-old-fetch-and-upload test.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-11 16:35:39 -07:00
Junio C Hamano 72c159f642 Merge branch 'jc/combine' into next
* jc/combine:
  combine-diff: fix hunks at the end (take #2).
  combine-diff: do not lose hunks with only deletion at end.
2006-04-11 14:34:59 -07:00