Code

git.git
16 years ago"blame -c" should be compatible with "annotate"
Junio C Hamano [Fri, 5 Sep 2008 07:57:35 +0000 (00:57 -0700)]
"blame -c" should be compatible with "annotate"

There is no reason to have a separate variable cmd_is_annotate;
OUTPUT_ANNOTATE_COMPAT option is supposed to produce the compatibility
output, and we should produce the same output even when the command was
not invoked as "annotate" but as "blame -c".

Noticed by Pasky.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agodiff --cumulative is a sub-option of --dirstat
Junio C Hamano [Wed, 3 Sep 2008 00:28:59 +0000 (17:28 -0700)]
diff --cumulative is a sub-option of --dirstat

The option used to be implemented as if it is a totally independent one,
but "git diff --cumulative" would not mean anything without "--dirstat".

This makes --cumulative imply --dirstat.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agobash completion: Hide more plumbing commands
Petr Baudis [Tue, 26 Aug 2008 17:11:44 +0000 (19:11 +0200)]
bash completion: Hide more plumbing commands

git <tab><tab> still shows way too many commands, some of them
are clearly plumbing. This patch hides the plumbing commands
liberally (that is, in special cases, users still might want to
call one of the hidden commands, a *normal* workflow should never
involve these, though - and if it does, we have a UI problem anyway).

Signed-off-by: Petr Baudis <pasky@suse.cz>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoStart 1.6.0.2 maintenance cycle
Junio C Hamano [Wed, 3 Sep 2008 22:39:19 +0000 (15:39 -0700)]
Start 1.6.0.2 maintenance cycle

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge branch 'nd/worktree' into maint
Junio C Hamano [Wed, 3 Sep 2008 22:35:37 +0000 (15:35 -0700)]
Merge branch 'nd/worktree' into maint

* nd/worktree:
  setup_git_directory(): fix move to worktree toplevel directory
  update-index: fix worktree setup
  read-tree: setup worktree if merge is required
  grep: fix worktree setup
  diff*: fix worktree setup

16 years agoMerge branch 'ho/dashless' into maint
Junio C Hamano [Wed, 3 Sep 2008 21:51:56 +0000 (14:51 -0700)]
Merge branch 'ho/dashless' into maint

* ho/dashless:
  tests: use "git xyzzy" form (t7200 - t9001)
  tests: use "git xyzzy" form (t7000 - t7199)
  tests: use "git xyzzy" form (t3600 - t6999)
  tests: use "git xyzzy" form (t0000 - t3599)
  'git foo' program identifies itself without dash in die() messages
  Start conforming code to "git subcmd" style

16 years agotests: use "git xyzzy" form (t7200 - t9001)
Nanako Shiraishi [Wed, 3 Sep 2008 08:59:33 +0000 (17:59 +0900)]
tests: use "git xyzzy" form (t7200 - t9001)

Converts tests between t7201-t9001.

Signed-off-by: Nanako Shiraishi <nanako3@lavabit.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agotests: use "git xyzzy" form (t7000 - t7199)
Nanako Shiraishi [Wed, 3 Sep 2008 08:59:31 +0000 (17:59 +0900)]
tests: use "git xyzzy" form (t7000 - t7199)

Converts tests between t7001-t7103.

Signed-off-by: Nanako Shiraishi <nanako3@lavabit.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoFix passwd(5) ref and reflect that commit doens't use commit-tree
Jonas Fonseca [Wed, 3 Sep 2008 08:50:43 +0000 (10:50 +0200)]
Fix passwd(5) ref and reflect that commit doens't use commit-tree

Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoimprove handling of sideband message display
Nicolas Pitre [Wed, 3 Sep 2008 19:13:42 +0000 (15:13 -0400)]
improve handling of sideband message display

Currently the code looks for line break characters in order to prepend
"remote: " to every line received as many lines can be sent in a single
chunk.  However the opposite might happen too, i.e. a single message
line split amongst multiple chunks.  This patch adds support for the
later case to avoid displays like:

remote: Compressing objeremote: cts: 100% (313/313), done.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agotests: use "git xyzzy" form (t3600 - t6999)
Nanako Shiraishi [Wed, 3 Sep 2008 08:59:29 +0000 (17:59 +0900)]
tests: use "git xyzzy" form (t3600 - t6999)

Converts tests between t3600-t6300.

Signed-off-by: Nanako Shiraishi <nanako3@lavabit.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agotests: use "git xyzzy" form (t0000 - t3599)
Nanako Shiraishi [Wed, 3 Sep 2008 08:59:27 +0000 (17:59 +0900)]
tests: use "git xyzzy" form (t0000 - t3599)

Converts tests between t0050-t3903.

Signed-off-by: Nanako Shiraishi <nanako3@lavabit.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agocheckout: fix message when leaving detached HEAD
Jeff King [Wed, 3 Sep 2008 18:07:26 +0000 (14:07 -0400)]
checkout: fix message when leaving detached HEAD

The shell version of git checkout would print:

  Previous HEAD position was 1234abcd... commit subject line

when leaving a detached HEAD for another commit. Ths C
version attempted to implement this, but got the condition
wrong such that the behavior never triggered.

This patch simplifies the conditions for showing the message
to the ones used by the shell version: any time we are
leaving a detached HEAD and the new and old commits are not
the same (this suppresses it for the "git checkout -b new"
case recommended when you enter the detached state).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoclone: fix creation of explicitly named target directory
Clemens Buchacher [Wed, 3 Sep 2008 18:55:55 +0000 (20:55 +0200)]
clone: fix creation of explicitly named target directory

'git clone <repo> path/' (note the trailing slash) fails, because the
entire path is interpreted as leading directories. So when mkdir tries to
create the actual path, it already exists.

This makes sure trailing slashes are removed.

Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMakefile: add merge_recursive.h to LIB_H
Miklos Vajna [Tue, 2 Sep 2008 23:49:05 +0000 (01:49 +0200)]
Makefile: add merge_recursive.h to LIB_H

When modifying merge-recursive.h, for example builtin-merge-recursive.c
have to be recompiled which was not true till now, causing various
runtime errors using an incremental build.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoImprove documentation for --dirstat diff option
Heikki Orsila [Mon, 1 Sep 2008 00:50:28 +0000 (03:50 +0300)]
Improve documentation for --dirstat diff option

Signed-off-by: Heikki Orsila <heikki.orsila@iki.fi>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoBring local clone's origin URL in line with that of a remote clone
Johan Herland [Mon, 1 Sep 2008 19:07:33 +0000 (21:07 +0200)]
Bring local clone's origin URL in line with that of a remote clone

On a local clone, "git clone" would use the fully DWIMmed path as the origin
URL in the resulting repo. This was slightly inconsistent with the case of a
remote clone where the _given_ URL was used as the origin URL (because the
DWIMming was done remotely, and was therefore not available to "git clone").

This behaviour caused problems when cloning a local non-bare repo with
relative submodule URLs, because these submodule URLs would then be resolved
against the DWIMmed URL (e.g. "/repo/.git") instead of the given URL (e.g.
"/repo").

This patch teaches "git clone" to use the _given_ URL - instead of the
DWIMmed path - as the origin URL. This causes relative submodule URLs to be
resolved correctly, as long the _given_ URL indicates the correct directory
against which the submodule URLs should be resolved.

The patch also updates a testcase that contained the old-style origin URLs.

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoDocumentation: minor cleanup in a use case in 'git stash' manual
SZEDER Gábor [Tue, 2 Sep 2008 01:45:01 +0000 (03:45 +0200)]
Documentation: minor cleanup in a use case in 'git stash' manual

There is no need to explicitly pass the file to be committed to 'git
commit', because it's contents is already in the index.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoDocumentation: fix disappeared lines in 'git stash' manpage
SZEDER Gábor [Tue, 2 Sep 2008 01:35:24 +0000 (03:35 +0200)]
Documentation: fix disappeared lines in 'git stash' manpage

Asciidoc removes lines starting with a dot when creating manpages.
Since those lines were comments in use case examples showing shell
commands, preceed those lines with a hash sign.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoDocumentation: fix reference to a for-each-ref option
SZEDER Gábor [Mon, 1 Sep 2008 21:02:09 +0000 (23:02 +0200)]
Documentation: fix reference to a for-each-ref option

... to match the synopsis section

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoDocument sendemail.envelopesender configuration
Ask Bjørn Hansen [Sun, 31 Aug 2008 20:32:43 +0000 (13:32 -0700)]
Document sendemail.envelopesender configuration

Signed-off-by: Ask Bjørn Hansen <ask@develooper.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoDocument clarification: gitmodules, gitattributes
Gustaf Hendeby [Sun, 31 Aug 2008 16:00:27 +0000 (18:00 +0200)]
Document clarification: gitmodules, gitattributes

The SYNOPSIS section of gitattibutes and gitmodule fail to clearly
specify the name of the in tree files used.  This patch brings in the
initial `.' and the fact that the `.gitmodules' file should reside at
the top-level of the working tree.

Signed-off-by: Gustaf Hendeby <hendeby@isy.liu.se>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years ago'git foo' program identifies itself without dash in die() messages
Junio C Hamano [Sun, 31 Aug 2008 16:39:19 +0000 (09:39 -0700)]
'git foo' program identifies itself without dash in die() messages

This is a mechanical conversion of all '*.c' files with:

s/((?:die|error|warning)\("git)-(\S+:)/$1 $2/;

The result was manually inspected and no false positive was found.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agosetup_git_directory(): fix move to worktree toplevel directory
Nguyễn Thái Ngọc Duy [Sat, 30 Aug 2008 09:15:32 +0000 (16:15 +0700)]
setup_git_directory(): fix move to worktree toplevel directory

When setup_git_directory() returns successfully, it is supposed to move
current working directory to worktree toplevel directory.

However, the code recomputing prefix inside setup_git_directory() has
to move cwd back to original working directory, in order to get new
prefix.  After that, it should move cwd back to worktree toplevel
directory as expected.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoupdate-index: fix worktree setup
Nguyễn Thái Ngọc Duy [Sat, 30 Aug 2008 09:13:58 +0000 (16:13 +0700)]
update-index: fix worktree setup

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoconfig.txt: Add missing colons after option name
Teemu Likonen [Fri, 29 Aug 2008 07:29:42 +0000 (10:29 +0300)]
config.txt: Add missing colons after option name

gitcvs.usecrlfattr --> gitcvs.usecrlfattr::

This fixes an asciidoc markup issue.

Signed-off-by: Teemu Likonen <tlikonen@iki.fi>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogitattributes: -crlf is not binary
Junio C Hamano [Sat, 30 Aug 2008 21:35:15 +0000 (14:35 -0700)]
gitattributes: -crlf is not binary

The description of crlf attribute incorrectly said that "-crlf" means
binary.  It is true that for binary files you would want "-crlf", but
that is not the same thing.

We also have supported attribute macros and via that mechanism a handy
"binary" to specify "-crlf -diff" at the same time.  It was not documented
anywhere as far as I can tell, even though the support was there from
the very beginning.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoStart conforming code to "git subcmd" style
Heikki Orsila [Sat, 30 Aug 2008 11:12:53 +0000 (14:12 +0300)]
Start conforming code to "git subcmd" style

User notifications are presented as 'git cmd', and code comments
are presented as '"cmd"' or 'git's cmd', rather than 'git-cmd'.

Signed-off-by: Heikki Orsila <heikki.orsila@iki.fi>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-apply: Loosen "match_beginning" logic
Junio C Hamano [Sat, 30 Aug 2008 20:20:31 +0000 (13:20 -0700)]
git-apply: Loosen "match_beginning" logic

Even after a handfle attempts, match_beginning logic still has corner
cases:

    1bf1a85 (apply: treat EOF as proper context., 2006-05-23)
    65aadb9 (apply: force matching at the beginning., 2006-05-24)
    4be6096 (apply --unidiff-zero: loosen sanity checks ..., 2006-09-17)
    ee5a317 (Fix "git apply" to correctly enforce "match ..., 2008-04-06)

This is a tricky piece of code.

We still incorrectly enforce "match_beginning" for -U0 matches.
I noticed this while trying out an example sequence from Clemens Buchacher:

    $ echo a >victim
    $ git add victim
    $ echo b >>victim
    $ git diff -U0 >patch
    $ cat patch
    diff --git i/victim w/victim
    index 7898192..422c2b7 100644
    --- i/victim
    +++ w/victim
    @@ -1,0 +2 @@ a
    +b
    $ git apply --cached --unidiff-zero <patch
    $ git show :victim
    b
    a

The change inserts a new line before the second line, but we insist it to
be applied at the beginning.  As the result, the code refuses to apply it
at the original offset, and we end up adding the line at the beginning.

Updates to the test script are by Clemens Buchacher.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoFix example in git-name-rev documentation
Junio C Hamano [Sat, 30 Aug 2008 20:08:50 +0000 (13:08 -0700)]
Fix example in git-name-rev documentation

Since 59d3f54 (name-rev: avoid "^0" when unneeded, 2007-02-20), name-rev
stopped showing an unnecessary "^0" to dereference a tag down to a commit.
The patch should have made a matching update to the documentation, but we
forgot.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge branch 'sp/missing-thin-base' into maint
Junio C Hamano [Sat, 30 Aug 2008 15:38:19 +0000 (08:38 -0700)]
Merge branch 'sp/missing-thin-base' into maint

* sp/missing-thin-base:
  pack-objects: Allow missing base objects when creating thin packs

16 years agoMerge branch 'af/maint-install-no-handlink' into maint
Junio C Hamano [Sat, 30 Aug 2008 05:39:25 +0000 (22:39 -0700)]
Merge branch 'af/maint-install-no-handlink' into maint

* af/maint-install-no-handlink:
  Fix use of hardlinks in "make install"
  Makefile: always provide a fallback when hardlinks fail

16 years agoshell: do not play duplicated definition games to shrink the executable
Junio C Hamano [Wed, 20 Aug 2008 01:05:39 +0000 (18:05 -0700)]
shell: do not play duplicated definition games to shrink the executable

Playing with linker games to shrink git-shell did not go well with various
other platforms and compilers.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoFix use of hardlinks in "make install"
Alex Riesen [Thu, 28 Aug 2008 13:57:32 +0000 (15:57 +0200)]
Fix use of hardlinks in "make install"

The code failed to filter-out git-add properly on platforms were $X is
not empty (ATM there is only one such a platform).

Than it tried to create a hardlink to the file ($execdir/git-add) it just
removed (because git-add is first in the BUILT_INS), so ln failed (but
because stderr was redirected into /dev/null the error was never seen), and
the whole install ended up using "ln -s" instead.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge branch 'np/verify-pack' into maint
Junio C Hamano [Sat, 30 Aug 2008 04:48:02 +0000 (21:48 -0700)]
Merge branch 'np/verify-pack' into maint

* np/verify-pack:
  discard revindex data when pack list changes

16 years agotutorial: gentler illustration of Alice/Bob workflow using gitk
Paolo Ciarrocchi [Thu, 28 Aug 2008 12:23:52 +0000 (14:23 +0200)]
tutorial: gentler illustration of Alice/Bob workflow using gitk

Update to gitutorial as discussedin the git mailing list:

http://marc.info/?t=121969390900002&r=1&w=2

Signed-off-by: Paolo Ciarrocchi <paolo.ciarrocchi@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agopretty=format: respect date format options
Jeff King [Fri, 29 Aug 2008 00:54:59 +0000 (20:54 -0400)]
pretty=format: respect date format options

When running a command like:

  git log --pretty=format:%ad --date=short

the date option was ignored. This patch causes it to use whatever
format was specified by --date (or by --relative-date, etc), just
as the non-user formats would do.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agomake git-shell paranoid about closed stdin/stdout/stderr
Paolo Bonzini [Wed, 27 Aug 2008 15:20:35 +0000 (17:20 +0200)]
make git-shell paranoid about closed stdin/stdout/stderr

It is in general unsafe to start a program with one or more of file
descriptors 0/1/2 closed.  Karl Chen for example noticed that stat_command
does this in order to rename a pipe file descriptor to 0:

    dup2(from, 0);
    close(from);

... but if stdin was closed (for example) from == 0, so that

    dup2(0, 0);
    close(0);

just ends up closing the pipe.  Another extremely rare but nasty problem
would occur if an "important" file ends up in file descriptor 2, and is
corrupted by a call to die().

Fixing this in git was considered to be overkill, so this patch works
around it only for git-shell.  The fix is simply to open all the "low"
descriptors to /dev/null in main.

Signed-off-by: Paolo Bonzini <bonzini@gnu.org>
Acked-by: Stephen R. van den Berg <srb@cuci.nl>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoDocument gitk --argscmd flag.
Yann Dirson [Thu, 28 Aug 2008 22:00:28 +0000 (00:00 +0200)]
Document gitk --argscmd flag.

This was part of my original patch, but appears to have been lost.

Signed-off-by: Yann Dirson <ydirson@altern.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoFix '--dirstat' with cross-directory renaming
Linus Torvalds [Thu, 28 Aug 2008 23:19:08 +0000 (16:19 -0700)]
Fix '--dirstat' with cross-directory renaming

The dirstat code depends on the fact that we always generate diffs with
the names sorted, since it then just does a single-pass walk-over of the
sorted list of names and how many changes there were. The sorting means
that all files are nicely grouped by directory.

That all works fine.

Except when we have rename detection, and suddenly the nicely sorted list
of pathnames isn't all that sorted at all. And now the single-pass dirstat
walk gets all confused, and you can get results like this:

  [torvalds@nehalem linux]$ git diff --dirstat=2 -M v2.6.27-rc4..v2.6.27-rc5
     3.0% arch/powerpc/configs/
     6.8% arch/arm/configs/
     2.7% arch/powerpc/configs/
     4.2% arch/arm/configs/
     5.6% arch/powerpc/configs/
     8.4% arch/arm/configs/
     5.5% arch/powerpc/configs/
    23.3% arch/arm/configs/
     8.6% arch/powerpc/configs/
     4.0% arch/
     4.4% drivers/usb/musb/
     4.0% drivers/watchdog/
     7.6% drivers/
     3.5% fs/

The trivial fix is to add a sorting pass, fixing it to:

  [torvalds@nehalem linux]$ git diff --dirstat=2 -M v2.6.27-rc4..v2.6.27-rc5
    43.0% arch/arm/configs/
    25.5% arch/powerpc/configs/
     5.3% arch/
     4.4% drivers/usb/musb/
     4.0% drivers/watchdog/
     7.6% drivers/
     3.5% fs/

Spot the difference. In case anybody wonders: it's because of a ton of
renames from {include/asm-blackfin => arch/blackfin/include/asm} that just
totally messed up the file ordering in between arch/arm and arch/powerpc.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agofor-each-ref: Allow a trailing slash in the patterns
Björn Steinbrink [Thu, 28 Aug 2008 02:14:02 +0000 (04:14 +0200)]
for-each-ref: Allow a trailing slash in the patterns

More often than not, I end up using something like refs/remotes/ as the
pattern for for-each-ref, but that doesn't work, because it expects to see
the slash in the ref name right after the matched pattern. So teach it to
accept the slash as the final character in the pattern as well.

Signed-off-by: Björn Steinbrink <B.Steinbrink@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoread-tree: setup worktree if merge is required
Nguyễn Thái Ngọc Duy [Thu, 28 Aug 2008 13:03:22 +0000 (20:03 +0700)]
read-tree: setup worktree if merge is required

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogrep: fix worktree setup
Nguyễn Thái Ngọc Duy [Thu, 28 Aug 2008 13:04:30 +0000 (20:04 +0700)]
grep: fix worktree setup

Unless used with --cached or grepping on a tree, "git grep" will
search on working directory, so set up worktree properly

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agodiff*: fix worktree setup
Nguyễn Thái Ngọc Duy [Thu, 28 Aug 2008 13:02:12 +0000 (20:02 +0700)]
diff*: fix worktree setup

This fixes "git diff", "git diff-files" and "git diff-index" to work
correctly under worktree setup. Because diff* family works in many modes
and not all of them require worktree, Junio made a nice summary
(with a little modification from me):

 * diff-files is about comparing with work tree, so it obviously needs a
  work tree;

 * diff-index also does, except "diff-index --cached" or "diff --cached TREE"

 * no-index is about random files outside git context, so it obviously
   doesn't need any work tree;

 * comparing two (or more) trees doesn't;

 * comparing two blobs doesn't;

 * comparing a blob with a random file doesn't;

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoctype.c: protect tiny C preprocessor constants
Junio C Hamano [Wed, 27 Aug 2008 23:14:22 +0000 (16:14 -0700)]
ctype.c: protect tiny C preprocessor constants

Some platforms contaminate the preprocessor token namespace with their own
definition of SS without being asked.  Avoid getting hit by redefinition
warning messages by explicitly undef SS, AA and DD shorthand we use in this
table definition.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoindex-pack: be careful after fixing up the header/footer
Linus Torvalds [Wed, 27 Aug 2008 19:48:00 +0000 (12:48 -0700)]
index-pack: be careful after fixing up the header/footer

The index-pack command, when processing a thin pack, fixed up the pack
after-the-fact.  It forgets to fsync the result, because it only did that
in one path rather in all cases of fixup.

This moves the fsync_or_die() to the fix-up routine itself, rather than
doing it in one of the callers, so that all cases are covered.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoindex-pack: setup git repository
Nguyễn Thái Ngọc Duy [Tue, 26 Aug 2008 14:32:42 +0000 (21:32 +0700)]
index-pack: setup git repository

"git index-pack" is an independent command and does not setup git
repository while still need pack.indexversion. It may miss the
info if it is in a subdirectory of the repository.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoSuppress some bash redirection error messages
Ramsay Jones [Tue, 26 Aug 2008 17:52:57 +0000 (18:52 +0100)]
Suppress some bash redirection error messages

In particular, when testing if the filesystem allows tabs in
filenames, bash issues an error something like:

./t4016-diff-quote.sh: pathname with HT: No such file or directory

which is caused by the failure of the (stdout) redirection,
since the file cannot be created. In order to suppress the
error message, you must redirect stderr to /dev/null, *before*
the stdout redirection on the command-line.

Also, remove a redundant filesystem check from the begining of
the t3902-quoted.sh test and standardise the "test skipped"
message to 'say' on exit.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoFix a warning (on cygwin) to allow -Werror
Ramsay Jones [Tue, 26 Aug 2008 17:50:37 +0000 (18:50 +0100)]
Fix a warning (on cygwin) to allow -Werror

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMakefile: always provide a fallback when hardlinks fail
Andreas Färber [Mon, 25 Aug 2008 15:33:03 +0000 (17:33 +0200)]
Makefile: always provide a fallback when hardlinks fail

We make hardlinks from "git" to "git-<cmd>" built-ins and have been
careful to avoid cross-device links when linking "git-<cmd>" to
gitexecdir.

However, we were not prepared to deal with a build directory that is
incapable of making hard links within itself. This patch corrects it.

Instead of temporarily linking "git" to gitexecdir, directly link "git-
add", falling back to "cp". Try hardlinking that as "git-<cmd>", falling
back to symlinks or "cp" on error.

While at it, avoid 100+ error messages from hardlink failures when we are
going to fall back to symlinks or "cp" by redirecting the standard error
to /dev/null.

Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoFix "git log -i --grep"
Jeff King [Mon, 25 Aug 2008 06:15:05 +0000 (02:15 -0400)]
Fix "git log -i --grep"

This has been broken in v1.6.0 due to the reorganization of
the revision option parsing code. The "-i" is completely
ignored, but works fine in "git log --grep -i".

What happens is that the code for "-i" looks for
revs->grep_filter; if it is NULL, we do nothing, since there
are no grep filters. But that is obviously not correct,
since we want it to influence the later --grep option. Doing
it the other way around works, since "-i" just impacts the
existing grep_filter option.

Instead, we now always initialize the grep_filter member and
just fill in options and patterns as we get them. This means
that we can no longer check grep_filter for NULL, but
instead must check the pattern list to see if we have any
actual patterns.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoGIT 1.6.0.1 v1.6.0.1
Junio C Hamano [Sun, 24 Aug 2008 21:47:24 +0000 (14:47 -0700)]
GIT 1.6.0.1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge branch 'ag/maint-combine-diff-fix' into maint
Junio C Hamano [Sun, 24 Aug 2008 21:32:18 +0000 (14:32 -0700)]
Merge branch 'ag/maint-combine-diff-fix' into maint

* ag/maint-combine-diff-fix:
  Respect core.autocrlf in combined diff

16 years agoMerge branch 'mv/maint-merge-fix' into maint
Junio C Hamano [Sun, 24 Aug 2008 21:29:37 +0000 (14:29 -0700)]
Merge branch 'mv/maint-merge-fix' into maint

* mv/maint-merge-fix:
  merge: fix numerus bugs around "trivial merge" area

16 years agoDocumentation: clarify pager configuration
Jonathan Nieder [Sun, 24 Aug 2008 05:28:32 +0000 (00:28 -0500)]
Documentation: clarify pager configuration

The unwary user may not know how to disable the -FRSX options.

Signed-off-by: Jonathan Nieder <jrnieder@uchicago.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoDocumentation: clarify pager.<cmd> configuration
Jonathan Nieder [Sun, 24 Aug 2008 05:38:06 +0000 (00:38 -0500)]
Documentation: clarify pager.<cmd> configuration

It was not obvious from the text that pager.<cmd> is a boolean
setting.

While we're changing the description, make some other
improvements: lest we forget and fret, clarify that -p and
pager.<cmd> do not kick in when stdout is not a tty; point to
related core.pager and GIT_PAGER settings; use renamed --paginate
option.

Signed-off-by: Jonathan Nieder <jrnieder@uchicago.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoClean up the git-p4 documentation
Simon Hausmann [Sun, 24 Aug 2008 14:12:23 +0000 (16:12 +0200)]
Clean up the git-p4 documentation

This patch massages the documentation a bit for improved readability and cleans
it up from outdated options/commands.

Signed-off-by: Simon Hausmann <simon@lst.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoRespect core.autocrlf in combined diff
Alexander Gavrilov [Sat, 23 Aug 2008 19:21:21 +0000 (23:21 +0400)]
Respect core.autocrlf in combined diff

Fix git-diff to make it produce useful 3-way diffs for merge conflicts in
repositories with autocrlf enabled. Otherwise it always reports that the
whole file was changed, because it uses the contents from the working tree
without necessary conversion.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMakefile: enable SNPRINTF_RETURNS_BOGUS for HP-UX
Miklos Vajna [Sat, 23 Aug 2008 22:07:55 +0000 (00:07 +0200)]
Makefile: enable SNPRINTF_RETURNS_BOGUS for HP-UX

In 81cc66a, customization has been added to Makefile for supporting
HP-UX, but git commit is still problematic. This should fix the issue.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Acked-by: Robert Schiele <rschiele@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agomerge: fix numerus bugs around "trivial merge" area
Junio C Hamano [Sat, 23 Aug 2008 19:56:57 +0000 (12:56 -0700)]
merge: fix numerus bugs around "trivial merge" area

The "trivial merge" codepath wants to optimize itself by making an
internal call to the read-tree machinery, but it does not read the index
before doing so, and the codepath is never exercised.  Incidentally, this
failure to read the index upfront means that the safety to refuse doing
anything when the index is unmerged does not kick in, either.

These two problem are fixed by using read_cache_unmerged() that does read
the index before checking if it is unmerged at the beginning of
cmd_merge().

The primary logic of the merge, however, assumes that the process never
reads the index in-core, and the call to write_cache_as_tree() it makes
from write_tree_trivial() will always read from the on-disk index that is
prepared the strategy back-ends.  This assumption is now broken by the
above fix.  To fix this issue, we now call discard_cache() before calling
write_tree_trivial() when it wants to write the on-disk index as a tree.

When multiple strategies are tried, their results are evaluated by reading
the resulting index and inspecting it.  The codepath needs to make a call
to read_cache() for each successful strategy, and for that to work, they
need to discard_cache() the one read by the previous round.

Also the "trivial merge" forgot that the current commit is one of the
parents of the resulting commit.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agounpack_trees(): protect the handcrafted in-core index from read_cache()
Junio C Hamano [Sat, 23 Aug 2008 19:57:30 +0000 (12:57 -0700)]
unpack_trees(): protect the handcrafted in-core index from read_cache()

unpack_trees() rebuilds the in-core index from scratch by allocating a new
structure and finishing it off by copying the built one to the final
index.

The resulting in-core index is Ok for most use, but read_cache() does not
recognize it as such.  The function is meant to be no-op if you already
have loaded the index, until you call discard_cache().

This change the way read_cache() detects an already initialized in-core
index, by introducing an extra bit, and marks the handcrafted in-core
index as initialized, to avoid this problem.

A better fix in the longer term would be to change the read_cache() API so
that it will always discard and re-read from the on-disk index to avoid
confusion.  But there are higher level API that have relied on the current
semantics, and they and their users all need to get converted, which is
outside the scope of 'maint' track.

An example of such a higher level API is write_cache_as_tree(), which is
used by git-write-tree as well as later Porcelains like git-merge, revert
and cherry-pick.  In the longer term, we should remove read_cache() from
there and add one to cmd_write_tree(); other callers expect that the
in-core index they prepared is what gets written as a tree so no other
change is necessary for this particular codepath.

The original version of this patch marked the index by pointing an
otherwise wasted malloc'ed memory with o->result.alloc, but this version
uses Linus's idea to use a new "initialized" bit, which is conceptually
much cleaner.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-p4: Fix one-liner in p4_write_pipe function.
Tor Arvid Lund [Thu, 21 Aug 2008 21:11:40 +0000 (23:11 +0200)]
git-p4: Fix one-liner in p4_write_pipe function.

The function built a p4 command string via the p4_build_cmd function, but
ignored the result.

Signed-off-by: Tor Arvid Lund <torarvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agodiscard revindex data when pack list changes
Nicolas Pitre [Fri, 22 Aug 2008 19:45:53 +0000 (15:45 -0400)]
discard revindex data when pack list changes

This is needed to fix verify-pack -v with multiple pack arguments.

Also, in theory, revindex data (if any) must be discarded whenever
reprepare_packed_git() is called. In practice this is hard to trigger
though.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoCompletion: add missing '=' for 'diff --diff-filter'
Eric Raible [Fri, 22 Aug 2008 17:25:06 +0000 (10:25 -0700)]
Completion: add missing '=' for 'diff --diff-filter'

Signed-off-by: Eric Raible <raible@gmail.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoFix 'git help help'
Miklos Vajna [Thu, 21 Aug 2008 14:21:48 +0000 (16:21 +0200)]
Fix 'git help help'

git help foo invokes man git-foo if foo is a git command, otherwise it
invokes man gitfoo. 'help' is not a git command, but the manual page is
called git-help, so add this special exception.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Acked-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agocompat/snprintf.c: handle snprintf's that always return the # chars transmitted
Brandon Casey [Thu, 21 Aug 2008 01:53:50 +0000 (20:53 -0500)]
compat/snprintf.c: handle snprintf's that always return the # chars transmitted

Some platforms provide a horribly broken snprintf. More broken than the
platforms that return -1 when there is too little space in the target buffer
for the formatted string. Some platforms provide an snprintf which _always_
returns the number of characters transmitted to the buffer, regardless of
whether there was enough space or not.

IRIX 6.5 is such a platform. IRIX does have a working snprintf(), but it
is only provided when _NO_XOPEN5 evaluates to zero, and this only happens
if _XOPEN_SOURCE is defined, but definition of _XOPEN_SOURCE prevents
inclusion of many other common functions and defines. So it must be avoided.

Work around these horribly broken snprintf implementations by detecting an
snprintf call which results in the number of transmitted characters exactly
equal to the length of our buffer and retrying with a larger buffer just to
be safe.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Acked-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-svn: fix dcommit to urls with embedded usernames
Eric Wong [Wed, 20 Aug 2008 07:30:06 +0000 (00:30 -0700)]
git-svn: fix dcommit to urls with embedded usernames

Don't rely on the extracted URL from working_head_info since that has the
username removed.  Instead use the $gs->full_url method (as before with
ba24e74 (git-svn: add ability to specify --commit-url for dcommit,
2008-08-07)) to give us the URL to commit to if --commit-url is not
specified.

Aditionally, since we clean usernames from URLs, checking the URL after
rebase can fail because it doesn't match the URL we used to commit; so
unconditionally provide a username-free URL for checking the result of the
refetch.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agorevision.h: make show_early_output an extern which is defined in revision.c
Brandon Casey [Thu, 21 Aug 2008 00:34:30 +0000 (19:34 -0500)]
revision.h: make show_early_output an extern which is defined in revision.c

The variable show_early_output is defined in revision.c and should be
declared extern in revision.h so that the linker does not complain
about multiply defined variables.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoUpdate draft release notes for 1.6.0.1
Junio C Hamano [Wed, 20 Aug 2008 22:19:00 +0000 (15:19 -0700)]
Update draft release notes for 1.6.0.1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoAdd hints to revert documentation about other ways to undo changes
Tarmigan Casebolt [Tue, 19 Aug 2008 19:50:31 +0000 (12:50 -0700)]
Add hints to revert documentation about other ways to undo changes

Based on its name, people may read the 'git revert' documentation when
they want to undo local changes, especially people who have used other
SCM's.  'git revert' may not be what they had in mind, but git
provides several other ways to undo changes to files.  We can help
them by pointing them towards the git commands that do what they might
want to do.

Cc: Daniel Barkalow <barkalow@iabervon.org>
Cc: Lea Wiemann <lewiemann@gmail.com>
Signed-off-by: Tarmigan Casebolt <tarmigan+git@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoInstall templates with the user and group of the installing personality
Johannes Sixt [Wed, 20 Aug 2008 15:36:25 +0000 (17:36 +0200)]
Install templates with the user and group of the installing personality

If 'make install' was run with sufficient privileges, then the installed
templates, which are copied using 'tar', would receive the user and group
of whoever built git. This instructs 'tar' to ignore the user and group
that are recorded in the archive.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years ago"git-merge": allow fast-forwarding in a stat-dirty tree
Junio C Hamano [Wed, 20 Aug 2008 22:09:28 +0000 (15:09 -0700)]
"git-merge": allow fast-forwarding in a stat-dirty tree

We used to refresh the index to clear stat-dirtyness before a fast-forward
merge.  Recent C rewrite forgot to do this.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agocompletion: find out supported merge strategies correctly
Junio C Hamano [Wed, 20 Aug 2008 21:13:42 +0000 (14:13 -0700)]
completion: find out supported merge strategies correctly

"git-merge" is a binary executable these days, and looking for assignment
to $all_strategies variable with grep/sed does not work well.

When asked for an unknown strategy, pre-1.6.0 and post-1.6.0 "git merge"
commands respectively say:

    $ $HOME/git-snap-v1.5.6.5/bin/git merge -s help
    available strategies are: recur recursive octopus resolve stupid ours subtree
    $ $HOME/git-snap-v1.6.0/bin/git merge -s help
    Could not find merge strategy 'help'.
    Available strategies are: recursive octopus resolve ours subtree.

both on their standard error stream.  We can use this to learn what
strategies are supported.

The sed script is written in such a way that it catches both old and new
message styles ("Available" vs "available", and the full stop at the end).
It also allows future versions of "git merge" to line-wrap the list of
strategies, and add extra comments, like this:

    $ $HOME/git-snap-v1.6.1/bin/git merge -s help
    Could not find merge strategy 'help'.
    Available strategies are: blame recursive octopus resolve ours
    subtree.
    Also you have custom strategies: theirs

    Make sure you spell strategy names correctly.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agodecorate: allow const objects to be decorated
Jeff King [Wed, 20 Aug 2008 17:55:33 +0000 (13:55 -0400)]
decorate: allow const objects to be decorated

We don't actually modify the struct object, so there is no
reason not to accept const versions (and this allows other
callsites, like the next patch, to use the decoration
machinery).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agofor-each-ref: cope with tags with incomplete lines
Junio C Hamano [Wed, 20 Aug 2008 19:29:27 +0000 (12:29 -0700)]
for-each-ref: cope with tags with incomplete lines

If you have a tag with a single, incomplete line as its payload, asking
git-for-each-ref for its %(body) element accessed a NULL pointer.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agodiff --check: do not get confused by new blank lines in the middle
Junio C Hamano [Wed, 20 Aug 2008 18:47:55 +0000 (11:47 -0700)]
diff --check: do not get confused by new blank lines in the middle

The code remembered that the last diff output it saw was an empty line,
and tried to reset that state whenever it sees a context line, a non-blank
new line, or a new hunk.  However, this codepath asks the underlying diff
engine to feed diff without any context, and the "just saw an empty line"
state was not reset if you added a new blank line in the last hunk of your
patch, even if it is not the last line of the file.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoremote.c: remove useless if-before-free test
Jim Meyering [Tue, 19 Aug 2008 18:46:30 +0000 (20:46 +0200)]
remote.c: remove useless if-before-free test

We removed a handful of these useless if-before-free tests several months
ago.  This change removes a new one that snuck back in.

Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agomailinfo: avoid violating strbuf assertion
Jeff King [Tue, 19 Aug 2008 17:28:24 +0000 (13:28 -0400)]
mailinfo: avoid violating strbuf assertion

In handle_from, we calculate the end boundary of a section
to remove from a strbuf using strcspn like this:

  el = strcspn(buf, set_of_end_boundaries);
  strbuf_remove(&sb, start, el + 1);

This works fine if "el" is the offset of the boundary
character, meaning we remove up to and including that
character. But if the end boundary didn't match (that is, we
hit the end of the string as the boundary instead) then we
want just "el". Asking for "el+1" caught an out-of-bounds
assertion in the strbuf library.

This manifested itself when we got a 'From' header that had
just an email address with nothing else in it (the end of
the string was the end of the address, rather than, e.g., a
trailing '>' character), causing git-mailinfo to barf.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit format-patch: avoid underrun when format.headers is empty or all NLs
Jim Meyering [Tue, 19 Aug 2008 18:42:04 +0000 (20:42 +0200)]
git format-patch: avoid underrun when format.headers is empty or all NLs

* builtin-log.c (add_header): Avoid a buffer underrun when
format.headers is empty or all newlines.  Reproduce with this:
git config format.headers '' && git format-patch -1

Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agot1002-read-tree-m-u-2way.sh: use 'git diff -U0' rather than 'diff -U0'
Brandon Casey [Mon, 18 Aug 2008 23:17:53 +0000 (18:17 -0500)]
t1002-read-tree-m-u-2way.sh: use 'git diff -U0' rather than 'diff -U0'

Some old platforms have an old diff which doesn't have the -U option.
'git diff' can be used in its place. Adjust the comparison function to
strip git's additional header lines to make this possible.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoadapt git-cvsserver manpage to dash-free syntax
Robert Schiele [Mon, 18 Aug 2008 14:17:04 +0000 (16:17 +0200)]
adapt git-cvsserver manpage to dash-free syntax

Signed-off-by: Robert Schiele <rschiele@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agomailinfo: re-fix MIME multipart boundary parsing
Don Zickus [Thu, 14 Aug 2008 15:35:42 +0000 (11:35 -0400)]
mailinfo: re-fix MIME multipart boundary parsing

Recent changes to is_multipart_boundary() caused git-mailinfo to segfault.
The reason was after handling the end of the boundary the code tried to look
for another boundary.  Because the boundary list was empty, dereferencing
the pointer to the top of the boundary caused the program to go boom.

The fix is to check to see if the list is empty and if so go on its merry
way instead of looking for another boundary.

I also fixed a couple of increments and decrements that didn't look correct
relating to content_top.

The boundary test case was updated to catch future problems like this again.

Signed-off-by: Don Zickus <dzickus@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoStart 1.6.0.X maintenance series
Junio C Hamano [Sun, 17 Aug 2008 22:44:11 +0000 (15:44 -0700)]
Start 1.6.0.X maintenance series

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoGIT 1.6.0 v1.6.0
Junio C Hamano [Sun, 17 Aug 2008 18:42:10 +0000 (11:42 -0700)]
GIT 1.6.0

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge git-gui 0.11.0
Junio C Hamano [Sun, 17 Aug 2008 18:40:56 +0000 (11:40 -0700)]
Merge git-gui 0.11.0

16 years agoMerge branch 'ak/p4'
Junio C Hamano [Sun, 17 Aug 2008 17:53:57 +0000 (10:53 -0700)]
Merge branch 'ak/p4'

* ak/p4:
  Utilise our new p4_read_pipe and p4_write_pipe wrappers
  Add p4 read_pipe and write_pipe wrappers
  Put in the two other configuration elements found in the source
  Put some documentation in about the parameters that have been added
  Move git-p4.syncFromOrigin into a configuration parameters section
  Consistently use 'git-p4' for the configuration entries
  If the user has configured various parameters, use them.
  Switch to using 'p4_build_cmd'
  If we are in verbose mode, output what we are about to run (or return)
  Add a single command that will be used to construct the 'p4' command
  Utilise the new 'p4_system' function.
  Have a command that specifically invokes 'p4' (via system)
  Utilise the new 'p4_read_pipe_lines' command
  Create a specific version of the read_pipe_lines command for p4 invocations

Conflicts:
contrib/fast-import/git-p4

16 years agogit-p4: chdir now properly sets PWD environment variable in msysGit
Robert Blum [Fri, 1 Aug 2008 19:50:03 +0000 (12:50 -0700)]
git-p4: chdir now properly sets PWD environment variable in msysGit

P4 on Windows expects the PWD environment variable to be set to the
current working dir, but os.chdir in python doesn't do so.

Signed-off-by: Robert Blum <rob.blum@gmail.com>
Acked-by: Simon Hausmann <simon@lst.de>
Acked-by: Han-Wen Nienhuys <hanwen@xs4all.nl>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoImprove error output of git-rebase
Stephan Beyer [Sun, 17 Aug 2008 04:25:43 +0000 (06:25 +0200)]
Improve error output of git-rebase

"git rebase" without arguments on initial startup showed:

fatal: Needed a single revision
invalid upstream

This patch makes it show the ordinary usage string.

If .git/rebase-merge or .git/rebase-apply/rebasing exists, git-rebase
will die with a message saying that a rebase is in progress and the user
should try --skip/--abort/--continue.

If .git/rebase-apply/applying exists, git-rebase will die with a message
saying that git-am is in progress, regardless how many arguments are
given.

If no arguments are given and .git/rebase-apply/ exists, but neither a
rebasing nor applying file is in that directory, git-rebase dies with a
message saying that rebase-apply exists and no arguments were given.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agot9300: replace '!' with test_must_fail
Miklos Vajna [Sat, 16 Aug 2008 15:17:42 +0000 (17:17 +0200)]
t9300: replace '!' with test_must_fail

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge git://git.kernel.org/pub/scm/gitk/gitk
Junio C Hamano [Sun, 17 Aug 2008 06:21:07 +0000 (23:21 -0700)]
Merge git://git.kernel.org/pub/scm/gitk/gitk

* git://git.kernel.org/pub/scm/gitk/gitk:
  gitk: Allow safely calling nukefile from a run queue handler

16 years agoGit.pm: Make File::Spec and File::Temp requirement lazy
Marcus Griep [Fri, 15 Aug 2008 19:53:59 +0000 (15:53 -0400)]
Git.pm: Make File::Spec and File::Temp requirement lazy

This will ensure that the API at large is accessible to nearly
all Perl versions, while only the temp file caching API is tied to
the File::Temp and File::Spec modules being available.

Signed-off-by: Marcus Griep <marcus@griep.us>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoDocumentation: document the pager.* configuration setting
Miklos Vajna [Sat, 16 Aug 2008 02:14:33 +0000 (04:14 +0200)]
Documentation: document the pager.* configuration setting

It was already documented in RelNotes-1.6.0, but not in the git-config
manual page.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-stash: improve synopsis in help and manual page
Stephan Beyer [Sat, 16 Aug 2008 03:27:31 +0000 (05:27 +0200)]
git-stash: improve synopsis in help and manual page

"git stash -h" showed some incomplete and ugly usage information.
For example, the useful "--keep-index" option for "save" or the "--index"
option for  "apply" were not shown. Also in the documentation synopsis they
were not shown, so that there is no incentive to scroll down and even see
that such options exist.

This patch improves the git-stash synopsis in the documentation by
mentioning that further options to the stash commands and then copies
this synopsis to the usage information string of git-stash.sh.

For the latter, the dashless git command string has to be inserted on the
second and the following usage lines. The code of this is taken from
git-sh-setup so that all lines will show the command string.

Note that the "create" command is not advertised at all now, because
it was not mentioned in git-stash.txt.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMakefile: building git in cygwin 1.7.0
Eric Blake [Fri, 15 Aug 2008 15:01:03 +0000 (15:01 +0000)]
Makefile: building git in cygwin 1.7.0

On platforms with $X, make removes any leftover scripts 'a' from
earlier builds if a new binary 'a.exe' is now built.  However, on
cygwin 1.7.0, 'git' and 'git.exe' now consistently name the same file.
Test for file equality before attempting a remove, in order to avoid
nuking just-built binaries.

Signed-off-by: Eric Blake <ebb9@byu.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-am: ignore --binary option
Stephan Beyer [Fri, 8 Aug 2008 23:28:54 +0000 (01:28 +0200)]
git-am: ignore --binary option

The git-apply documentation says that --binary is a historical option.
This patch lets git-am ignore --binary and removes advertisements of this
option.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agobash-completion: Add non-command git help files to bash-completion
Marcus Griep [Fri, 15 Aug 2008 17:59:28 +0000 (13:59 -0400)]
bash-completion: Add non-command git help files to bash-completion

Git allows access to the gitattributes man page via `git help attributes`,
but this is not discoverable via the bash-completion mechanism.  This
patch adds all current non-command man pages to the completion candidate
list.

Signed-off-by: Marcus Griep <marcus@griep.us>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoFix t3700 on filesystems which do not support question marks in names
Alex Riesen [Fri, 15 Aug 2008 07:32:30 +0000 (09:32 +0200)]
Fix t3700 on filesystems which do not support question marks in names

Use square brackets instead.

And the prominent example of the deficiency are, as usual, the filesystems
of Microsoft house.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoUtilise our new p4_read_pipe and p4_write_pipe wrappers
Anand Kumria [Thu, 14 Aug 2008 22:40:39 +0000 (23:40 +0100)]
Utilise our new p4_read_pipe and p4_write_pipe wrappers

Signed-off-by: Anand Kumria <wildfire@progsoc.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoAdd p4 read_pipe and write_pipe wrappers
Anand Kumria [Thu, 14 Aug 2008 22:40:38 +0000 (23:40 +0100)]
Add p4 read_pipe and write_pipe wrappers

Two additional wrappers to cover 3 places where we utilise p4 in piped
form.  Found by Tor Arvid Lund.

Signed-off-by: Anand Kumria <wildfire@progsoc.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agobash completion: Add '--merge' long option for 'git log'
Lee Marlow [Thu, 14 Aug 2008 22:41:11 +0000 (16:41 -0600)]
bash completion: Add '--merge' long option for 'git log'

Signed-off-by: Lee Marlow <lee.marlow@gmail.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>