Commit Graph

4167 Commits

Author SHA1 Message Date
Junio C Hamano
9626cb2e62 Merge branch 'jc/logopt' into next
* jc/logopt: (37 commits)
  1fc70b6
  Author: Junio C Hamano <junkio@cox.net>
  Date:   Sat Apr 15 04:15:07 2006 -0700
  
      Built-in git-whatchanged
      
      Now "git log" is in reusable shape, add "git whatchanged" which
      essentially is a synonym with different default for people whose
      fingers are already trained.
      
      There is a subtle difference from the shell-script version; the
      first line of each entry is now "commit <object name>", instead
      of "diff-tree <object name> (from <object name>)."  I suspect
      that showing the parent name that way is useful, so this may be
      something we would want to fix (the user can say --pretty=raw to
      get that information but that is a bit ugly).
      
      Signed-off-by: Junio C Hamano <junkio@cox.net>
  
  :100644 100644 22fec3d... 939a34c... M	git.c
  ...
2006-04-15 04:22:08 -07:00
Junio C Hamano
1fc70b60bf Built-in git-whatchanged
Now "git log" is in reusable shape, add "git whatchanged" which
essentially is a synonym with different default for people whose
fingers are already trained.

There is a subtle difference from the shell-script version; the
first line of each entry is now "commit <object name>", instead
of "diff-tree <object name> (from <object name>)."  I suspect
that showing the parent name that way is useful, so this may be
something we would want to fix (the user can say --pretty=raw to
get that information but that is a bit ugly).

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-15 04:21:19 -07:00
Junio C Hamano
d2e38d3bc3 whatchanged options parser fix.
We need to have two sets of diff_options structure and abbrev
settings, but there is no point having two separate commit
format setting.  Fix the confusion.

Also properly initialize the command options structure.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-15 04:03:48 -07:00
Junio C Hamano
0d53adf15b Merge branch 'jc/logopt' into next
* jc/logopt:
  Extract "log [diff options]" parser out.
  diff-tree: typefix.
2006-04-15 03:24:54 -07:00
Junio C Hamano
f4235f8b2e Extract "log [diff options]" parser out.
Merging of the log-tree-opt structure with rev-info structure
did not work out very well and it broke things that did not want
diff options and/or rev options.

This is an alternative approach to define a combined interface
that can be used by commands that wants both.  The use of it is
opt-in to reduce the risk of breaking existing programs.

We might want to slurp "setup_revisions() places things in
pending objects list" part from Linus's earlier attempt.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-15 03:24:33 -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
fb8e008219 Merge branch 'jc/simpack' into next
* jc/simpack:
  Clean-up Geert's similarity fingerprint code.
2006-04-15 02:12:14 -07:00
Junio C Hamano
fd2bbdd238 Clean-up Geert's similarity fingerprint code.
This splits Geert's similarity fingerprint code into main
program and fingerprinting function.  The next step would be to
try using this in pack-objects.c::try_delta() -- which would be
a good evaluation.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-15 02:11:52 -07:00
Junio C Hamano
5d27a7d58c Merge branch 'jc/logopt' into next
* jc/logopt:
  Revert all the rev-list option parsing changes.
2006-04-15 01:59:49 -07:00
Junio C Hamano
183df63940 Revert all the rev-list option parsing changes.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-15 01:59:40 -07:00
Junio C Hamano
5957f043d3 Merge branch 'master' into next
* master:
  GIT v1.3.0-rc4
2006-04-14 23:21:48 -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
300dd93306 Merge branch 'lt/logopt' into next
* lt/logopt:
  Fix up rev-list option parsing.
  Fix up default abbrev in setup_revisions() argument parser.
  Common option parsing for "git log --diff" and friends
2006-04-14 22:44:12 -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
7bfd678d21 Merge branch 'jc/bottomless' into next
* jc/bottomless:
  rev-list --bisect: limit list before bisecting.
  Clean up trailing whitespace when pretty-printing commits
  "git cmd -h" for shell scripts.
  git-log <diff-options> <paths> documentation
  Retire git-log.sh (take #4)
  stripspace: incomplete line fix (take #2)
2006-04-14 21:56:37 -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
8a642a798f Merge branch 'jc/fix5500' into next
* jc/fix5500:
  t5500: test fix
2006-04-14 00:28:52 -07:00
Junio C Hamano
4d2909e123 Merge branch 'js/diffstat' into next
* js/diffstat:
  diff --stat: no need to ask funcnames nor context.
2006-04-14 00:28:42 -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
9306ee06aa Merge branch 'master' into next
* master:
  Fix-up previous expr changes.
2006-04-13 19:05:51 -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
Junio C Hamano
ce032c5f9e Merge branch 'js/diffstat' into next
* js/diffstat:
  diff-options: add --stat (take 2)
  diff-options: add --stat (take 2)
2006-04-13 16:50:48 -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