Code

git.git
17 years agorefresh_index_quietly(): express "optional" nature of index writing better
Junio C Hamano [Fri, 9 Nov 2007 00:24:00 +0000 (16:24 -0800)]
refresh_index_quietly(): express "optional" nature of index writing better

The point of the part of the code this patch touches is that if
we modified the active_cache, we try to write it out and make it
the index file for later users to use by calling
"commit_locked_index", but we do not really care about the
failure from this sequence because it is done purely as an
optimization.

The original code called three functions primarily for their
side effects but as condition of an if statement, which is
admittedly a bad style.

Incidentally, it squelches an "empty if body" warning from gcc.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agoFix sed string regex escaping in module_name.
Ralf Wildenhues [Thu, 8 Nov 2007 21:48:49 +0000 (22:48 +0100)]
Fix sed string regex escaping in module_name.

When escaping a string to be used as a sed regex, it is important
to only escape active characters.  Escaping other characters is
undefined according to POSIX, and in practice leads to issues with
extensions such as GNU sed's \+.

Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agoAvoid a few unportable, needlessly nested "...`...".
Ralf Wildenhues [Thu, 8 Nov 2007 21:47:36 +0000 (22:47 +0100)]
Avoid a few unportable, needlessly nested "...`...".

Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agogit-mailsplit: with maildirs not only process cur/, but also new/
Gerrit Pape [Tue, 6 Nov 2007 08:54:18 +0000 (08:54 +0000)]
git-mailsplit: with maildirs not only process cur/, but also new/

When saving patches to a maildir with e.g. mutt, the files are put into
the new/ subdirectory of the maildir, not cur/.  This makes git-am state
"Nothing to do.".  This patch lets git-mailsplit additional check new/
after reading cur/.

This was reported by Joey Hess through
 http://bugs.debian.org/447396

Signed-off-by: Gerrit Pape <pape@smarden.org>
Acked-by: Jeff King <peff@peff.net>
Acked-by: Alex Riesen <raa.lkml@gmail.com>
Acked-by: Fernando J. Pereda <ferdy@gentoo.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agoAdd Documentation/CodingGuidelines
Johannes Schindelin [Thu, 8 Nov 2007 00:33:19 +0000 (00:33 +0000)]
Add Documentation/CodingGuidelines

Even if our code is quite a good documentation for our coding style,
some people seem to prefer a document describing it.

The part about the shell scripts is clearly just copied from one of
Junio's helpful mails, and some parts were added from comments by
Junio, Andreas Ericsson and Robin Rosenberg.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agoWhen exec() fails include the failing command in the error message
Ask Bjørn Hansen [Tue, 6 Nov 2007 10:54:01 +0000 (02:54 -0800)]
When exec() fails include the failing command in the error message

git-svn occasionally fails with no details as to what went wrong - this should help debug those situations.

Signed-off-by: Ask Bjørn Hansen <ask@develooper.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agoRelNotes-1.5.3.5: fix another typo
David D Kilzer [Sun, 4 Nov 2007 12:45:22 +0000 (04:45 -0800)]
RelNotes-1.5.3.5: fix another typo

Signed-off-by: David D Kilzer <ddkilzer@kilzer.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agoRemove a couple of duplicated include
Marco Costalba [Sun, 4 Nov 2007 14:35:26 +0000 (15:35 +0100)]
Remove a couple of duplicated include

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agogrep with unmerged index
Junio C Hamano [Tue, 6 Nov 2007 01:16:47 +0000 (17:16 -0800)]
grep with unmerged index

We called flush_grep() every time we saw an unmerged entry in
the index.  If we happen to find an unmerged entry before we saw
more than two paths, we incorrectly declared that the user had
too many non-paths options in front.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agoMerge branch 'gp/maint-diffdoc' into maint
Junio C Hamano [Tue, 6 Nov 2007 02:56:55 +0000 (18:56 -0800)]
Merge branch 'gp/maint-diffdoc' into maint

* gp/maint-diffdoc:
  git-diff.txt: add section "output format" describing the diff formats

17 years agogit-daemon: fix remote port number in log entry
Gerrit Pape [Mon, 5 Nov 2007 09:16:22 +0000 (09:16 +0000)]
git-daemon: fix remote port number in log entry

The port number in struct sockaddr_in needs to be converted from network
byte order to host byte order (on some architectures).

Signed-off-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agogit-svn: t9114: verify merge commit message in test
Eric Wong [Mon, 5 Nov 2007 11:21:48 +0000 (03:21 -0800)]
git-svn: t9114: verify merge commit message in test

It's possible that we end up with an incorrect commit message
in this test after making changes to fix the clobber bug
in dcommit.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agogit-svn: fix dcommit clobbering when committing a series of diffs
Eric Wong [Mon, 5 Nov 2007 11:21:47 +0000 (03:21 -0800)]
git-svn: fix dcommit clobbering when committing a series of diffs

Our revision number sent to SVN is set to the last revision we
committed if we've made any previous commits in a dcommit
invocation.

Although our SVN Editor code uses the delta of two (old) trees
to generate information to send upstream, it'll still send
complete resultant files upstream; even if the tree they're
based against is out-of-date.

The combination of sending a file that does not include the
latest changes, but set with a revision number of a commit we
just made will cause SVN to accept the resultant file even if it
was generated against an old tree.

More trouble was caused when fixing this because we were
rebasing uncessarily at times.  We used git-diff-tree to check
the imported SVN revision against our HEAD, not the last tree we
committed to SVN.  The unnecessary rebasing caused merge commits
upstream to SVN to fail.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agoRelNotes-1.5.3.5: fix typo
David D Kilzer [Sat, 3 Nov 2007 14:04:52 +0000 (07:04 -0700)]
RelNotes-1.5.3.5: fix typo

Signed-off-by: David D Kilzer <ddkilzer@kilzer.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agoDelay pager setup in git blame
Mike Hommey [Sat, 3 Nov 2007 12:22:53 +0000 (13:22 +0100)]
Delay pager setup in git blame

This avoids to launch the pager when git blame fails for any reason.

Signed-off-by: Mike Hommey <mh@glandium.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agogit-cvsimport: really convert underscores in branch names to dots with -u
Gerrit Pape [Sat, 3 Nov 2007 11:55:02 +0000 (11:55 +0000)]
git-cvsimport: really convert underscores in branch names to dots with -u

The documentation states for the -u option that underscores in tag and
branch names are converted to dots, but this was actually implemented
for the tag names only.

Kurt Roeckx reported this through
 http://bugs.debian.org/446495

Signed-off-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agoFixing path quoting in git-rebase
Jonathan del Strother [Wed, 17 Oct 2007 09:31:35 +0000 (10:31 +0100)]
Fixing path quoting in git-rebase

git-rebase used to fail when run from a path containing a space.

Signed-off-by: Jonathan del Strother <jon.delStrother@bestbefore.tv>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
17 years agoMerge branch 'bk/maint-cvsexportcommit' into maint
Junio C Hamano [Fri, 2 Nov 2007 22:40:54 +0000 (15:40 -0700)]
Merge branch 'bk/maint-cvsexportcommit' into maint

* bk/maint-cvsexportcommit:
  cvsexportcommit: fix for commits that do not have parents

17 years agoRemove unecessary hard-coding of EDITOR=':' VISUAL=':' in some test suites.
Kristian Høgsberg [Fri, 2 Nov 2007 15:33:07 +0000 (11:33 -0400)]
Remove unecessary hard-coding of EDITOR=':' VISUAL=':' in some test suites.

They are already set and exoprted by sourcing ./test-lib.sh
in all test scripts.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agoDocumentation: quote commit messages consistently.
Sergei Organov [Fri, 2 Nov 2007 17:12:57 +0000 (20:12 +0300)]
Documentation: quote commit messages consistently.

Documentation quotes commit messages 14 times with double-quotes, and 7
times with single-quotes. The patch turns everything to double-quotes.

A nice side effect is that documentation becomes more Windoze-friendly
as AFAIK single quotes won't work there.

Signed-off-by: Sergei Organov <osv@javad.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agoRemove escaping of '|' in manpage option sections
Jonas Fonseca [Fri, 2 Nov 2007 09:10:11 +0000 (10:10 +0100)]
Remove escaping of '|' in manpage option sections

The escaped were ending up verbatim in the generated documentation.

Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agogit-diff.txt: add section "output format" describing the diff formats
Gerrit Pape [Wed, 31 Oct 2007 13:59:16 +0000 (13:59 +0000)]
git-diff.txt: add section "output format" describing the diff formats

git-diff.txt includes diff-options.txt which for the -p option refers
to a section "generating patches.." which is missing from the git-diff
documentation.  This patch adapts diff-format.txt to additionally
mention the git-diff program, and includes diff-format.txt into
git-diff.txt.

Tino Keitel noticed this problem.

Signed-off-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agogit-format-patch.txt: fix explanation of an example.
Sergei Organov [Thu, 1 Nov 2007 14:21:39 +0000 (17:21 +0300)]
git-format-patch.txt: fix explanation of an example.

Signed-off-by: Sergei Organov <osv@javad.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agogit-filter-branch.txt: fix a typo.
Sergei Organov [Thu, 1 Nov 2007 13:24:11 +0000 (16:24 +0300)]
git-filter-branch.txt: fix a typo.

Signed-off-by: Sergei Organov <osv@javad.com>
Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agogit-clone.txt: Improve --depth description.
Ralf Wildenhues [Thu, 1 Nov 2007 08:46:02 +0000 (09:46 +0100)]
git-clone.txt: Improve --depth description.

Avoid abbreviation 'revs', improve the language a bit.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agogitweb: Update config file example for snapshot feature in gitweb/INSTALL
Jakub Narebski [Thu, 1 Nov 2007 12:45:33 +0000 (13:45 +0100)]
gitweb: Update config file example for snapshot feature in gitweb/INSTALL

Commit a3c8ab30a54c30a6a434760bedf04548425416ef by Matt McCutchen
  "gitweb: snapshot cleanups & support for offering multiple formats"
introduced new format of $feature{'snapshot'}{'default'} value. Update
"Config file example" in gitweb/INSTALL accordingly.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agocvsexportcommit: fix for commits that do not have parents
Brad King [Wed, 31 Oct 2007 20:55:13 +0000 (16:55 -0400)]
cvsexportcommit: fix for commits that do not have parents

Previously commits without parents would fail to export with a
message indicating that the commits had more than one parent.
Instead we should use the --root option for git-diff-tree in
place of a parent.

Signed-off-by: Brad King <brad.king@kitware.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agoGIT 1.5.3.5 v1.5.3.5
Junio C Hamano [Wed, 31 Oct 2007 19:20:05 +0000 (12:20 -0700)]
GIT 1.5.3.5

Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agoUpdate GIT 1.5.3.5 Release Notes
Junio C Hamano [Wed, 31 Oct 2007 04:32:49 +0000 (21:32 -0700)]
Update GIT 1.5.3.5 Release Notes

Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agogit-rebase--interactive.sh: Make 3-way merge strategies work for -p.
Björn Steinbrink [Wed, 31 Oct 2007 02:20:32 +0000 (03:20 +0100)]
git-rebase--interactive.sh: Make 3-way merge strategies work for -p.

git-rebase--interactive.sh used to pass all parents of a merge commit to
git-merge, which means that we have at least 3 heads to merge: HEAD,
first parent and second parent. So 3-way merge strategies like recursive
wouldn't work.

Fortunately, we have checked out the first parent right before the merge
anyway, so that is HEAD. Therefore we can drop simply it from the list
of parents, making 3-way strategies work for merge commits with only
two parents.

Signed-off-by: Björn Steinbrink <B.Steinbrink@gmx.de>
Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agogit-rebase--interactive.sh: Don't pass a strategy to git-cherry-pick.
Björn Steinbrink [Wed, 31 Oct 2007 02:20:31 +0000 (03:20 +0100)]
git-rebase--interactive.sh: Don't pass a strategy to git-cherry-pick.

git-cherry-pick doesn't support a strategy paramter, so don't pass one.
This means that --strategy for interactive rebases is a no-op for
anything but merge commits, but that's still better than being broken. A
correct fix would probably need to port the --merge behaviour from plain
git-rebase.sh, but I have no clue how to integrate that cleanly.

Signed-off-by: Björn Steinbrink <B.Steinbrink@gmx.de>
Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agoFix --strategy parsing in git-rebase--interactive.sh
Björn Steinbrink [Wed, 31 Oct 2007 02:20:30 +0000 (03:20 +0100)]
Fix --strategy parsing in git-rebase--interactive.sh

For the --strategy/-s option, git-rebase--interactive.sh dropped the
parameter which it was trying to parse.

Signed-off-by: Björn Steinbrink <B.Steinbrink@gmx.de>
Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agoMake merge-recursive honor diff.renamelimit
Lars Hjemli [Tue, 25 Sep 2007 06:36:38 +0000 (08:36 +0200)]
Make merge-recursive honor diff.renamelimit

It might be a sign of source code management gone bad, but when two branches
has diverged almost beyond recognition and time has come for the branches to
merge, the user is going to need all the help his tool can give him. Honoring
diff.renamelimit has great potential as a painkiller in such situations.

The painkiller effect could have been achieved by e.g. 'merge.renamelimit',
but the flexibility gained by a separate option is questionable: our user
would probably expect git to detect renames equally good when merging as
when diffing (I known I did).

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agocherry-pick/revert: more compact user direction message
Nicolas Pitre [Tue, 30 Oct 2007 19:59:24 +0000 (15:59 -0400)]
cherry-pick/revert: more compact user direction message

A failed cherry-pick (and friend) currently says:

|Automatic cherry-pick failed.  After resolving the conflicts,
|mark the corrected paths with 'git-add <paths>'
|and commit the result.

This can obviously be displayed on two lines only.
While at it, change "git-add" to "git add".

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agocore-tutorial: Use new syntax for git-merge.
Sergei Organov [Tue, 30 Oct 2007 19:54:02 +0000 (22:54 +0300)]
core-tutorial: Use new syntax for git-merge.

"git-merge <msg> HEAD <other branches>" is still supported but
we shouldn't encourage its use.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agogit-merge: document but discourage the historical syntax
Junio C Hamano [Tue, 30 Oct 2007 18:54:11 +0000 (11:54 -0700)]
git-merge: document but discourage the historical syntax

Historically "git merge" took its command line arguments in a
rather strange order.  Document the historical syntax, and also
document clearly that it is not encouraged in new scripts.

There is no reason to deprecate the historical syntax, as the
current code can sanely tell which syntax the caller is using,
and existing scripts by people do use the historical syntax.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agoPrevent send-pack from segfaulting (backport from 'master')
Junio C Hamano [Tue, 30 Oct 2007 18:30:43 +0000 (11:30 -0700)]
Prevent send-pack from segfaulting (backport from 'master')

4491e62ae932d5774f628d1bd3be663c11058a73 (Prevent send-pack from
segfaulting when a branch doesn't match) is hereby cherry-picked
back to 'maint'.

If we can't find a source match, and we have no destination, we
need to abort the match function early before we try to match
the destination against the remote.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agoDocumentation/git-cvsexportcommit.txt: s/mgs/msg/ in example
Michael W. Olson [Tue, 30 Oct 2007 13:53:47 +0000 (09:53 -0400)]
Documentation/git-cvsexportcommit.txt: s/mgs/msg/ in example

Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agoRelNotes-1.5.3.5: describe recent fixes
Junio C Hamano [Mon, 29 Oct 2007 19:02:59 +0000 (12:02 -0700)]
RelNotes-1.5.3.5: describe recent fixes

Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agomerge-recursive.c: mrtree in merge() is not used before set
Junio C Hamano [Mon, 29 Oct 2007 19:00:55 +0000 (12:00 -0700)]
merge-recursive.c: mrtree in merge() is not used before set

The called function merge_trees() sets its *result, to which the
address of the variable mrtree in merge() function is passed,
only when index_only is set.  But that is Ok as the function
uses the value in the variable only under index_only iteration.

However, recent gcc does not realize this.  Work it around by
adding a fake initializer.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agosha1_file.c: avoid gcc signed overflow warnings
Junio C Hamano [Mon, 29 Oct 2007 18:53:55 +0000 (11:53 -0700)]
sha1_file.c: avoid gcc signed overflow warnings

With the recent gcc, we get:

sha1_file.c: In check_packed_git_:
sha1_file.c:527: warning: assuming signed overflow does not
occur when assuming that (X + c) < X is always false
sha1_file.c:527: warning: assuming signed overflow does not
occur when assuming that (X + c) < X is always false

for a piece of code that tries to make sure that off_t is large
enough to hold more than 2^32 offset.  The test tried to make
sure these do not wrap-around:

    /* make sure we can deal with large pack offsets */
    off_t x = 0x7fffffffUL, y = 0xffffffffUL;
    if (x > (x + 1) || y > (y + 1)) {

but gcc assumes it can do whatever optimization it wants for a
signed overflow (undefined behaviour) and warns about this
construct.

Follow Linus's suggestion to check sizeof(off_t) instead to work
around the problem.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agoFix a small memory leak in builtin-add
Benoit Sigoure [Mon, 29 Oct 2007 07:00:33 +0000 (08:00 +0100)]
Fix a small memory leak in builtin-add

prune_directory and fill_directory allocated one byte per pathspec and never
freed it.

Signed-off-by: Benoit Sigoure <tsuna@lrde.epita.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agohonor the http.sslVerify option in shell scripts
Aurelien Bompard [Sun, 28 Oct 2007 17:47:30 +0000 (18:47 +0100)]
honor the http.sslVerify option in shell scripts

Signed-off-by: Aurélien Bompard <aurelien@bompard.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agoFix generation of perl/perl.mak
Alex Riesen [Thu, 25 Oct 2007 20:17:24 +0000 (22:17 +0200)]
Fix generation of perl/perl.mak

The code generating perl/Makefile from Makefile.PL was causing trouble
because it didn't considered NO_PERL_MAKEMAKER and ran makemaker
unconditionally, rewriting perl.mak. Makemaker is FUBAR in ActiveState Perl,
and perl/Makefile has a replacement for it.

Besides, a changed Git.pm is *NOT* a reason to rebuild all the perl scripts,
so remove the dependency too.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agogit-remote: fix "Use of uninitialized value in string ne"
Junio C Hamano [Wed, 24 Oct 2007 11:49:51 +0000 (04:49 -0700)]
git-remote: fix "Use of uninitialized value in string ne"

martin f krafft <madduck@madduck.net> writes:

> piper:~> git remote show origin
> * remote origin
>   URL: ssh://git.madduck.net/~/git/etc/mailplate.git
> Use of uninitialized value in string ne at /usr/local/stow/git/bin/git-remote line 248.

This is because there might not be branch.<name>.remote defined but
the code unconditionally dereferences $branch->{$name}{'REMOTE'} and
compares with another string.

Tested-by: Martin F Krafft <madduck@madduck.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agoDescribe more 1.5.3.5 fixes in release notes
Shawn O. Pearce [Sun, 21 Oct 2007 03:40:06 +0000 (23:40 -0400)]
Describe more 1.5.3.5 fixes in release notes

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
17 years agoFix diffcore-break total breakage
Linus Torvalds [Sat, 20 Oct 2007 19:31:31 +0000 (12:31 -0700)]
Fix diffcore-break total breakage

Ok, so on the kernel list, some people noticed that "git log --follow"
doesn't work too well with some files in the x86 merge, because a lot of
files got renamed in very special ways.

In particular, there was a pattern of doing single commits with renames
that looked basically like

 - rename "filename.h" -> "filename_64.h"
 - create new "filename.c" that includes "filename_32.h" or
   "filename_64.h" depending on whether we're 32-bit or 64-bit.

which was preparatory for smushing the two trees together.

Now, there's two issues here:

 - "filename.c" *remained*. Yes, it was a rename, but there was a new file
   created with the old name in the same commit. This was important,
   because we wanted each commit to compile properly, so that it was
   bisectable, so splitting the rename into one commit and the "create
   helper file" into another was *not* an option.

   So we need to break associations where the contents change too much.
   Fine. We have the -B flag for that. When we break things up, then the
   rename detection will be able to figure out whether there are better
   alternatives.

 - "git log --follow" didn't with with -B.

Now, the second case was really simple: we use a different "diffopt"
structure for the rename detection than the basic one (which we use for
showing the diffs). So that second case is trivially fixed by a trivial
one-liner that just copies the break_opt values from the "real" diffopts
to the one used for rename following. So now "git log -B --follow" works
fine:

diff --git a/tree-diff.c b/tree-diff.c
index 26bdbdd..7c261fd 100644
--- a/tree-diff.c
+++ b/tree-diff.c
@@ -319,6 +319,7 @@ static void try_to_follow_renames(struct tree_desc *t1, struct tree_desc *t2, co
  diff_opts.detect_rename = DIFF_DETECT_RENAME;
  diff_opts.output_format = DIFF_FORMAT_NO_OUTPUT;
  diff_opts.single_follow = opt->paths[0];
+ diff_opts.break_opt = opt->break_opt;
  paths[0] = NULL;
  diff_tree_setup_paths(paths, &diff_opts);
  if (diff_setup_done(&diff_opts) < 0)

however, the end result does *not* work. Because our diffcore-break.c
logic is totally bogus!

In particular:

 - it used to do

if (base_size < MINIMUM_BREAK_SIZE)
return 0; /* we do not break too small filepair */

   which basically says "don't bother to break small files". But that
   "base_size" is the *smaller* of the two sizes, which means that if some
   large file was rewritten into one that just includes another file, we
   would look at the (small) result, and decide that it's smaller than the
   break size, so it cannot be worth it to break it up! Even if the other
   side was ten times bigger and looked *nothing* like the samell file!

   That's clearly bogus. I replaced "base_size" with "max_size", so that
   we compare the *bigger* of the filepair with the break size.

 - It calculated a "merge_score", which was the score needed to merge it
   back together if nothing else wanted it. But even if it was *so*
   different that we would never want to merge it back, we wouldn't
   consider it a break! That makes no sense. So I added

if (*merge_score_p > break_score)
return 1;

   to make it clear that if we wouldn't want to merge it at the end, it
   was *definitely* a break.

 - It compared the whole "extent of damage", counting all inserts and
   deletes, but it based this score on the "base_size", and generated the
   damage score with

delta_size = src_removed + literal_added;
damage_score = delta_size * MAX_SCORE / base_size;

   but that makes no sense either, since quite often, this will result in
   a number that is *bigger* than MAX_SCORE! Why? Because base_size is
   (again) the smaller of the two files we compare, and when you start out
   from a small file and add a lot (or start out from a large file and
   remove a lot), the base_size is going to be much smaller than the
   damage!

   Again, the fix was to replace "base_size" with "max_size", at which
   point the damage actually becomes a sane percentage of the whole.

With these changes in place, not only does "git log -B --follow" work for
the case that triggered this in the first place, ie now

git log -B --follow arch/x86/kernel/vmlinux_64.lds.S

actually gives reasonable results. But I also wanted to verify it in
general, by doing a full-history

git log --stat -B -C

on my kernel tree with the old code and the new code.

There's some tweaking to be done, but generally, the new code generates
much better results wrt breaking up files (and then finding better rename
candidates). Here's a few examples of the "--stat" output:

 - This:
include/asm-x86/Kbuild        |    2 -
include/asm-x86/debugreg.h    |   79 +++++++++++++++++++++++++++++++++++------
include/asm-x86/debugreg_32.h |   64 ---------------------------------
include/asm-x86/debugreg_64.h |   65 ---------------------------------
4 files changed, 68 insertions(+), 142 deletions(-)

      Becomes:

include/asm-x86/Kbuild                        |    2 -
include/asm-x86/{debugreg_64.h => debugreg.h} |    9 +++-
include/asm-x86/debugreg_32.h                 |   64 -------------------------
3 files changed, 7 insertions(+), 68 deletions(-)

 - This:
include/asm-x86/bug.h    |   41 +++++++++++++++++++++++++++++++++++++++--
include/asm-x86/bug_32.h |   37 -------------------------------------
include/asm-x86/bug_64.h |   34 ----------------------------------
3 files changed, 39 insertions(+), 73 deletions(-)

      Becomes

include/asm-x86/{bug_64.h => bug.h} |   20 +++++++++++++-----
include/asm-x86/bug_32.h            |   37 -----------------------------------
2 files changed, 14 insertions(+), 43 deletions(-)

Now, in some other cases, it does actually turn a rename into a real
"delete+create" pair, and then the diff is usually bigger, so truth in
advertizing: it doesn't always generate a nicer diff. But for what -B was
meant for, I think this is a big improvement, and I suspect those cases
where it generates a bigger diff are tweakable.

So I think this diff fixes a real bug, but we might still want to tweak
the default values and perhaps the exact rules for when a break happens.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
17 years agoFix directory scanner to correctly ignore files without d_type
Linus Torvalds [Fri, 19 Oct 2007 17:59:22 +0000 (10:59 -0700)]
Fix directory scanner to correctly ignore files without d_type

On Fri, 19 Oct 2007, Todd T. Fries wrote:
> If DT_UNKNOWN exists, then we have to do a stat() of some form to
> find out the right type.

That happened in the case of a pathname that was ignored, and we did
not ask for "dir->show_ignored". That test used to be *together*
with the "DTYPE(de) != DT_DIR", but splitting the two tests up
means that we can do that (common) test before we even bother to
calculate the real dtype.

Of course, that optimization only matters for systems that don't
have, or don't fill in DTYPE properly.

I also clarified the real relationship between "exclude" and
"dir->show_ignored". It used to do

if (exclude != dir->show_ignored) {
..

which wasn't exactly obvious, because it triggers for two different
cases:

 - the path is marked excluded, but we are not interested in ignored
   files: ignore it

 - the path is *not* excluded, but we *are* interested in ignored
   files: ignore it unless it's a directory, in which case we might
   have ignored files inside the directory and need to recurse
   into it).

so this splits them into those two cases, since the first case
doesn't even care about the type.

I also made a the DT_UNKNOWN case a separate helper function,
and added some commentary to the cases.

Linus

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
17 years agoMerge branch 'maint' of git://repo.or.cz/git-gui into maint
Shawn O. Pearce [Sun, 21 Oct 2007 03:19:22 +0000 (23:19 -0400)]
Merge branch 'maint' of git://repo.or.cz/git-gui into maint

* 'maint' of git://repo.or.cz/git-gui:
  git-gui: Don't display CR within console windows
  git-gui: Handle progress bars from newer gits
  git-gui: Correctly report failures from git-write-tree
  git-gui: accept versions containing text annotations, like 1.5.3.mingw.1
  git-gui: Don't crash when starting gitk from a browser session
  git-gui: Allow gitk to be started on Cygwin with native Tcl/Tk
  git-gui: Ensure .git/info/exclude is honored in Cygwin workdirs
  git-gui: Handle starting on mapped shares under Cygwin
  git-gui: Display message box when we cannot find git in $PATH
  git-gui: Avoid using bold text in entire gui for some fonts

17 years agoImprove receive-pack error message about funny ref creation
Joakim Tjernlund [Sat, 20 Oct 2007 19:31:46 +0000 (21:31 +0200)]
Improve receive-pack error message about funny ref creation

receive-pack is only executed remotely so when
reporting errors, say so.

Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
17 years agofast-import: Fix argument order to die in file_change_m
Julian Phillips [Sat, 20 Oct 2007 16:15:38 +0000 (17:15 +0100)]
fast-import: Fix argument order to die in file_change_m

The arguments to the "Not a blob" die call in file_change_m were
transposed, so that the command was printed as the type, and the type
as the command.  Switch them around so that the error message comes
out correctly.

Signed-off-by: Julian Phillips <julian@quantumfyre.co.uk>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
17 years agogit-gui: Don't display CR within console windows gitgui-0.8.4
Shawn O. Pearce [Sun, 21 Oct 2007 00:42:01 +0000 (20:42 -0400)]
git-gui: Don't display CR within console windows

Git progress bars from tools like git-push and git-fetch use CR
to skip back to the start of the current line and redraw it with
an updated progress.  We were doing this in our Tk widget but had
failed to skip the CR, which Tk doesn't draw well.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
17 years agogit-gui: Handle progress bars from newer gits
Shawn O. Pearce [Sat, 20 Oct 2007 18:16:15 +0000 (14:16 -0400)]
git-gui: Handle progress bars from newer gits

Post Git 1.5.3 a new style progress bar has been introduced that
uses only one line rather than two.  The formatting of the completed
and total section is also slightly different so we must adjust our
regexp to match.  Unfortunately both styles are in active use by
different versions of Git so we need to look for both.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
17 years agogit-gui: Correctly report failures from git-write-tree
Shawn O. Pearce [Sat, 20 Oct 2007 05:42:01 +0000 (01:42 -0400)]
git-gui: Correctly report failures from git-write-tree

If git-write-tree fails (such as if the index file is currently
locked and it wants to write to it) we were not getting the error
message as $tree_id was always the empty string so we shortcut
through the catch and never got the output from stderr.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
17 years agogitk.txt: Fix markup.
Ralf Wildenhues [Fri, 19 Oct 2007 17:24:43 +0000 (19:24 +0200)]
gitk.txt: Fix markup.

For the manpage, avoid generating an em dash in code.

Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
17 years agosend-pack: respect '+' on wildcard refspecs
Jeff King [Fri, 19 Oct 2007 09:04:00 +0000 (05:04 -0400)]
send-pack: respect '+' on wildcard refspecs

When matching source and destination refs, we were failing
to pull the 'force' parameter from wildcard refspecs (but
not explicit ones) and attach it to the ref struct.

This adds a test for explicit and wildcard refspecs; the
latter fails without this patch.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
17 years agoPaper bag fix diff invocation in 'git stash show'
Shawn O. Pearce [Fri, 19 Oct 2007 06:18:14 +0000 (02:18 -0400)]
Paper bag fix diff invocation in 'git stash show'

In 89d750bf6fa025edeb31ad258cdd09a27a5c02fa I got a little too
aggressive with changing "git diff" to "git diff-tree".  This is
shown to the user, who expects to see a full diff on their console,
and will want to see the output of their custom diff drivers (if
any) as the whole point of this call site is to show the diff to
the end-user.

Noticed by Johannes Sixt <j.sixt@viscovery.net>.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
17 years agoFurther 1.5.3.5 fixes described in release notes
Shawn O. Pearce [Fri, 19 Oct 2007 05:18:29 +0000 (01:18 -0400)]
Further 1.5.3.5 fixes described in release notes

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
17 years agoAvoid invoking diff drivers during git-stash
Shawn O. Pearce [Fri, 19 Oct 2007 01:28:43 +0000 (21:28 -0400)]
Avoid invoking diff drivers during git-stash

git-stash needs to restrict itself to plumbing when running automated
diffs as part of its operation as the user may have configured a
custom diff driver that opens an interactive UI for certain/all
files.  Doing that during scripted actions is very unfriendly to
the end-user and may cause git-stash to fail to work.

Reported by Johannes Sixt

Acked-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
17 years agoattr: fix segfault in gitattributes parsing code
Steffen Prohaska [Thu, 18 Oct 2007 20:02:35 +0000 (22:02 +0200)]
attr: fix segfault in gitattributes parsing code

git may segfault if gitattributes contains an invalid
entry. A test is added to t0020 that triggers the segfault.
The parsing code is fixed to avoid the crash.

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
17 years agoDefine NI_MAXSERV if not defined by operating system
Patrick Welche [Thu, 18 Oct 2007 17:17:39 +0000 (18:17 +0100)]
Define NI_MAXSERV if not defined by operating system

I found I needed NI_MAXSERV as it is defined in netdb.h, which is
not included by daemon.c.  Rather than including the whole header
we can define a reasonable fallback value.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
17 years agoEnsure we add directories in the correct order
Alex Bennee [Thu, 18 Oct 2007 16:15:44 +0000 (17:15 +0100)]
Ensure we add directories in the correct order

CVS gets understandably upset if you try and add a subdirectory
before it's parent directory. This patch fixes that.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
17 years agoAvoid scary errors about tagged trees/blobs during git-fetch
Linus Torvalds [Thu, 18 Oct 2007 23:24:47 +0000 (16:24 -0700)]
Avoid scary errors about tagged trees/blobs during git-fetch

Ok, what is going on is:

 - append_fetch_head() looks up the SHA1 for all heads (including tags):

        if (get_sha1(head, sha1))
                return error("Not a valid object name: %s", head);

 - it then wants to check if it's a candidate for merging (because
   fetching also does the whole "list which heads to merge" in case
   it is going to be part of a "pull"):

        commit = lookup_commit_reference(sha1);
        if (!commit)
                not_for_merge = 1;

 - and that "lookup_commit_reference()" is just very vocal about the
   case where it fails. It really shouldn't be, and it shouldn't
   affect the actual end result, but that basically explains why
   you get that scary warning.

In short, the warning is just bogus, and should be harmless, but
I agree that it's ugly. I think the appended patch should fix it.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
17 years agoYet more 1.5.3.5 fixes mentioned in release notes
Shawn O. Pearce [Thu, 18 Oct 2007 07:11:03 +0000 (03:11 -0400)]
Yet more 1.5.3.5 fixes mentioned in release notes

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
17 years agocvsserver: Use exit 1 instead of die when req_Root fails.
Brian Gernhardt [Wed, 17 Oct 2007 14:05:47 +0000 (10:05 -0400)]
cvsserver: Use exit 1 instead of die when req_Root fails.

This was causing test failures because die was exiting 255.

Signed-off-by: Brian Gernhardt <benji@silverinsanity.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
17 years agogit-blame shouldn't crash if run in an unmerged tree
Linus Torvalds [Thu, 18 Oct 2007 06:31:30 +0000 (02:31 -0400)]
git-blame shouldn't crash if run in an unmerged tree

If we are in the middle of resolving a merge conflict there may be
one or more files whose entries in the index represent an unmerged
state (index entries in the higher-order stages).

Attempting to run git-blame on any file in such a working directory
resulted in "fatal: internal error: ce_mode is 0" as we use the magic
marker for an unmerged entry is 0 (set up by things like diff-lib.c's
do_diff_cache() and builtin-read-tree.c's read_tree_unmerged())
and the ce_match_stat_basic() function gets upset about this.

I'm not entirely sure that the whole "ce_mode = 0" case is a good
idea to begin with, and maybe the right thing to do is to remove
that horrid freakish special case, but removing the internal error
seems to be the simplest fix for now.

                Linus

[sp: Thanks to Björn Steinbrink for the test case]

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
17 years agogit-config: print error message if the config file cannot be read
Gerrit Pape [Fri, 12 Oct 2007 11:40:57 +0000 (11:40 +0000)]
git-config: print error message if the config file cannot be read

Instead of simply exiting with 255, print an error message including
the reason why a config file specified through --file cannot be opened
or read.

The problem was noticed by Joey Hess, reported through
 http://bugs.debian.org/445208

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
17 years agofixing output of non-fast-forward output of post-receive-email
Robert Schiele [Wed, 17 Oct 2007 22:27:51 +0000 (00:27 +0200)]
fixing output of non-fast-forward output of post-receive-email

post-receive-email has one place where the variable fast_forward is not
spelled correctly.  At the same place the logic was reversed.  The
combination of both bugs made the script work correctly for fast-forward
commits but not for non-fast-forward ones.  This change fixes this to
be correct in both cases.

Signed-off-by: Robert Schiele <rschiele@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
17 years agoDocument additional 1.5.3.5 fixes in release notes
Shawn O. Pearce [Wed, 17 Oct 2007 03:31:58 +0000 (23:31 -0400)]
Document additional 1.5.3.5 fixes in release notes

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
17 years agoAvoid 'expr index' on Mac OS X as it isn't supported
Shawn O. Pearce [Wed, 17 Oct 2007 01:33:11 +0000 (21:33 -0400)]
Avoid 'expr index' on Mac OS X as it isn't supported

This fixes git-instaweb so it can start an httpd without warning
about an invalid test command.  Yes its ugly, but its also quite
portable.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
17 years agofilter-branch: update current branch when rewritten
Johannes Schindelin [Wed, 17 Oct 2007 02:23:10 +0000 (03:23 +0100)]
filter-branch: update current branch when rewritten

Earlier, "git filter-branch --<options> HEAD" would not update the
working tree after rewriting the branch.  This commit fixes it.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
17 years agofix filter-branch documentation
Johannes Schindelin [Wed, 17 Oct 2007 02:22:25 +0000 (03:22 +0100)]
fix filter-branch documentation

The man page for filter-branch still talked about writing the result
to the branch "newbranch".  This is hopefully the last place where the
old behaviour was described.

Noticed by Bill Lear.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
17 years agohelpful error message when send-pack finds no refs in common.
Andrew Clausen [Tue, 16 Oct 2007 21:16:05 +0000 (17:16 -0400)]
helpful error message when send-pack finds no refs in common.

Signed-off-by: Andrew Clausen <clausen@econ.upenn.edu>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
17 years agoFix setup_git_directory_gently() with relative GIT_DIR & GIT_WORK_TREE
Johannes Schindelin [Tue, 16 Oct 2007 23:37:36 +0000 (00:37 +0100)]
Fix setup_git_directory_gently() with relative GIT_DIR & GIT_WORK_TREE

There are a few programs, such as config and diff, which allow running
without a git repository.  Therefore, they have to call
setup_git_directory_gently().

However, when GIT_DIR and GIT_WORK_TREE were set, and the current
directory was a subdirectory of the work tree,
setup_git_directory_gently() would return a bogus NULL prefix.

This patch fixes that.

Noticed by REPLeffect on IRC.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
17 years agoCorrect typos in release notes for 1.5.3.5
Shawn O. Pearce [Wed, 17 Oct 2007 00:09:21 +0000 (20:09 -0400)]
Correct typos in release notes for 1.5.3.5

Noticed by Michele Ballabio.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
17 years agoWhip post 1.5.3.4 maintenance series into shape.
Shawn O. Pearce [Tue, 16 Oct 2007 02:29:50 +0000 (22:29 -0400)]
Whip post 1.5.3.4 maintenance series into shape.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
17 years agorebase -i: use diff plumbing instead of porcelain
Johannes Schindelin [Tue, 9 Oct 2007 12:59:43 +0000 (13:59 +0100)]
rebase -i: use diff plumbing instead of porcelain

When diff drivers are installed, calling "git diff <tree1>..<tree2>"
calls those drivers.  This borks the patch generation of rebase -i.
So use "git diff-tree -p" instead, which does not call diff drivers.

Noticed by Johannes Sixt.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
17 years agoDo not remove distributed configure script
Mathias Megyei [Thu, 4 Oct 2007 21:49:19 +0000 (23:49 +0200)]
Do not remove distributed configure script

Before this patch the clean target has removed the
configure script that comes with Git tar file.
That made compiling Git for different architectures
inconvenient.
This patch excludes configure from the files to be
deleted by 'make clean' and adds new target 'distclean'
to preserve old functionality.

Signed-off-by: Mathias Megyei <mathias@mnet-mail.de>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
17 years agogit-archive: document --exec
Michele Ballabio [Thu, 4 Oct 2007 22:41:11 +0000 (00:41 +0200)]
git-archive: document --exec

Signed-off-by: Michele Ballabio <barra_cuda@katamail.com>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
17 years agogit-reflog: document --verbose
Michele Ballabio [Thu, 4 Oct 2007 12:26:54 +0000 (14:26 +0200)]
git-reflog: document --verbose

Signed-off-by: Michele Ballabio <barra_cuda@katamail.com>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
17 years agogit-config: handle --file option with relative pathname properly
Gerrit Pape [Fri, 12 Oct 2007 11:32:51 +0000 (11:32 +0000)]
git-config: handle --file option with relative pathname properly

When calling git-config not from the top level directory of a repository,
it changes directory before trying to open the config file specified
through the --file option, which then fails if the config file was
specified by a relative pathname.  This patch adjusts the pathname to
the config file if applicable.

The problem was noticed by Joey Hess, reported through
 http://bugs.debian.org/445208

Signed-off-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
17 years agoclear_commit_marks(): avoid deep recursion
Johannes Schindelin [Wed, 10 Oct 2007 22:14:35 +0000 (23:14 +0100)]
clear_commit_marks(): avoid deep recursion

Before this patch, clear_commit_marks() recursed for each parent.  This
could be potentially very expensive in terms of stack space.  Probably
the only reason that this did not lead to problems is the fact that we
typically call clear_commit_marks() after marking a relatively small set
of commits.

Use (sort of) a tail recursion instead: first recurse on the parents
other than the first one, and then continue the loop with the first
parent.

Noticed by Shawn Pearce.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
17 years agogit add -i: Remove unused variables
Jean-Luc Herren [Tue, 9 Oct 2007 19:34:17 +0000 (21:34 +0200)]
git add -i: Remove unused variables

Signed-off-by: Jean-Luc Herren <jlh@gmx.ch>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
17 years agogit add -i: Fix parsing of abbreviated hunk headers
Jean-Luc Herren [Tue, 9 Oct 2007 19:29:26 +0000 (21:29 +0200)]
git add -i: Fix parsing of abbreviated hunk headers

The unified diff format allows one-line ranges to be abbreviated
by omiting the size.  The hunk header "@@ -10,1 +10,1 @@" can be
expressed as "@@ -10 +10 @@", but this wasn't properly parsed in
all cases.

Such abbreviated hunk headers are generated when a one-line change
(add, remove or modify) appears without context; for example
because the file is a one-liner itself or because GIT_DIFF_OPTS
was set to '-u0'.  If the user then runs 'git add -i' and enters
the 'patch' command for that file, perl complains about undefined
variables.

Signed-off-by: Jean-Luc Herren <jlh@gmx.ch>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
17 years agogit-config: don't silently ignore options after --list
Frank Lichtenheld [Fri, 5 Oct 2007 20:16:44 +0000 (22:16 +0200)]
git-config: don't silently ignore options after --list

Error out if someone gives options after --list since that is
not a valid syntax.

Signed-off-by: Frank Lichtenheld <frank@lichtenheld.de>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
17 years agoClean up "git log" format with DIFF_FORMAT_NO_OUTPUT
Linus Torvalds [Tue, 9 Oct 2007 16:35:22 +0000 (09:35 -0700)]
Clean up "git log" format with DIFF_FORMAT_NO_OUTPUT

This fixes an unnecessary empty line that we add to the log message when
we generate diffs, but don't actually end up printing any due to having
DIFF_FORMAT_NO_OUTPUT set.

This can happen with pickaxe or with rename following. The reason is that
we normally add an empty line between the commit and the diff, but we do
that even for the case where we've then suppressed the actual printing of
the diff.

This also updates a couple of tests that assumed the extraneous empty
line would exist at the end of output.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
17 years agoFix embarrassing "git log --follow" bug
Linus Torvalds [Mon, 8 Oct 2007 20:42:41 +0000 (13:42 -0700)]
Fix embarrassing "git log --follow" bug

It turns out that I completely broke "git log --follow" with my recent
patch to revision.c ("Fix revision log diff setup, avoid unnecessary diff
generation", commit b7bb760d5ed4881422673d32f869d140221d3564).

Why? Because --follow obviously requires the diff machinery to function,
exactly the same way pickaxe does.

So everybody is away right now, but considering that nobody even noticed
this bug, I don't think it matters. But for the record, here's the trivial
one-liner fix (well, two, since I also fixed the comment).

Because of the nature of the bug, if you ask for patches when following
(which is one of the things I normally do), the bug is hidden, because
then the request for diff output will automatically also enable the diffs
themselves.

So while "git log --follow <filename>" didn't work, adding a "-p"
magically made it work again even without this fix.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
17 years agogit-gui: accept versions containing text annotations, like 1.5.3.mingw.1
Steffen Prohaska [Sat, 6 Oct 2007 13:27:22 +0000 (15:27 +0200)]
git-gui: accept versions containing text annotations, like 1.5.3.mingw.1

This commit teaches git-gui to accept versions with annotations
that start with text and optionally end with a dot followed by
a number.

This is needed by the current versioning scheme of msysgit,
which uses versions like 1.5.3.mingw.1. However, the changes
is not limited to this use case. Any version of the form
<numeric version>.<anytext>.<number> would be parsed and only
the starting <numeric version> used for validation.

[sp: Minor edit to remove unnecessary group matching]

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
17 years agoGIT 1.5.3.4 v1.5.3.4
Junio C Hamano [Wed, 3 Oct 2007 09:33:11 +0000 (02:33 -0700)]
GIT 1.5.3.4

Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agoAdd test case for ls-files --with-tree
Carl Worth [Wed, 3 Oct 2007 07:03:53 +0000 (00:03 -0700)]
Add test case for ls-files --with-tree

This tests basic functionality and also exercises a bug noticed
by Keith Packard, (prune_cache followed by add_index_entry can
trigger an attempt to realloc a pointer into the middle of an
allocated buffer).

Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agoMust not modify the_index.cache as it may be passed to realloc at some point.
Keith Packard [Wed, 3 Oct 2007 05:44:15 +0000 (22:44 -0700)]
Must not modify the_index.cache as it may be passed to realloc at some point.

The index cache is not static, growing as new entries are added. If
entries are added after prune_cache is called, cache will no longer
point at the base of the allocation, and realloc will not be happy.

I verified that this was the only place in the current source which
modified any index_state.cache elements aside from the alloc/realloc
calls in read-cache by changing the type of the element to 'struct
cache_entry ** const cache' and recompiling.

A more efficient patch would create a separate 'cache_base' value to
track the allocation and then fix things up when reallocation was
necessary, instead of the brute-force memmove used here.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agogit-gui: Don't crash when starting gitk from a browser session
Shawn O. Pearce [Tue, 2 Oct 2007 16:27:32 +0000 (12:27 -0400)]
git-gui: Don't crash when starting gitk from a browser session

If the user has started git-gui from the command line as a browser
we offer the gitk menu options but we didn't create the main status
bar widget in the "." toplevel.  Trying to access it while starting
gitk just results in Tcl errors.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
17 years agogit-gui: Allow gitk to be started on Cygwin with native Tcl/Tk
Shawn O. Pearce [Tue, 2 Oct 2007 16:24:44 +0000 (12:24 -0400)]
git-gui: Allow gitk to be started on Cygwin with native Tcl/Tk

gitk expects $env(GIT_DIR) to be valid as both a path that core Git
and Tcl/Tk can resolve to a valid directory, but it has no special
handling for Cygwin style UNIX paths and Windows style paths.  So
we need to do that for gitk and ensure that only relative paths are
fed to it, thus allowing both Cygwin style and UNIX style paths to
be resolved.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
17 years agothe ar tool is called gar on some systems
Robert Schiele [Wed, 3 Oct 2007 01:49:34 +0000 (03:49 +0200)]
the ar tool is called gar on some systems

Some systems that have only installed the GNU toolchain (prefixed with "g")
do not provide "ar" but only "gar".  Make configure find this tool as well.

Signed-off-by: Robert Schiele <rschiele@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agorename diff_free_filespec_data_large() to diff_free_filespec_blob()
Junio C Hamano [Wed, 3 Oct 2007 04:01:03 +0000 (21:01 -0700)]
rename diff_free_filespec_data_large() to diff_free_filespec_blob()

Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agodiffcore-rename: cache file deltas
Jeff King [Tue, 25 Sep 2007 19:29:42 +0000 (15:29 -0400)]
diffcore-rename: cache file deltas

We find rename candidates by computing a fingerprint hash of
each file, and then comparing those fingerprints. There are
inherently O(n^2) comparisons, so it pays in CPU time to
hoist the (rather expensive) computation of the fingerprint
out of that loop (or to cache it once we have computed it once).

Previously, we didn't keep the filespec information around
because then we had the potential to consume a great deal of
memory. However, instead of keeping all of the filespec
data, we can instead just keep the fingerprint.

This patch implements and uses diff_free_filespec_data_large
to accomplish that goal. We also have to change
estimate_similarity not to needlessly repopulate the
filespec data when we already have the hash.

Practical tests showed 4.5x speedup for a 10% memory usage
increase.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agoMention 'cpio' dependency in INSTALL
Johan Herland [Tue, 2 Oct 2007 23:42:29 +0000 (01:42 +0200)]
Mention 'cpio' dependency in INSTALL

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agoMake git-pull complain and give advice when there is nothing to merge with
Federico Mena Quintero [Tue, 2 Oct 2007 23:36:30 +0000 (18:36 -0500)]
Make git-pull complain and give advice when there is nothing to merge with

Signed-off-by: Federico Mena Quintero <federico@gnu.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agoNote that git-branch will not automatically checkout the new branch
Federico Mena Quintero [Tue, 2 Oct 2007 23:34:32 +0000 (18:34 -0500)]
Note that git-branch will not automatically checkout the new branch

Signed-off-by: Federico Mena Quintero <federico@gnu.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 years agoAdd documentation for --track and --no-track to the git-branch docs.
Federico Mena Quintero [Tue, 2 Oct 2007 23:33:30 +0000 (18:33 -0500)]
Add documentation for --track and --no-track to the git-branch docs.

Signed-off-by: Federico Mena Quintero <federico@gnu.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>