Commit graph

4237 commits

Author SHA1 Message Date
Junio C Hamano f56ef54174 diff --stat: make sure to set recursive.
Just like "patch" format always needs recursive, "diffstat"
format does not make sense without setting recursive.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-18 11:29:33 -07:00
Herbert Valerio Riedel 08ddd4f764 git-svnimport symlink support
added svn:special symlink support for access methods other than
direct-http

Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
Acked-by: Matthias Urlichs <smurf@smurf.noris.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-18 02:26:52 -07:00
Junio C Hamano 965f803c32 combine-diff: show diffstat with the first parent.
Asking for stat (either with --stat or --patch-with-stat) gives
you diffstat for the first parent, even under combine-diff.

While the combined patch is useful to highlight the complexity
and interaction of the parts touched by all branches when
reviewing a merge commit, diffstat is a tool to assess the
extent of damage the merge brings in, and showing stat with the
first parent is more sensible than clever per-parent diffstat.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-17 22:53:03 -07:00
Junio C Hamano b073f26b25 git.c: LOGSIZE is unused after log printing cleanup.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-17 21:47:35 -07:00
Linus Torvalds a4d34e2db5 Log message printout cleanups (#3): fix --pretty=oneline
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-17 21:44:33 -07:00
Linus Torvalds eab144ac49 Log message printout cleanups (#2)
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-17 21:43:15 -07:00
Junio C Hamano 2855d58079 packed_object_info_detail(): check for corrupt packfile.
Serge E. Hallyn noticed that we compute how many input bytes are
still left, but did not use it for sanity checking.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-17 17:46:07 -07:00
Linus Torvalds 9153983310 Log message printout cleanups
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-17 15:18:25 -07:00
Serge E. Hallyn bb996614de cleanups: remove unused variable from exec_cmd.c
Not sure whether it should be removed, or whether
execv_git_cmd() should return it rather than -1 at bottom.

Signed-off-by: Serge E. Hallyn <serue@us.ibm.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-17 15:06:40 -07:00
Serge E. Hallyn dafc88b136 cleanups: prevent leak of two strduped strings in config.c
Config_filename and lockfile are strduped and then leaked in
git_config_set_multivar.

Signed-off-by: Serge E. Hallyn <serue@us.ibm.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-17 15:06:37 -07:00
Serge E. Hallyn ecc13e73cf cleanups: Remove impossible case in quote.c
The switch is inside an if statement which is false if
the character is ' '.  Either the if should be <=' '
instead of <' ', or the case should be removed as it could
be misleading.

Signed-off-by: Serge E. Hallyn <serue@us.ibm.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-17 15:06:25 -07:00
Serge E. Hallyn 310f8b5b6d cleanups: Remove unused vars from combine-diff.c
Mod_type in particular sure looks like it wants to be used, but isn't.

Signed-off-by: Serge E. Hallyn <serue@us.ibm.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-17 15:06:16 -07:00
Serge E. Hallyn da2a95b2a8 cleanups: Fix potential bugs in connect.c
The strncmp for ACK was ACK does not include the final space.
Presumably either we should either remove the trailing space,
or compare 4 chars (as this patch does).

'path' is sometimes strdup'ed, but never freed.

Signed-off-by: Serge E. Hallyn <serue@us.ibm.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-17 15:05:33 -07:00
Junio C Hamano 6feba7cb74 Merge branch 'jc/boundary'
* jc/boundary:
  rev-list --boundary: show boundary commits even when limited otherwise.
2006-04-17 15:03:11 -07:00
Junio C Hamano e190bc5543 Merge branch 'jc/bottomless'
* jc/bottomless:
  rev-list --bisect: limit list before bisecting.
2006-04-17 15:03:10 -07:00
Yann Dirson 360204c324 Allow empty lines in info/grafts
In addition to the existing comment support, that just allows the user
to use a convention that works pretty much everywhere else.

Signed-off-by: Yann Dirson <ydirson@altern.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-17 14:17:50 -07:00
Junio C Hamano db89665fbf rev-list --header: output format fix
Initial fix prepared by Johannes, but I did it slightly differently.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-17 12:42:36 -07:00
Junio C Hamano 1b65a5aa44 rev-list --boundary: show boundary commits even when limited otherwise.
The boundary commits are shown for UI like gitk to draw them as
soon as topo-order sorting allows, and should not be omitted by
get_revision() filtering logic.  As long as their immediate
child commits are shown, we should not filter them out.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-16 22:05:38 -07:00
A Large Angry SCM e6bfaf3e33 Makefile fixups.
Signed-off-by: A Large Angry SCM <gitzilla@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-16 20:42:37 -07:00
Junio C Hamano 1a17ee22a2 Merge git://git.kernel.org/pub/scm/gitk/gitk
* git://git.kernel.org/pub/scm/gitk/gitk:
  gitk: Fix bug caused by missing commitlisted elements
2006-04-16 18:59:30 -07:00
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