Code

git.git
15 years agoGIT 1.6.3.2 v1.6.3.2
Junio C Hamano [Thu, 4 Jun 2009 05:42:15 +0000 (22:42 -0700)]
GIT 1.6.3.2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogrep: fix empty word-regexp matches
René Scharfe [Wed, 3 Jun 2009 16:19:01 +0000 (18:19 +0200)]
grep: fix empty word-regexp matches

The command "git grep -w ''" dies as soon as it encounters an empty line,
reporting (wrongly) that "regexp returned nonsense".  The first hunk of
this patch relaxes the sanity check that is responsible for that,
allowing matches to start at the end.

The second hunk complements it by making sure that empty matches are
rejected if -w was specified, as they are not really words.

GNU grep does the same:

$ echo foo | grep -c ''
1
$ echo foo | grep -c -w ''
0

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoblame: correctly handle a path that used to be a directory
Junio C Hamano [Wed, 3 Jun 2009 07:43:22 +0000 (00:43 -0700)]
blame: correctly handle a path that used to be a directory

When trying to see if the same path exists in the parent, we ran
"diff-tree" with pathspec set to the path we are interested in with the
parent, and expect either to have exactly one resulting filepair (either
"changed from the parent", "created when there was none") or nothing (when
there is no change from the parent).

If the path used to be a directory, however, we will also see unbounded
number of entries that talk about the files that used to exist underneath
the directory in question.  Correctly pick only the entry that describes
the path we are interested in in such a case (namely, the creation of the
path as a regular file).

Noticed by Ben Willard.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoadd -i: do not dump patch during application
Thomas Rast [Tue, 2 Jun 2009 21:34:27 +0000 (23:34 +0200)]
add -i: do not dump patch during application

Remove a debugging print that snuck in at 7a26e65 (Revert
"git-add--interactive: remove hunk coalescing", 2009-05-16).

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoUpdate draft release notes for 1.6.3.2
Junio C Hamano [Tue, 2 Jun 2009 14:57:39 +0000 (07:57 -0700)]
Update draft release notes for 1.6.3.2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'cb/maint-1.6.0-xdl-merge-fix' into maint
Junio C Hamano [Tue, 2 Jun 2009 14:48:44 +0000 (07:48 -0700)]
Merge branch 'cb/maint-1.6.0-xdl-merge-fix' into maint

* cb/maint-1.6.0-xdl-merge-fix:
  Change xdl_merge to generate output even for null merges
  t6023: merge-file fails to output anything for a degenerate merge

Conflicts:
xdiff/xmerge.c

15 years agoMerge branch 'rs/maint-grep-word-regexp-fix' into maint
Junio C Hamano [Tue, 2 Jun 2009 14:48:09 +0000 (07:48 -0700)]
Merge branch 'rs/maint-grep-word-regexp-fix' into maint

* rs/maint-grep-word-regexp-fix:
  grep: fix colouring of matches with zero length
  grep: fix word-regexp at the beginning of lines

15 years agoMerge branch 'sb/maint-1.6.2-opt-filename-fix' into maint
Junio C Hamano [Tue, 2 Jun 2009 14:47:03 +0000 (07:47 -0700)]
Merge branch 'sb/maint-1.6.2-opt-filename-fix' into maint

* sb/maint-1.6.2-opt-filename-fix:
  apply, fmt-merge-msg: use relative filenames
  commit: -F overrides -t

15 years agoMerge branch 'jc/maint-add-p-coalesce-fix' into maint
Junio C Hamano [Tue, 2 Jun 2009 14:46:52 +0000 (07:46 -0700)]
Merge branch 'jc/maint-add-p-coalesce-fix' into maint

* jc/maint-add-p-coalesce-fix:
  t3701: ensure correctly set up repository after skipped tests
  Revert "git-add--interactive: remove hunk coalescing"
  Splitting a hunk that adds a line at the top fails in "add -p"

15 years agoMerge branch 'tr/maint-doc-stash-pop' into maint
Junio C Hamano [Tue, 2 Jun 2009 14:43:45 +0000 (07:43 -0700)]
Merge branch 'tr/maint-doc-stash-pop' into maint

* tr/maint-doc-stash-pop:
  Documentation: teach stash/pop workflow instead of stash/apply

15 years agogrep: fix colouring of matches with zero length
René Scharfe [Mon, 1 Jun 2009 21:53:05 +0000 (23:53 +0200)]
grep: fix colouring of matches with zero length

If a zero-length match is encountered, break out of loop and show the rest
of the line uncoloured.  Otherwise we'd be looping forever, trying to make
progress by advancing the pointer by zero characters.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoDocumentation: teach stash/pop workflow instead of stash/apply
Thomas Rast [Thu, 28 May 2009 09:40:15 +0000 (11:40 +0200)]
Documentation: teach stash/pop workflow instead of stash/apply

Recent discussion on the list showed some comments in favour of a
stash/pop workflow:

  http://marc.info/?l=git&m=124234911423358&w=2
  http://marc.info/?l=git&m=124235348327711&w=2

Change the stash documentation and examples to document pop in its own
right (and apply in terms of pop), and use stash/pop in the examples.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agofix segfault showing an empty remote
Clemens Buchacher [Wed, 27 May 2009 20:13:43 +0000 (22:13 +0200)]
fix segfault showing an empty remote

In case of an empty list, the search for its tail caused a
NULL-pointer dereference.

Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Reported-by: Erik Faye-Lund <kusmabite@googlemail.com>
Acked-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoPrepare for 1.6.3.2
Junio C Hamano [Tue, 26 May 2009 02:20:39 +0000 (19:20 -0700)]
Prepare for 1.6.3.2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'js/maint-no-ln-across-libexec-and-bin' into maint
Junio C Hamano [Tue, 26 May 2009 02:04:29 +0000 (19:04 -0700)]
Merge branch 'js/maint-no-ln-across-libexec-and-bin' into maint

* js/maint-no-ln-across-libexec-and-bin:
  Add NO_CROSS_DIRECTORY_HARDLINKS support to the Makefile

Conflicts:
Makefile

15 years agoMerge branch 'lt/maint-diff-reduce-lstat' into maint
Junio C Hamano [Tue, 26 May 2009 02:04:08 +0000 (19:04 -0700)]
Merge branch 'lt/maint-diff-reduce-lstat' into maint

* lt/maint-diff-reduce-lstat:
  Teach 'git checkout' to preload the index contents
  Avoid unnecessary 'lstat()' calls in 'get_stat_data()'

15 years agoMerge branch 'jm/format-patch-no-auto-n-when-k-is-given' into maint
Junio C Hamano [Tue, 26 May 2009 02:03:52 +0000 (19:03 -0700)]
Merge branch 'jm/format-patch-no-auto-n-when-k-is-given' into maint

* jm/format-patch-no-auto-n-when-k-is-given:
  format-patch let -k override a config-specified format.numbered

15 years agoMerge branch 'do/maint-merge-recursive-fix' into maint
Junio C Hamano [Tue, 26 May 2009 02:03:43 +0000 (19:03 -0700)]
Merge branch 'do/maint-merge-recursive-fix' into maint

* do/maint-merge-recursive-fix:
  merge-recursive: never leave index unmerged while recursing

15 years agoMerge branch 'jk/maint-1.6.0-trace-argv' into maint
Junio C Hamano [Tue, 26 May 2009 02:03:20 +0000 (19:03 -0700)]
Merge branch 'jk/maint-1.6.0-trace-argv' into maint

* jk/maint-1.6.0-trace-argv:
  fix GIT_TRACE segfault with shell-quoted aliases

Conflicts:
alias.c

15 years agoMerge branch 'np/push-delta' into maint
Junio C Hamano [Tue, 26 May 2009 02:02:11 +0000 (19:02 -0700)]
Merge branch 'np/push-delta' into maint

* np/push-delta:
  allow OFS_DELTA objects during a push

15 years agoMerge branch 'ar/merge-one-file-diag' into maint
Junio C Hamano [Tue, 26 May 2009 02:01:59 +0000 (19:01 -0700)]
Merge branch 'ar/merge-one-file-diag' into maint

* ar/merge-one-file-diag:
  Clarify kind of conflict in merge-one-file helper

15 years agoMerge branch 'ar/unlink-err' into maint
Junio C Hamano [Tue, 26 May 2009 02:01:50 +0000 (19:01 -0700)]
Merge branch 'ar/unlink-err' into maint

* ar/unlink-err:
  print unlink(2) errno in copy_or_link_directory
  replace direct calls to unlink(2) with unlink_or_warn
  Introduce an unlink(2) wrapper which gives warning if unlink failed

15 years agoMerge branch 'jk/maint-add-empty' into maint
Junio C Hamano [Tue, 26 May 2009 02:01:41 +0000 (19:01 -0700)]
Merge branch 'jk/maint-add-empty' into maint

* jk/maint-add-empty:
  add: don't complain when adding empty project root

15 years agofix cat-file usage message and documentation
Jeff King [Mon, 25 May 2009 10:33:15 +0000 (06:33 -0400)]
fix cat-file usage message and documentation

cat-file with an object on the command line requires an
option to tell it what to output (type, size, pretty-print,
etc). However, the square brackets in the usage imply that
those options are not required. This patch switches them to
parentheses to indicate "required but grouped-OR" (curly
braces might also work, but this follows the convention used
already by "git stash").

While we're at it, let's change the <sha1> specifier in the
usage to <object>. That's what the documentation uses, and
it does actually use the regular object lookup.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agofetch: report ref storage DF errors more accurately
Jeff King [Mon, 25 May 2009 10:40:54 +0000 (06:40 -0400)]
fetch: report ref storage DF errors more accurately

When we fail to store a fetched ref, we recommend that the
user try running "git prune" to remove up any old refs that
have been deleted by the remote, which would clear up any DF
conflicts. However, ref storage might fail for other
reasons (e.g., permissions problems) in which case the
advice is useless and misleading.

This patch detects when there is an actual DF situation and
only issues the advice when one is found.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agolock_ref: inform callers of unavailable ref
Jeff King [Mon, 25 May 2009 10:37:15 +0000 (06:37 -0400)]
lock_ref: inform callers of unavailable ref

One of the ways that locking might fail is that there is a
DF conflict between two refs (e.g., you want to lock
"foo/bar" but "foo" already exists). In this case, we return
an error, but there is no way for the caller to know the
specific problem.

This patch sets errno to ENOTDIR, which is the most sensible
code. It's what we would see if the refs were stored purely
in the filesystem (but these days we must check the
namespace manually due to packed refs).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agot3701: ensure correctly set up repository after skipped tests
Johannes Sixt [Mon, 25 May 2009 12:07:55 +0000 (14:07 +0200)]
t3701: ensure correctly set up repository after skipped tests

There are two tests that are skipped if file modes are not obeyed by the
file system. In this case, the subsequent test failed because the
repository was in an unexpected state. This corrects it.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agomerge-options.txt: Clarify merge --squash
Michael J Gruber [Mon, 25 May 2009 16:00:10 +0000 (18:00 +0200)]
merge-options.txt: Clarify merge --squash

With the --squash option, merge sets up the index just like for a real
merge, but without the merge info (stages). Say so.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoChange xdl_merge to generate output even for null merges
Charles Bailey [Mon, 25 May 2009 00:21:14 +0000 (01:21 +0100)]
Change xdl_merge to generate output even for null merges

xdl_merge used to have a check to ensure that there was at least
some change in one or other side being merged but this suppressed
output for the degenerate case when base, local and remote
contents were all identical.

Removing this check enables correct output in the degenerate case
and xdl_free_script handles freeing NULL scripts so there is no
need to have the check for these calls.

Signed-off-by: Charles Bailey <charles@hashpling.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agot6023: merge-file fails to output anything for a degenerate merge
Charles Bailey [Mon, 25 May 2009 00:21:13 +0000 (01:21 +0100)]
t6023: merge-file fails to output anything for a degenerate merge

In the case that merge-file is passed three files with identical
contents it wipes the contents of the output file instead of
leaving it unchanged.

Althought merge-file is porcelain and this will never happen in
normal usage, it is still wrong.

Signed-off-by: Charles Bailey <charles@hashpling.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'maint-1.6.2' into maint
Junio C Hamano [Sun, 24 May 2009 22:29:33 +0000 (15:29 -0700)]
Merge branch 'maint-1.6.2' into maint

* maint-1.6.2:
  http-push.c::remove_locks(): fix use after free

15 years agoMerge branch 'maint-1.6.1' into maint-1.6.2
Junio C Hamano [Sun, 24 May 2009 22:29:23 +0000 (15:29 -0700)]
Merge branch 'maint-1.6.1' into maint-1.6.2

* maint-1.6.1:
  http-push.c::remove_locks(): fix use after free

15 years agoMerge branch 'maint-1.6.0' into maint-1.6.1
Junio C Hamano [Sun, 24 May 2009 22:29:13 +0000 (15:29 -0700)]
Merge branch 'maint-1.6.0' into maint-1.6.1

* maint-1.6.0:
  http-push.c::remove_locks(): fix use after free

15 years agohttp-push.c::remove_locks(): fix use after free
Alex Riesen [Sun, 24 May 2009 13:16:49 +0000 (15:16 +0200)]
http-push.c::remove_locks(): fix use after free

Noticed and reported by Serhat Şevki Dinçer.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Acked-by: Clemens Buchacher <drizzd@aon.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogrep: fix word-regexp at the beginning of lines
René Scharfe [Sat, 23 May 2009 11:45:26 +0000 (13:45 +0200)]
grep: fix word-regexp at the beginning of lines

After bol is forwarded, it doesn't represent the beginning of the line
any more.  This means that the beginning-of-line marker (^) mustn't match,
i.e. the regex flag REG_NOTBOL needs to be set.

This bug was introduced by fb62eb7fab97cea880ea7fe4f341a4dfad14ab48
("grep -w: forward to next possible position after rejected match").

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoapply, fmt-merge-msg: use relative filenames
Stephen Boyd [Sat, 23 May 2009 18:53:11 +0000 (11:53 -0700)]
apply, fmt-merge-msg: use relative filenames

Commit dbd0f5c7 (Files given on the command line are relative to $cwd,
2008-08-06) only fixed git-commit and git-tag. But, git-apply and
git-fmt-merge-msg didn't get the update and exhibit the same behavior.

Fix them and add tests for "apply --build-fake-ancestor" and
"fmt-merge-msg -F".

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agocommit: -F overrides -t
Stephen Boyd [Sat, 23 May 2009 18:53:10 +0000 (11:53 -0700)]
commit: -F overrides -t

Commit dbd0f5c7 (Files given on the command line are relative to $cwd,
2008-08-06) introduced parse_options_fix_filename() as a quick fix for
filename arguments used in the parse options API.

git-commit was still broken. This means

    git commit -F log -t temp

in a subdirectory would make git think the log message should be taken
from temp instead of log.

This is because parse_options_fix_filename() calls prefix_filename()
which uses a single static char buffer to do its work. Making two calls
with two char pointers causes the pointers to alias. To prevent
aliasing, we duplicate the string returned by
parse_options_fix_filename().

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogrep: fix word-regexp colouring
René Scharfe [Wed, 20 May 2009 21:31:53 +0000 (23:31 +0200)]
grep: fix word-regexp colouring

As noticed by Dmitry Gryazin: When a pattern is found but it doesn't
start and end at word boundaries, bol is forwarded to after the match and
the pattern is searched again.  When a pattern is finally found between
word boundaries, the match offsets are off by the number of characters
that have been skipped.

This patch corrects the offsets to be relative to the value of bol as
passed to match_one_pattern() by its caller.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agocompletion: use git rev-parse to detect bare repos
Giuseppe Bilotta [Mon, 18 May 2009 16:24:30 +0000 (18:24 +0200)]
completion: use git rev-parse to detect bare repos

Its check is more robust than a config check for core.bare

Trivially-Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoCope better with a _lot_ of packs
Johannes Schindelin [Fri, 15 May 2009 18:52:47 +0000 (20:52 +0200)]
Cope better with a _lot_ of packs

You might end up with a situation where you have tons of pack files, e.g.
when using hg2git.  In this situation, all kinds of operations may
end up with a "too many files open" error.  Let's recover gracefully from
that.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Looks-right-to-me-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agofor-each-ref: fix segfault in copy_email
Jeff King [Mon, 18 May 2009 17:58:11 +0000 (13:58 -0400)]
for-each-ref: fix segfault in copy_email

You can trigger a segfault in git.git by doing:

  git for-each-ref --format='%(taggeremail)' refs/tags/v0.99

The v0.99 tag is special in that it contains no "tagger"
header.

The bug is obvious in copy_email, which carefully checks to
make sure the result of a strchr is non-NULL, but only after
already having used it to perform other work. The fix is to
move the check up.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoshow-branch: Fix die message in parse_reflog_param()
Stephen Boyd [Sun, 17 May 2009 10:47:02 +0000 (03:47 -0700)]
show-branch: Fix die message in parse_reflog_param()

Commit 76a44c5 (show-branch --reflog: show the reflog message at the
top, 2007-01-19) introduced parse_reflog_param(). The die() call was
incorrectly passed arg + 9, when it should have been passed arg.

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agocompletion: add missing options to show-branch and show
Stephen Boyd [Sun, 17 May 2009 03:42:43 +0000 (20:42 -0700)]
completion: add missing options to show-branch and show

Add --oneline and --abbrev-commit to show and --sparse to show-branch.

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agodir.c: clean up handling of 'path' parameter in read_directory_recursive()
Linus Torvalds [Thu, 14 May 2009 20:05:03 +0000 (13:05 -0700)]
dir.c: clean up handling of 'path' parameter in read_directory_recursive()

Right now we pass two different pathnames ('path' and 'base') down to
read_directory_recursive(), and the only real reason for that is that we
want to allow an empty 'base' parameter, but when we do so, we need the
pathname to "opendir()" to be "." rather than the empty string.

And rather than handle that confusion in the caller, we can just fix
read_directory_recursive() to handle the case of an empty path itself,
by just passing opendir() a "." ourselves if the path is empty.

This would allow us to then drop one of the pathnames entirely from the
calling convention, but rather than do that, we'll start separating them
out as a "filesystem pathname" (the one we use for filesystem accesses)
and a "git internal base name" (which is the name that we use for git
internally).

That will eventually allow us to do things like handle different
encodings (eg the filesystem pathnames might be Latin1, while git itself
would use UTF-8 for filename information).

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoFix type-punning issues
Dan McGee [Tue, 12 May 2009 01:17:38 +0000 (20:17 -0500)]
Fix type-punning issues

In these two places we are casting part of our unsigned char sha1 array into
an unsigned int, which violates GCCs strict-aliasing rules (and probably
other compilers).

Signed-off-by: Dan McGee <dpmcgee@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agotest: checkout shouldn't say that HEAD has moved if it didn't
Nanako Shiraishi [Sun, 17 May 2009 02:43:08 +0000 (11:43 +0900)]
test: checkout shouldn't say that HEAD has moved if it didn't

Signed-off-by: しらいしななこ <nanako3@lavabit.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agocompletion: enhance "current branch" display
Junio C Hamano [Sun, 10 May 2009 08:56:21 +0000 (01:56 -0700)]
completion: enhance "current branch" display

Introduce GIT_PS1_DESCRIBE option you can set to "contains", "branch", or
"describe" to tweak the way how a detached HEAD is described.

The default behaviour is to describe only exact match with some tag
(otherwise use the first 7 hexdigits) as before.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agocompletion: simplify "current branch" in __git_ps1()
Junio C Hamano [Sun, 10 May 2009 08:53:19 +0000 (01:53 -0700)]
completion: simplify "current branch" in __git_ps1()

As I very often work on a detached HEAD, I found it pretty confusing
when __git_ps1() said 'some-name'.  Did I create a branch with that name
by mistake, or do I happen to be on a commit with that exact tag?

This patch fixes the issue by enclosing non branch names in a pair of
parentheses when used to substitute %s token in __git_ps1() argument.

It also fixes a small bug where the branch part is left empty when
.git/HEAD is unreadable for whatever reason.  The output now says
"(unknown)".

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agocompletion: fix PS1 display during a merge on detached HEAD
Junio C Hamano [Sat, 16 May 2009 18:46:22 +0000 (11:46 -0700)]
completion: fix PS1 display during a merge on detached HEAD

If your merge stops in a conflict while on a detached HEAD, recent
completion code fails to show anything.  This was because various cases
added to support the operation-in-progress markers (e.g. REBASE, MERGING)
forgot that they need to set the variable "b" to something for the result
they computed to be displayed at all.

Probably not many people make trial merges on a detached HEAD (which is
tremendously useful feature of git, by the way), and that may be why this
was not noticed for a long time.

Acked-By: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoRevert "git-add--interactive: remove hunk coalescing"
Junio C Hamano [Sat, 16 May 2009 17:48:23 +0000 (10:48 -0700)]
Revert "git-add--interactive: remove hunk coalescing"

This reverts commit 0beee4c6dec15292415e3d56075c16a76a22af54 but with a
bit of twist, as we have added "edit hunk manually" hack and we cannot
rely on the original line numbers of the hunks that were manually edited.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoSplitting a hunk that adds a line at the top fails in "add -p"
Matt Graham [Sat, 16 May 2009 03:10:19 +0000 (23:10 -0400)]
Splitting a hunk that adds a line at the top fails in "add -p"

Splitting a hunk into two in add -p doesn't work for a diff that adds a
new line at the top of the file with other add in the same hunk.

Signed-off-by: Matthew Graham <mdg149@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agobuiltin-checkout: Don't tell user that HEAD has moved before it has
Daniel Cordero [Sat, 16 May 2009 17:54:45 +0000 (10:54 -0700)]
builtin-checkout: Don't tell user that HEAD has moved before it has

Previously, checkout would tell the user this message before moving HEAD,
without regard to whether the upcoming move will result in success.
If the move failed, this causes confusion.

Show the message after the move, unless the move failed.

Signed-off-by: Daniel Cordero <theappleman@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agopre-commit.sample: don't print incidental SHA1
Jim Meyering [Sat, 16 May 2009 10:21:50 +0000 (12:21 +0200)]
pre-commit.sample: don't print incidental SHA1

Make the sample pre-commit hook script discard
all git-rev-parse output, not just stderr.
Otherwise, it would print an SHA1.

Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agotests: Add tests for missing format-patch long options
Stephen Boyd [Sat, 16 May 2009 09:24:45 +0000 (02:24 -0700)]
tests: Add tests for missing format-patch long options

Exercise format-patch's --signoff, --in-reply-to and --start-number long
options.

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoapi-parse-options.txt: use 'func' instead of 'funct'
Stephen Boyd [Sat, 16 May 2009 09:24:44 +0000 (02:24 -0700)]
api-parse-options.txt: use 'func' instead of 'funct'

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoTurn on USE_ST_TIMESPEC for OpenBSD
Tony Kemp [Thu, 14 May 2009 06:47:41 +0000 (16:47 +1000)]
Turn on USE_ST_TIMESPEC for OpenBSD

Like Darwin, OpenBSD's stat struct uses st_ctimespec and st_mtimestruct
rather than st_ctim and st_mtim.

Signed-off-by: Tony Kemp <tony.kemp@newcastle.edu.au>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'maint-1.6.2' into maint
Junio C Hamano [Sat, 16 May 2009 07:12:58 +0000 (00:12 -0700)]
Merge branch 'maint-1.6.2' into maint

* maint-1.6.2:
  ls-tree manpage: output of ls-tree is compatible with update-index
  ls-tree manpage: use "unless" instead of "when ... is not"

15 years agoMerge branch 'maint-1.6.1' into maint-1.6.2
Junio C Hamano [Thu, 14 May 2009 04:06:11 +0000 (21:06 -0700)]
Merge branch 'maint-1.6.1' into maint-1.6.2

* maint-1.6.1:
  ls-tree manpage: output of ls-tree is compatible with update-index
  ls-tree manpage: use "unless" instead of "when ... is not"

15 years agoMerge branch 'maint-1.6.0' into maint-1.6.1
Junio C Hamano [Thu, 14 May 2009 04:05:59 +0000 (21:05 -0700)]
Merge branch 'maint-1.6.0' into maint-1.6.1

* maint-1.6.0:
  ls-tree manpage: output of ls-tree is compatible with update-index
  ls-tree manpage: use "unless" instead of "when ... is not"

15 years agoAdd NO_CROSS_DIRECTORY_HARDLINKS support to the Makefile
Johannes Schindelin [Mon, 11 May 2009 11:02:18 +0000 (13:02 +0200)]
Add NO_CROSS_DIRECTORY_HARDLINKS support to the Makefile

When the installed programs are tar'ed up and installed on a system where
bin/ and libexec/git-core/ live on different file systems, we do not want
libexec/git-core/git-* to be hardlinks to bin/git.

Noticed by Cedric Staniewski.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoGIT 1.6.3.1 v1.6.3.1
Junio C Hamano [Wed, 13 May 2009 05:28:22 +0000 (22:28 -0700)]
GIT 1.6.3.1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'maint-1.6.2' into maint
Junio C Hamano [Tue, 12 May 2009 16:58:34 +0000 (09:58 -0700)]
Merge branch 'maint-1.6.2' into maint

* maint-1.6.2:
  Revert "checkout branch: prime cache-tree fully"

15 years agoMerge branch 'jc/maint-read-tree-multi' into maint-1.6.2
Junio C Hamano [Tue, 12 May 2009 16:58:21 +0000 (09:58 -0700)]
Merge branch 'jc/maint-read-tree-multi' into maint-1.6.2

* jc/maint-read-tree-multi:
  Revert "checkout branch: prime cache-tree fully"

15 years agoRevert "checkout branch: prime cache-tree fully"
Junio C Hamano [Tue, 12 May 2009 16:41:28 +0000 (09:41 -0700)]
Revert "checkout branch: prime cache-tree fully"

The logic in 83ae209 (checkout branch: prime cache-tree fully,
2009-04-20) is bogus; checkout can switch branches with a dirty
index and in such a case the tree won't match HEAD.

Add t2014-switch to catch this breakage.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agols-tree manpage: output of ls-tree is compatible with update-index
Alex Riesen [Sun, 10 May 2009 16:14:49 +0000 (18:14 +0200)]
ls-tree manpage: output of ls-tree is compatible with update-index

Such format relationships are very useful things to remember for
script writers.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agols-tree manpage: use "unless" instead of "when ... is not"
Alex Riesen [Sun, 10 May 2009 16:13:45 +0000 (18:13 +0200)]
ls-tree manpage: use "unless" instead of "when ... is not"

Delayed negation in a statement is harder to spot and keep in mind.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agomerge-recursive: never leave index unmerged while recursing
Dave Olszewski [Sat, 9 May 2009 21:49:59 +0000 (14:49 -0700)]
merge-recursive: never leave index unmerged while recursing

When you are trying to come up with the final result (i.e. depth=0), you
want to record how the conflict arose by registering the state of the
common ancestor, your branch and the other branch in the index, hence you
want to do update_stages().

When you are merging with positive depth, that is because of a criss-cross
merge situation.  In such a case, you would need to record the tentative
result, with conflict markers and all, as if the merge went cleanly, even
if there are conflicts, in order to write it out as a tree object later to
be used as a common ancestor tree.

update_file() calls update_file_flags() with update_cache=1 to signal that
the result needs to be written to the index at stage #0 (i.e. merged), and
the code should not clobber the index further by calling update_stages().

The codepath to deal with rename/delete conflict in a recursive merge
however left the index unmerged.

Signed-off-by: Dave Olszewski <cxreg@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoTeach 'git checkout' to preload the index contents
Linus Torvalds [Sat, 9 May 2009 22:11:17 +0000 (15:11 -0700)]
Teach 'git checkout' to preload the index contents

This makes git checkout know to use the threaded index preloading if it
is enabled in the config file. You need to have

[core]
preloadindex = true

in your config file to see it, and for that feature to make sense your
filesystem needs to be able to do concurrent 'lstat()' lookups, but when
that is the case (especially NFS over a high-latency network), this can
be a noticeable performance win.

But with a low-latency network and at least older Linux NFS clients, this
will clearly potentially cause a lot of lock contention. It may still
speed up the uncached case, but the threading and locking overhead will
result in the cached case likely slowing down.

That was almost certainly fixed by Linux commit fc0f684c2 ("NFS: Remove
BKL from NFS lookup code"), but that one got merged into 2.6.27-rc1, so
older kernel versions than 2.6.27 will not scale very well.

But regardless, it's the right thing to do. If your filesystem doesn't
scale, don't enable index preloading.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoAvoid unnecessary 'lstat()' calls in 'get_stat_data()'
Linus Torvalds [Sat, 9 May 2009 21:57:30 +0000 (14:57 -0700)]
Avoid unnecessary 'lstat()' calls in 'get_stat_data()'

When we ask get_stat_data() to get the mode and size of an index entry,
we can avoid the lstat() call if we have marked the index entry as being
uptodate due to earlier lstat() calls.

This avoids a lot of unnecessary lstat() calls in eg 'git checkout',
where the last phase shows the differences to the working tree
(requiring a diff), but earlier phases have already verified the index.

On the kernel repo (with a fast machine and everything cached), this
changes timings of a nul 'git checkout' from

 - Before (best of ten):

0.14user 0.05system 0:00.19elapsed 100%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+13237minor)pagefaults 0swaps

 - After
0.11user 0.03system 0:00.15elapsed 98%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+13235minor)pagefaults 0swaps

so it can obviously be noticeable, although equally obviously it's not a
show-stopper on this particular machine. The difference is likely larger
on slower machines, or with operating systems that don't do as good a job
of name caching.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoadd: don't complain when adding empty project root
Jeff King [Wed, 29 Apr 2009 03:21:01 +0000 (23:21 -0400)]
add: don't complain when adding empty project root

We try to warn the user if one of their pathspecs caused no
matches, as it may have been a typo. However, we disable the
warning if the pathspec points to an existing file, since
that means it is not a typo but simply an empty directory.

Unfortunately, the file_exists() test was broken for one
special case: the pathspec of the project root is just "".
This patch detects this special case and acts as if the file
exists (which it must, since it is the project root).

The user-visible effect is that this:

  $ mkdir repo && cd repo && git init && git add .

used to complain like:

  fatal: pathspec '' did not match any files

but now is a silent no-op.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoformat-patch let -k override a config-specified format.numbered
Jim Meyering [Sat, 9 May 2009 08:12:01 +0000 (10:12 +0200)]
format-patch let -k override a config-specified format.numbered

Let a command-line --keep-subject (-k) override a config-specified
format.numbered (--numbered (-n)), rather than provoking the
"-n and -k are mutually exclusive" failure.
* t4021-format-patch-numbered.sh: Test for the above

Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agofix GIT_TRACE segfault with shell-quoted aliases
Jeff King [Fri, 8 May 2009 09:06:15 +0000 (05:06 -0400)]
fix GIT_TRACE segfault with shell-quoted aliases

The alias argv comes from the split_cmdline function, which
splits the config text for the alias into an array of
strings. It returns the number of elements in the array, but
does not actually put a NULL at the end of the array.
Later, the trace function tries to print this argv and
assumes that it has the trailing NULL.

The split_cmdline function is probably at fault, since argv
lists almost always end with a NULL signal. This patch adds
one, in addition to the returned count; this doesn't hurt
the other callers at all, since they were presumably using
the count already (and will never look at the NULL).

While we're there and using ALLOC_GROW, let's clean up the
other manual grow.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoDocumentation: cloning to empty directory is allowed
Alexander Potashev [Thu, 7 May 2009 12:04:08 +0000 (16:04 +0400)]
Documentation: cloning to empty directory is allowed

Cloning into an existing empty directory is now allowed:
commit 55892d23981917aefdb387ad7d0429f90cbd446a
("Allow cloning to an existing empty directory")

Signed-off-by: Alexander Potashev <aspotashev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoClarify kind of conflict in merge-one-file helper
Alex Riesen [Wed, 29 Apr 2009 21:40:50 +0000 (23:40 +0200)]
Clarify kind of conflict in merge-one-file helper

Not as verbose as the recursive merge driver, but better still.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit config: clarify --add and --get-color
Felipe Contreras [Wed, 6 May 2009 22:57:08 +0000 (01:57 +0300)]
git config: clarify --add and --get-color

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoarchive-tar.c: squelch a type mismatch warning
Junio C Hamano [Thu, 7 May 2009 08:08:19 +0000 (01:08 -0700)]
archive-tar.c: squelch a type mismatch warning

On some systems, giving a value of type time_t to printf "%lo" that
expects an unsigned long would give a type mismatch warning.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoStart 1.6.3.1 maintenance series.
Junio C Hamano [Sat, 9 May 2009 04:49:14 +0000 (21:49 -0700)]
Start 1.6.3.1 maintenance series.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'maint-1.6.1' into maint-1.6.2
Junio C Hamano [Sat, 9 May 2009 04:13:47 +0000 (21:13 -0700)]
Merge branch 'maint-1.6.1' into maint-1.6.2

* maint-1.6.1:

15 years agoMerge branch 'maint-1.6.0' into maint-1.6.1
Junio C Hamano [Sat, 9 May 2009 04:12:41 +0000 (21:12 -0700)]
Merge branch 'maint-1.6.0' into maint-1.6.1

* maint-1.6.0:
  dir.c: Fix two minor grammatical errors in comments

15 years agoGIT 1.6.3 v1.6.3
Junio C Hamano [Thu, 7 May 2009 00:13:27 +0000 (17:13 -0700)]
GIT 1.6.3

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agot4029: use sh instead of bash
Nguyễn Thái Ngọc Duy [Wed, 6 May 2009 14:33:34 +0000 (00:33 +1000)]
t4029: use sh instead of bash

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agot4200: convert sed expression which operates on non-text file to perl
Brandon Casey [Wed, 6 May 2009 22:56:18 +0000 (17:56 -0500)]
t4200: convert sed expression which operates on non-text file to perl

POSIX only requires sed to work on text files and MERGE_RR is not a text
file.  Some versions of sed complain that this file is not newline
terminated, and exit non-zero.  Use perl instead which does not have a
problem with it.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agot4200: remove two unnecessary lines
Brandon Casey [Wed, 6 May 2009 22:56:17 +0000 (17:56 -0500)]
t4200: remove two unnecessary lines

These two lines appear to be unnecessary.  They set variables which are not
used afterwards.  The primary motivation to remove them is that the sed
invocation exits non-zero for seds which require newline termination of
input files.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agot/annotate-tests.sh: avoid passing a non-newline terminated file to sed
Brandon Casey [Wed, 6 May 2009 18:29:16 +0000 (13:29 -0500)]
t/annotate-tests.sh: avoid passing a non-newline terminated file to sed

Some versions of sed exit non-zero if the file they are supplied is not
newline terminated.  Solaris's /usr/xpg4/bin/sed is one such sed.  So
rework this test to avoid doing so.

This affects tests t8001-annotate.sh and t8002-blame.sh.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agot4118: avoid sed invocation on file without terminating newline
Brandon Casey [Wed, 6 May 2009 18:29:15 +0000 (13:29 -0500)]
t4118: avoid sed invocation on file without terminating newline

Some versions of sed exit non-zero if the file they are supplied is not
newline terminated. Solaris's /usr/xpg4/bin/sed is one such sed.  In
this case the sed invocation can be avoided entirely since the resulting
file is equivalent to a previously created file.  So, just copy that file
into place instead.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agot4118: add missing '&&'
Brandon Casey [Wed, 6 May 2009 18:29:14 +0000 (13:29 -0500)]
t4118: add missing '&&'

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agot8005: use egrep when extended regular expressions are required
Brandon Casey [Wed, 6 May 2009 18:31:42 +0000 (13:31 -0500)]
t8005: use egrep when extended regular expressions are required

Not all versions of grep understand backslashed extended regular
expressions.  Possibly only gnu grep does.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-clean doc: the command only affects paths under $(cwd)
Junio C Hamano [Wed, 6 May 2009 17:48:26 +0000 (10:48 -0700)]
git-clean doc: the command only affects paths under $(cwd)

Fredrik Skolmli and Thomas Rast noticed that it was left unstated that
"git clean" ran from a subdirectory will not affect anything outside it,
with or without path limiters.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'maint'
Junio C Hamano [Wed, 6 May 2009 05:52:17 +0000 (22:52 -0700)]
Merge branch 'maint'

* maint:
  improve error message in config.c
  t4018-diff-funcname: add cpp xfuncname pattern to syntax test
  Work around BSD whose typeof(tv.tv_sec) != time_t
  git-am.txt: reword extra headers in message body
  git-am.txt: Use date or value instead of time or timestamp
  git-am.txt: add an 'a', say what 'it' is, simplify a sentence
  dir.c: Fix two minor grammatical errors in comments
  git-svn: fix a sloppy Getopt::Long usage

15 years agoMerge branch 'rj/maint-1.6.0-svn-parse-fix' into maint
Junio C Hamano [Wed, 6 May 2009 05:51:49 +0000 (22:51 -0700)]
Merge branch 'rj/maint-1.6.0-svn-parse-fix' into maint

* rj/maint-1.6.0-svn-parse-fix:
  git-svn: fix a sloppy Getopt::Long usage

15 years agoMerge branch 'maint-1.6.0' into maint
Junio C Hamano [Wed, 6 May 2009 05:51:31 +0000 (22:51 -0700)]
Merge branch 'maint-1.6.0' into maint

* maint-1.6.0:
  dir.c: Fix two minor grammatical errors in comments

15 years agoimprove error message in config.c
Alex Riesen [Wed, 29 Apr 2009 21:27:54 +0000 (23:27 +0200)]
improve error message in config.c

Show errno if opening a lockfile fails.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agot4018-diff-funcname: add cpp xfuncname pattern to syntax test
Brandon Casey [Sat, 2 May 2009 14:31:16 +0000 (09:31 -0500)]
t4018-diff-funcname: add cpp xfuncname pattern to syntax test

Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoWork around BSD whose typeof(tv.tv_sec) != time_t
Bernd Ahlers [Mon, 6 Apr 2009 17:26:37 +0000 (19:26 +0200)]
Work around BSD whose typeof(tv.tv_sec) != time_t

According to POSIX, tv_sec is supposed to be a time_t, but OpenBSD
(and FreeBSD, too) defines it to be a long, which triggers a type
mismatch when a pointer to it is given to localtime_r().

Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-am.txt: reword extra headers in message body
Stephen Boyd [Mon, 4 May 2009 06:46:58 +0000 (23:46 -0700)]
git-am.txt: reword extra headers in message body

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-am.txt: Use date or value instead of time or timestamp
Stephen Boyd [Tue, 5 May 2009 05:19:00 +0000 (22:19 -0700)]
git-am.txt: Use date or value instead of time or timestamp

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-am.txt: add an 'a', say what 'it' is, simplify a sentence
Stephen Boyd [Tue, 5 May 2009 05:18:42 +0000 (22:18 -0700)]
git-am.txt: add an 'a', say what 'it' is, simplify a sentence

It's nice to know that 'it' is git-am or the subject line. Whitespace
implies characters so just remove characters.

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agocompletion: complete values for send-email
Stephen Boyd [Mon, 4 May 2009 06:25:35 +0000 (23:25 -0700)]
completion: complete values for send-email

Add completion for --confirm, --suppress-cc, and --smtp-encryption
command line arguments. Add completion for aliasfiletype and confirm
configuration variables.

Since --smtp-ssl is deprecated, replace it with --smtp-encryption and
the two options ssl and tls.

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agocompletion: complete values for log.date
Stephen Boyd [Mon, 4 May 2009 06:25:34 +0000 (23:25 -0700)]
completion: complete values for log.date

Add raw to the date formats too.

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agocompletion: complete values for help.format
Stephen Boyd [Mon, 4 May 2009 06:25:33 +0000 (23:25 -0700)]
completion: complete values for help.format

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>