Code

git.git
13 years agoMerge branch 'js/maint-merge-one-file-osx-expr' into maint
Junio C Hamano [Fri, 21 Oct 2011 17:49:25 +0000 (10:49 -0700)]
Merge branch 'js/maint-merge-one-file-osx-expr' into maint

* js/maint-merge-one-file-osx-expr:
  merge-one-file: fix "expr: non-numeric argument"

13 years agoMerge branch 'jm/maint-apply-detects-corrupt-patch-header' into maint
Junio C Hamano [Fri, 21 Oct 2011 17:49:24 +0000 (10:49 -0700)]
Merge branch 'jm/maint-apply-detects-corrupt-patch-header' into maint

* jm/maint-apply-detects-corrupt-patch-header:
  fix "git apply --index ..." not to deref NULL

13 years agoMerge branch 'jc/checkout-from-tree-keep-local-changes' into maint
Junio C Hamano [Fri, 21 Oct 2011 17:49:24 +0000 (10:49 -0700)]
Merge branch 'jc/checkout-from-tree-keep-local-changes' into maint

* jc/checkout-from-tree-keep-local-changes:
  checkout $tree $path: do not clobber local changes in $path not in $tree

13 years agoMerge branch 'mm/maint-config-explicit-bool-display' into maint
Junio C Hamano [Fri, 21 Oct 2011 17:49:24 +0000 (10:49 -0700)]
Merge branch 'mm/maint-config-explicit-bool-display' into maint

* mm/maint-config-explicit-bool-display:
  config: display key_delim for config --bool --get-regexp

13 years agostrbuf.c: remove unnecessary strbuf_grow() from strbuf_getwholeline()
Brandon Casey [Thu, 6 Oct 2011 04:21:33 +0000 (23:21 -0500)]
strbuf.c: remove unnecessary strbuf_grow() from strbuf_getwholeline()

This use of strbuf_grow() is a historical artifact that was once used to
ensure that strbuf.buf was allocated and properly nul-terminated.  This
was added before the introduction of the slopbuf in b315c5c0, which
guarantees that strbuf.buf always points to a usable nul-terminated string.
So let's remove it.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoPrepare for 1.7.7.1
Junio C Hamano [Sun, 16 Oct 2011 03:55:12 +0000 (20:55 -0700)]
Prepare for 1.7.7.1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'ms/patch-id-with-overlong-line' into maint
Junio C Hamano [Sun, 16 Oct 2011 03:46:39 +0000 (20:46 -0700)]
Merge branch 'ms/patch-id-with-overlong-line' into maint

* ms/patch-id-with-overlong-line:
  patch-id.c: use strbuf instead of a fixed buffer

13 years agoMerge branch 'jc/maint-bundle-too-quiet' into maint
Junio C Hamano [Sun, 16 Oct 2011 03:46:39 +0000 (20:46 -0700)]
Merge branch 'jc/maint-bundle-too-quiet' into maint

* jc/maint-bundle-too-quiet:
  Teach progress eye-candy to fetch_refs_from_bundle()

13 years agoMerge branch 'jk/filter-branch-require-clean-work-tree' into maint
Junio C Hamano [Sun, 16 Oct 2011 03:46:38 +0000 (20:46 -0700)]
Merge branch 'jk/filter-branch-require-clean-work-tree' into maint

* jk/filter-branch-require-clean-work-tree:
  filter-branch: use require_clean_work_tree

13 years agoMerge branch 'jc/maint-fsck-fwrite-size-check' into maint
Junio C Hamano [Sun, 16 Oct 2011 03:46:38 +0000 (20:46 -0700)]
Merge branch 'jc/maint-fsck-fwrite-size-check' into maint

* jc/maint-fsck-fwrite-size-check:
  fsck: do not abort upon finding an empty blob

13 years agoMerge branch 'bk/ancestry-path' into maint
Junio C Hamano [Sun, 16 Oct 2011 03:46:38 +0000 (20:46 -0700)]
Merge branch 'bk/ancestry-path' into maint

* bk/ancestry-path:
  t6019: avoid refname collision on case-insensitive systems
  revision: do not include sibling history in --ancestry-path output
  revision: keep track of the end-user input from the command line
  rev-list: Demonstrate breakage with --ancestry-path --all

13 years agoMerge branch 'jk/maint-fetch-submodule-check-fix' into maint
Junio C Hamano [Sun, 16 Oct 2011 03:46:38 +0000 (20:46 -0700)]
Merge branch 'jk/maint-fetch-submodule-check-fix' into maint

* jk/maint-fetch-submodule-check-fix:
  fetch: avoid quadratic loop checking for updated submodules

13 years agoMerge branch 'tr/mergetool-valgrind' into maint
Junio C Hamano [Sun, 16 Oct 2011 03:46:37 +0000 (20:46 -0700)]
Merge branch 'tr/mergetool-valgrind' into maint

* tr/mergetool-valgrind:
  Symlink mergetools scriptlets into valgrind wrappers

13 years agoMerge branch 'nm/grep-object-sha1-lock' into maint
Junio C Hamano [Sun, 16 Oct 2011 03:46:37 +0000 (20:46 -0700)]
Merge branch 'nm/grep-object-sha1-lock' into maint

* nm/grep-object-sha1-lock:
  grep: Fix race condition in delta_base_cache

Conflicts:
builtin/grep.c

13 years agoMerge branch 'jc/diff-index-unpack' into maint
Junio C Hamano [Sun, 16 Oct 2011 03:46:36 +0000 (20:46 -0700)]
Merge branch 'jc/diff-index-unpack' into maint

* jc/diff-index-unpack:
  diff-index: pass pathspec down to unpack-trees machinery
  unpack-trees: allow pruning with pathspec
  traverse_trees(): allow pruning with pathspec

13 years agoMerge branch 'mm/rebase-i-exec-edit' into maint
Junio C Hamano [Sun, 16 Oct 2011 03:46:36 +0000 (20:46 -0700)]
Merge branch 'mm/rebase-i-exec-edit' into maint

* mm/rebase-i-exec-edit:
  rebase -i: notice and warn if "exec $cmd" modifies the index or the working tree
  rebase -i: clean error message for --continue after failed exec

13 years agot1304: fall back to $USER if $LOGNAME is not defined
René Scharfe [Fri, 14 Oct 2011 17:44:45 +0000 (19:44 +0200)]
t1304: fall back to $USER if $LOGNAME is not defined

For some reason $LOGNAME is not set anymore for me after an upgrade from
Ubuntu 11.04 to 11.10.  Use $USER in such a case.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agofix "git apply --index ..." not to deref NULL
Jim Meyering [Wed, 12 Oct 2011 14:33:54 +0000 (16:33 +0200)]
fix "git apply --index ..." not to deref NULL

I noticed this when "git am CORRUPTED" unexpectedly failed with an
odd diagnostic, and even removed one of the files it was supposed
to have patched.

Reproduce with any valid old/new patch from which you have removed
the "+++ b/FILE" line.  You'll see a diagnostic like this

    fatal: unable to write file '(null)' mode 100644: Bad address

and you'll find that FILE has been removed.

The above is on glibc-based systems.  On other systems, rather than
getting "null", you may provoke a segfault as git tries to
dereference the NULL file name.

Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoconfig: display key_delim for config --bool --get-regexp
Matthieu Moy [Mon, 10 Oct 2011 12:54:51 +0000 (14:54 +0200)]
config: display key_delim for config --bool --get-regexp

The previous logic in show_config was to print the delimiter when the
value was set, but Boolean variables have an implicit value "true" when
they appear with no value in the config file. As a result, we got:

git_Config        --get-regexp '.*\.Boolean' #1. Ok: example.boolean
git_Config --bool --get-regexp '.*\.Boolean' #2. NO: example.booleantrue

Fix this by defering the display of the separator until after the value
to display has been computed.

Reported-by: Brian Foster <brian.foster@maxim-ic.com>
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agomerge-one-file: fix "expr: non-numeric argument"
Jay Soffian [Thu, 6 Oct 2011 18:25:55 +0000 (14:25 -0400)]
merge-one-file: fix "expr: non-numeric argument"

When invoking expr to compare two numbers, don't quote the
variables which are the output of 'wc -c'. On OS X, this output
includes spaces, which expr balks at:

  $ sz0=`wc -c </etc/passwd`
  $ sz1=`wc -c </etc/passwd`
  $ echo "'$sz0'"
  '    3667'

  $ expr "$sz0" \< "$sz1" \* 2
  expr: non-numeric argument

  $ expr $sz0 \< $sz1 \* 2
  1

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoGit 1.7.7 v1.7.7
Junio C Hamano [Fri, 30 Sep 2011 21:20:57 +0000 (14:20 -0700)]
Git 1.7.7

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agocheckout $tree $path: do not clobber local changes in $path not in $tree
Junio C Hamano [Fri, 30 Sep 2011 17:33:15 +0000 (10:33 -0700)]
checkout $tree $path: do not clobber local changes in $path not in $tree

Checking paths out of a tree is (currently) defined to do:

 - Grab the paths from the named tree that match the given pathspec,
   and add them to the index;

 - Check out the contents from the index for paths that match the
   pathspec to the working tree; and while at it

 - If the given pathspec did not match anything, suspect a typo from the
   command line and error out without updating the index nor the working
   tree.

Suppose that the branch you are working on has dir/myfile, and the "other"
branch has dir/other but not dir/myfile. Further imagine that you have
either modified or removed dir/myfile in your working tree, but you have
not run "git add dir/myfile" or "git rm dir/myfile" to tell Git about your
local change. Running

 $ git checkout other dir

would add dir/other to the index with the contents taken out of the
"other" branch, and check out the paths from the index that match the
pathspec "dir", namely, "dir/other" and "dir/myfile", overwriting your
local changes to "dir/myfile", even though "other" branch does not even
know about that file.

Fix it by updating the working tree only with the index entries that
was read from the "other" tree.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agotemplates/hooks--*: remove sample hooks without any functionality
Gerrit Pape [Tue, 27 Sep 2011 11:56:53 +0000 (11:56 +0000)]
templates/hooks--*: remove sample hooks without any functionality

Remove the sample post-commit and post-receive hooks.  The sample
post-commit doesn't contain any sample functionality and the comments do
not provide more information than already found in the documentation.
The sample post-receive hooks doesn't provide any sample functionality
either and refers in the comments to a contrib hook that might be
installed in different locations on different systems, which isn't that
helpful.

Signed-off-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agocontrib/hooks: adapt comment about Debian install location for contrib hooks
Gerrit Pape [Mon, 26 Sep 2011 12:58:35 +0000 (12:58 +0000)]
contrib/hooks: adapt comment about Debian install location for contrib hooks

Placing the contrib hooks into /usr/share/doc/ wasn't a good idea in the
first place.  According to the Debian policy they should be located in
/usr/share/git-core/, so let's put them there.

Thanks to Bill Allombert for reporting this through
 http://bugs.debian.org/640949

Signed-off-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'jc/namespace-doc-with-old-asciidoc'
Junio C Hamano [Mon, 26 Sep 2011 17:50:08 +0000 (10:50 -0700)]
Merge branch 'jc/namespace-doc-with-old-asciidoc'

* jc/namespace-doc-with-old-asciidoc:
  Documentation/gitnamespaces.txt: cater to older asciidoc

13 years agoGit 1.7.7-rc3 v1.7.7-rc3
Junio C Hamano [Fri, 23 Sep 2011 22:35:57 +0000 (15:35 -0700)]
Git 1.7.7-rc3

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge 1.7.6.4 in
Junio C Hamano [Fri, 23 Sep 2011 22:31:08 +0000 (15:31 -0700)]
Merge 1.7.6.4 in

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agomerge-recursive: Do not look at working tree during a virtual ancestor merge
Junio C Hamano [Fri, 23 Sep 2011 22:21:01 +0000 (15:21 -0700)]
merge-recursive: Do not look at working tree during a virtual ancestor merge

Fix another instance of a recursive merge incorrectly paying attention to
the working tree file during a virtual ancestor merge, that resulted in
spurious and useless "addinfo_cache failed" error message.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoGit 1.7.6.4 v1.7.6.4
Junio C Hamano [Fri, 23 Sep 2011 21:38:39 +0000 (14:38 -0700)]
Git 1.7.6.4

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'cb/maint-ls-files-error-report' into maint
Junio C Hamano [Fri, 23 Sep 2011 21:30:49 +0000 (14:30 -0700)]
Merge branch 'cb/maint-ls-files-error-report' into maint

* cb/maint-ls-files-error-report:
  t3005: do not assume a particular order of stdout and stderr of git-ls-files
  ls-files: fix pathspec display on error

13 years agodescribe: Refresh the index when run with --dirty
Allan Caffee [Mon, 1 Aug 2011 01:52:41 +0000 (21:52 -0400)]
describe: Refresh the index when run with --dirty

When running git describe --dirty the index should be refreshed.  Previously
the cached index would cause describe to think that the index was dirty when,
in reality, it was just stale.

The issue was exposed by python setuptools which hardlinks files into another
directory when building a distribution.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'jc/maint-clone-alternates' into maint
Junio C Hamano [Fri, 23 Sep 2011 21:27:33 +0000 (14:27 -0700)]
Merge branch 'jc/maint-clone-alternates' into maint

* jc/maint-clone-alternates:
  clone: clone from a repository with relative alternates
  clone: allow more than one --reference

13 years agoMerge branch 'nd/maint-clone-gitdir' into maint
Junio C Hamano [Fri, 23 Sep 2011 21:21:39 +0000 (14:21 -0700)]
Merge branch 'nd/maint-clone-gitdir' into maint

* nd/maint-clone-gitdir:
  clone: allow to clone from .git file
  read_gitfile_gently(): rename misnamed function to read_gitfile()

13 years agoMerge branch 'mh/check-ref-format-print-normalize' into maint
Junio C Hamano [Fri, 23 Sep 2011 21:20:51 +0000 (14:20 -0700)]
Merge branch 'mh/check-ref-format-print-normalize' into maint

* mh/check-ref-format-print-normalize:
  Forbid DEL characters in reference names
  check-ref-format --print: Normalize refnames that start with slashes

13 years agoMerge branch 'mg/branch-set-upstream-previous' into maint
Junio C Hamano [Fri, 23 Sep 2011 21:16:22 +0000 (14:16 -0700)]
Merge branch 'mg/branch-set-upstream-previous' into maint

* mg/branch-set-upstream-previous:
  branch.c: use the parsed branch name

13 years agoMerge branch 'gb/maint-am-patch-format-error-message' into maint
Junio C Hamano [Fri, 23 Sep 2011 21:11:18 +0000 (14:11 -0700)]
Merge branch 'gb/maint-am-patch-format-error-message' into maint

* gb/maint-am-patch-format-error-message:
  am: format is in $patch_format, not parse_patch

13 years agopatch-id.c: use strbuf instead of a fixed buffer
Michael Schubert [Wed, 21 Sep 2011 12:42:22 +0000 (14:42 +0200)]
patch-id.c: use strbuf instead of a fixed buffer

get_one_patchid() uses a rather dumb heuristic to determine if the
passed buffer is part of the next commit. Whenever the first 40 bytes
are a valid hexadecimal sha1 representation, get_one_patchid() returns
next_sha1.

Once the current line is longer than the fixed buffer, this will break
(provided the additional bytes make a valid hexadecimal sha1). As a result
patch-id returns incorrect results. Instead, use strbuf and read one line
at a time.

Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Michael Schubert <mschub@elegosoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'maint'
Junio C Hamano [Tue, 20 Sep 2011 03:46:48 +0000 (20:46 -0700)]
Merge branch 'maint'

* maint:
  git-mergetool: check return value from read

13 years agogit-mergetool: check return value from read
Jay Soffian [Mon, 19 Sep 2011 23:40:52 +0000 (19:40 -0400)]
git-mergetool: check return value from read

Mostly fixed already by 6b44577 (mergetool: check return value
from read, 2011-07-01). Catch two uses it missed.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'ph/format-patch-no-color'
Junio C Hamano [Mon, 19 Sep 2011 20:15:41 +0000 (13:15 -0700)]
Merge branch 'ph/format-patch-no-color'

* ph/format-patch-no-color:
  t4014: clean up format.thread config after each test

13 years agot4014: clean up format.thread config after each test
Jeff King [Mon, 19 Sep 2011 19:15:45 +0000 (15:15 -0400)]
t4014: clean up format.thread config after each test

The threading tests turn on format.thread, but never clean
up after themselves, meaning that later tests will also have
format.thread set.

This is more annoying than most leftover config, too,
because not only does it impact the results of other tests,
but it does so non-deterministically. Threading requires the
generation of message-ids, which incorporate the current
time, meaning a slow-running test script may generate
different results from run to run.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoTeach progress eye-candy to fetch_refs_from_bundle()
Junio C Hamano [Sun, 18 Sep 2011 23:52:32 +0000 (16:52 -0700)]
Teach progress eye-candy to fetch_refs_from_bundle()

With the usual "git" transport, a large-ish transfer with "git fetch" and
"git pull" give progress eye-candy to avoid boring users.  However, not
when they are reading from a bundle. I.e.

    $ git pull ../git-bundle.bndl master

This teaches bundle.c:unbundle() to give "-v" option to index-pack and
tell it to give progress bar when transport decides it is necessary.

The operation in the other direction, "git bundle create", could also
learn to honor --quiet but that is a separate issue.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoGit 1.7.7-rc2 v1.7.7-rc2
Junio C Hamano [Sun, 18 Sep 2011 22:41:34 +0000 (15:41 -0700)]
Git 1.7.7-rc2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'ci/forbid-unwanted-current-branch-update'
Junio C Hamano [Sat, 17 Sep 2011 04:48:10 +0000 (21:48 -0700)]
Merge branch 'ci/forbid-unwanted-current-branch-update'

* ci/forbid-unwanted-current-branch-update:
  branch --set-upstream: regression fix

13 years agobranch --set-upstream: regression fix
Junio C Hamano [Fri, 16 Sep 2011 23:28:38 +0000 (16:28 -0700)]
branch --set-upstream: regression fix

The "git branch" command, while not in listing mode, calls create_branch()
even when the target branch already exists, and it does so even when it is
not interested in updating the value of the branch (i.e. the name of the
commit object that sits at the tip of the existing branch). This happens
when the command is run with "--set-upstream" option.

The earlier safety-measure to prevent "git branch -f $branch $commit" from
updating the currently checked out branch did not take it into account,
and we no longer can update the tracking information of the current branch.

Minimally fix this regression by telling the validation code if it is
called to really update the value of a potentially existing branch, or if
the caller merely is interested in updating auxiliary aspects of a branch.

Reported-and-Tested-by: Jay Soffian
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoDisambiguate duplicate t9160* tests
Frédéric Heitzmann [Fri, 16 Sep 2011 19:55:03 +0000 (21:55 +0200)]
Disambiguate duplicate t9160* tests

1e5814f created t9160-git-svn-mergeinfo-push.sh on 11/9/7
40a1530 created t9160-git-svn-preserve-empty-dirs.sh on 11/7/20
The former test script is renumbered to t9161.

Signed-off-by: Frédéric Heitzmann <frederic.heitzmann@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoDocumentation/gitnamespaces.txt: cater to older asciidoc
Junio C Hamano [Fri, 16 Sep 2011 00:09:41 +0000 (17:09 -0700)]
Documentation/gitnamespaces.txt: cater to older asciidoc

Older asciidoc (e.g. 8.2.5 on Centos 5.5) is unhappy if a manpage does not
have a SYNOPSIS section. Show a sample (and a possibly bogus) command line
of running two commands that pay attention to this environment variable
with a customized value.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
13 years agofilter-branch: use require_clean_work_tree
Jeff King [Thu, 1 Sep 2011 21:53:07 +0000 (17:53 -0400)]
filter-branch: use require_clean_work_tree

Filter-branch already requires that we have a clean work
tree before starting. However, it failed to refresh the
index before checking, which means it could be wrong in the
case of stat-dirtiness.

Instead of simply adding a call to refresh the index, let's
switch to using the require_clean_work_tree function
provided by git-sh-setup. It does exactly what we want, and
with fewer lines of code and more specific output messages.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agot6019: avoid refname collision on case-insensitive systems
Thomas Rast [Thu, 15 Sep 2011 08:34:31 +0000 (10:34 +0200)]
t6019: avoid refname collision on case-insensitive systems

The criss-cross tests kept failing for me because of collisions of 'a'
with 'A' etc.  Prefix the lowercase refnames with an extra letter to
disambiguate.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Acked-by: Brad King <brad.king@kitware.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'ph/format-patch-no-color'
Junio C Hamano [Thu, 15 Sep 2011 04:43:57 +0000 (21:43 -0700)]
Merge branch 'ph/format-patch-no-color'

* ph/format-patch-no-color:
  format-patch: ignore ui.color

13 years agogit-svn: teach git-svn to populate svn:mergeinfo
Bryan Jacobs [Wed, 7 Sep 2011 17:36:05 +0000 (13:36 -0400)]
git-svn: teach git-svn to populate svn:mergeinfo

Allow git-svn to populate the svn:mergeinfo property automatically in
a narrow range of circumstances. Specifically, when dcommitting a
revision with multiple parents, all but (potentially) the first of
which have been committed to SVN in the same repository as the target
of the dcommit.

In this case, the merge info is the union of that given by each of the
parents, plus all changes introduced to the first parent by the other
parents.

In all other cases where a revision to be committed has multiple
parents, cause "git svn dcommit" to raise an error rather than
completing the commit and potentially losing history information in
the upstream SVN repository.

This behavior is disabled by default, and can be enabled by setting
the svn.pushmergeinfo config option.

[ew: minor style changes and manpage merge fix]

Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Bryan Jacobs <bjacobs@woti.com>
13 years agofetch: avoid quadratic loop checking for updated submodules
Jeff King [Mon, 12 Sep 2011 19:56:52 +0000 (15:56 -0400)]
fetch: avoid quadratic loop checking for updated submodules

Recent versions of git can be slow to fetch repositories with a
large number of refs (or when they already have a large
number of refs). For example, GitHub makes pull-requests
available as refs, which can lead to a large number of
available refs. This slowness goes away when submodule
recursion is turned off:

  $ git ls-remote git://github.com/rails/rails.git | wc -l
  3034

  [this takes ~10 seconds of CPU time to complete]
  git fetch --recurse-submodules=no \
    git://github.com/rails/rails.git "refs/*:refs/*"

  [this still isn't done after 10 _minutes_ of pegging the CPU]
  git fetch \
    git://github.com/rails/rails.git "refs/*:refs/*"

You can produce a quicker and simpler test case like this:

  doit() {
    head=`git rev-parse HEAD`
    for i in `seq 1 $1`; do
      echo $head refs/heads/ref$i
    done >.git/packed-refs
    echo "==> $1"
    rm -rf dest
    git init -q --bare dest &&
      (cd dest && time git.compile fetch -q .. refs/*:refs/*)
  }

  rm -rf repo
  git init -q repo && cd repo &&
  >file && git add file && git commit -q -m one

  doit 100
  doit 200
  doit 400
  doit 800
  doit 1600
  doit 3200

Which yields timings like:

  # refs  seconds of CPU
     100            0.06
     200            0.24
     400            0.95
     800            3.39
    1600           13.66
    3200           54.09

Notice that although the number of refs doubles in each
trial, the CPU time spent quadruples.

The problem is that the submodule recursion code works
something like:

  - for each ref we fetch
    - for each commit in git rev-list $new_sha1 --not --all
      - add modified submodules to list
  - fetch any newly referenced submodules

But that means if we fetch N refs, we start N revision
walks. Worse, because we use "--all", the number of refs we
must process that constitute "--all" keeps growing, too. And
you end up doing O(N^2) ref resolutions.

Instead, this patch structures the code like this:

  - for each sha1 we already have
    - add $old_sha1 to list $old
  - for each ref we fetch
    - add $new_sha1 to list $new
  - for each commit in git rev-list $new --not $old
    - add modified submodules to list
  - fetch any newly referenced submodules

This yields timings like:

  # refs  seconds of CPU
  100               0.00
  200               0.04
  400               0.04
  800               0.10
  1600              0.21
  3200              0.39

Note that the amount of effort doubles as the number of refs
doubles. Similarly, the fetch of rails.git takes about as
much time as it does with --recurse-submodules=no.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoformat-patch: ignore ui.color
Pang Yan Han [Mon, 12 Sep 2011 17:46:41 +0000 (01:46 +0800)]
format-patch: ignore ui.color

commit c9bfb953 (want_color: automatically fallback to color.ui,
2011-08-17) introduced a regression where format-patch produces colorized
patches when color.ui is set to "always".

In f3aafa4 (Disable color detection during format-patch, 2006-07-09),
git_format_config was taught to intercept diff.color to avoid passing it
down to git_log_config and later, git_diff_ui_config.

Teach git_format_config to intercept color.ui in the same way.

Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Pang Yan Han <pangyanhan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoGit 1.7.7-rc1 v1.7.7-rc1
Junio C Hamano [Mon, 12 Sep 2011 17:44:32 +0000 (10:44 -0700)]
Git 1.7.7-rc1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoSync with 1.7.6.3
Junio C Hamano [Mon, 12 Sep 2011 17:43:17 +0000 (10:43 -0700)]
Sync with 1.7.6.3

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'jn/remote-helpers-doc'
Junio C Hamano [Mon, 12 Sep 2011 17:38:11 +0000 (10:38 -0700)]
Merge branch 'jn/remote-helpers-doc'

* jn/remote-helpers-doc:
  (short) documentation for the testgit remote helper
  Documentation/git-remote-helpers: explain how import works with multiple refs
  Documentation/remote-helpers: explain capabilities first

13 years agoGit 1.7.6.3 v1.7.6.3
Junio C Hamano [Mon, 12 Sep 2011 17:33:03 +0000 (10:33 -0700)]
Git 1.7.6.3

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'jl/maint-fetch-submodule-check-fix' into maint
Junio C Hamano [Mon, 12 Sep 2011 17:19:57 +0000 (10:19 -0700)]
Merge branch 'jl/maint-fetch-submodule-check-fix' into maint

* jl/maint-fetch-submodule-check-fix:
  fetch: skip on-demand checking when no submodules are configured

13 years agoMerge branch 'maint'
Junio C Hamano [Mon, 12 Sep 2011 05:35:11 +0000 (22:35 -0700)]
Merge branch 'maint'

* maint:
  Prepare for 1.7.6.3 maintenance release
  SubmittingPathces: remove Cogito reference

Conflicts:
RelNotes

13 years agoPrepare for 1.7.6.3 maintenance release
Junio C Hamano [Mon, 12 Sep 2011 05:08:56 +0000 (22:08 -0700)]
Prepare for 1.7.6.3 maintenance release

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'ms/reflog-show-is-default' into maint
Junio C Hamano [Mon, 12 Sep 2011 05:33:24 +0000 (22:33 -0700)]
Merge branch 'ms/reflog-show-is-default' into maint

* ms/reflog-show-is-default:
  reflog: actually default to subcommand 'show'

13 years agoMerge branch 'jk/reset-reflog-message-fix' into maint
Junio C Hamano [Mon, 12 Sep 2011 05:33:20 +0000 (22:33 -0700)]
Merge branch 'jk/reset-reflog-message-fix' into maint

* jk/reset-reflog-message-fix:
  reset: give better reflog messages

13 years agoMerge branch 'vi/make-test-vector-less-specific' into maint
Junio C Hamano [Mon, 12 Sep 2011 05:33:16 +0000 (22:33 -0700)]
Merge branch 'vi/make-test-vector-less-specific' into maint

* vi/make-test-vector-less-specific:
  tests: cleanup binary test vector files

13 years agoMerge branch 'jk/tag-contains-ab' (early part) into maint
Junio C Hamano [Mon, 12 Sep 2011 04:54:32 +0000 (21:54 -0700)]
Merge branch 'jk/tag-contains-ab' (early part) into maint

* 'jk/tag-contains-ab' (early part):
  tag: speed up --contains calculation

13 years agoMerge branch 'dz/connect-error-report' into maint
Junio C Hamano [Mon, 12 Sep 2011 04:53:47 +0000 (21:53 -0700)]
Merge branch 'dz/connect-error-report' into maint

* dz/connect-error-report:
  Do not log unless all connect() attempts fail

13 years agoMerge branch 'jc/maint-mergetool-read-fix' into maint
Junio C Hamano [Mon, 12 Sep 2011 04:53:39 +0000 (21:53 -0700)]
Merge branch 'jc/maint-mergetool-read-fix' into maint

* jc/maint-mergetool-read-fix:
  mergetool: check return value from read

13 years agoMerge branch 'jk/maint-config-param' into maint
Junio C Hamano [Mon, 12 Sep 2011 04:53:13 +0000 (21:53 -0700)]
Merge branch 'jk/maint-config-param' into maint

* jk/maint-config-param:
  config: use strbuf_split_str instead of a temporary strbuf
  strbuf: allow strbuf_split to work on non-strbufs
  config: avoid segfault when parsing command-line config
  config: die on error in command-line config
  fix "git -c" parsing of values with equals signs
  strbuf_split: add a max parameter

13 years agoMerge branch 'jn/doc-dashdash' into maint
Junio C Hamano [Mon, 12 Sep 2011 04:52:18 +0000 (21:52 -0700)]
Merge branch 'jn/doc-dashdash' into maint

* jn/doc-dashdash:
  Documentation/i18n: quote double-dash for AsciiDoc
  Documentation: quote double-dash for AsciiDoc

Conflicts:
Documentation/git-mergetool--lib.txt

13 years agoMerge branch 'jk/maint-1.7.2-status-ignored' into maint
Junio C Hamano [Mon, 12 Sep 2011 04:51:10 +0000 (21:51 -0700)]
Merge branch 'jk/maint-1.7.2-status-ignored' into maint

* jk/maint-1.7.2-status-ignored:
  git status --ignored: tests and docs
  status: fix bug with missing --ignore files

Conflicts:
Documentation/git-status.txt
t/t7508-status.sh

13 years agoSubmittingPathces: remove Cogito reference
Sverre Rabbelier [Sun, 11 Sep 2011 12:38:10 +0000 (14:38 +0200)]
SubmittingPathces: remove Cogito reference

Removing Cogito leaves just git and StGit, which is a rather
incomplete list of git diff tools available. Sidestep the problem
of deciding what tools to mention by not mentioning any.

Signed-off-by: Sverre Rabbelier <srabbelier@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agofsck: do not abort upon finding an empty blob
Junio C Hamano [Mon, 12 Sep 2011 01:03:38 +0000 (18:03 -0700)]
fsck: do not abort upon finding an empty blob

Asking fwrite() to write one item of size bytes results in fwrite()
reporting "I wrote zero item", when size is zero. Instead, we could
ask it to write "size" items of 1 byte and expect it to report that
"I wrote size items" when it succeeds, with any value of size,
including zero.

Noticed and reported by BJ Hargrave.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agofetch: skip on-demand checking when no submodules are configured
Jens Lehmann [Fri, 9 Sep 2011 18:22:03 +0000 (20:22 +0200)]
fetch: skip on-demand checking when no submodules are configured

It makes no sense to do the - possibly very expensive - call to "rev-list
<new-ref-sha1> --not --all" in check_for_new_submodule_commits() when
there aren't any submodules configured.

Leave check_for_new_submodule_commits() early when no name <-> path
mappings for submodules are found in the configuration. To make that work
reading the configuration had to be moved further up in cmd_fetch(), as
doing that after the actual fetch of the superproject was too late.

Reported-by: Martin Fick <mfick@codeaurora.org>
Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoRelNotes/1.7.7: minor fixes
Michael J Gruber [Wed, 7 Sep 2011 11:54:11 +0000 (13:54 +0200)]
RelNotes/1.7.7: minor fixes

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMinor update to how-to maintain git
Junio C Hamano [Wed, 7 Sep 2011 18:18:18 +0000 (11:18 -0700)]
Minor update to how-to maintain git

A few more parts of this document is stale that needs updating
to reflect the reality, but I do not regularly rebase topics that
are only in "pu" anymore, which may be noteworthy for a commit.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoUpdate draft release notes to 1.7.7
Junio C Hamano [Tue, 6 Sep 2011 18:48:21 +0000 (11:48 -0700)]
Update draft release notes to 1.7.7

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'rc/histogram-diff'
Junio C Hamano [Tue, 6 Sep 2011 18:42:58 +0000 (11:42 -0700)]
Merge branch 'rc/histogram-diff'

* rc/histogram-diff:
  xdiff/xprepare: initialise xdlclassifier_t cf in xdl_prepare_env()

13 years agoMerge branch 'cb/maint-ls-files-error-report'
Junio C Hamano [Tue, 6 Sep 2011 18:42:55 +0000 (11:42 -0700)]
Merge branch 'cb/maint-ls-files-error-report'

* cb/maint-ls-files-error-report:
  t3005: do not assume a particular order of stdout and stderr of git-ls-files

13 years agoMerge branch 'mh/check-ref-format-print-normalize'
Junio C Hamano [Tue, 6 Sep 2011 18:42:52 +0000 (11:42 -0700)]
Merge branch 'mh/check-ref-format-print-normalize'

* mh/check-ref-format-print-normalize:
  Forbid DEL characters in reference names
  check-ref-format --print: Normalize refnames that start with slashes

13 years agoSync with 1.7.6.2
Junio C Hamano [Tue, 6 Sep 2011 18:42:12 +0000 (11:42 -0700)]
Sync with 1.7.6.2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoGit 1.7.6.2 v1.7.6.2
Junio C Hamano [Tue, 6 Sep 2011 18:41:02 +0000 (11:41 -0700)]
Git 1.7.6.2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoRevert "Merge branch 'cb/maint-quiet-push' into maint"
Junio C Hamano [Tue, 6 Sep 2011 18:06:32 +0000 (11:06 -0700)]
Revert "Merge branch 'cb/maint-quiet-push' into maint"

This reverts commit ffa69e61d3c5730bd4b65a465efc130b0ef3c7df, reversing
changes made to 4a13c4d14841343d7caad6ed41a152fee550261d.

Adding a new command line option to receive-pack and feed it from
send-pack is not an acceptable way to add features, as there is no
guarantee that your updated send-pack will be talking to updated
receive-pack. New features need to be added via the capability mechanism
negotiated over the protocol.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoUpdate draft release notes to 1.7.7
Junio C Hamano [Fri, 2 Sep 2011 20:26:02 +0000 (13:26 -0700)]
Update draft release notes to 1.7.7

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'js/i18n-scripts-2'
Junio C Hamano [Fri, 2 Sep 2011 20:18:42 +0000 (13:18 -0700)]
Merge branch 'js/i18n-scripts-2'

* js/i18n-scripts-2:
  bisect: take advantage of gettextln, eval_gettextln.

13 years agoMerge branch 'tr/maint-t3903-misquoted-command'
Junio C Hamano [Fri, 2 Sep 2011 20:18:39 +0000 (13:18 -0700)]
Merge branch 'tr/maint-t3903-misquoted-command'

* tr/maint-t3903-misquoted-command:
  t3903: fix misquoted rev-parse invocation

13 years agoMerge branch 'bc/bisect-test-use-shell-path'
Junio C Hamano [Fri, 2 Sep 2011 20:18:37 +0000 (13:18 -0700)]
Merge branch 'bc/bisect-test-use-shell-path'

* bc/bisect-test-use-shell-path:
  t6030: use $SHELL_PATH to invoke user's preferred shell instead of bare sh

13 years agoMerge branch 'va/p4-branch-import-test-update'
Junio C Hamano [Fri, 2 Sep 2011 20:18:33 +0000 (13:18 -0700)]
Merge branch 'va/p4-branch-import-test-update'

* va/p4-branch-import-test-update:
  git-p4: simple branch tests edits

13 years agoMerge branch 'tr/maint-strbuf-grow-nul-termination'
Junio C Hamano [Fri, 2 Sep 2011 20:18:29 +0000 (13:18 -0700)]
Merge branch 'tr/maint-strbuf-grow-nul-termination'

* tr/maint-strbuf-grow-nul-termination:
  strbuf_grow(): maintain nul-termination even for new buffer

13 years agoMerge branch 'tr/maint-ident-to-git-memmove'
Junio C Hamano [Fri, 2 Sep 2011 20:18:25 +0000 (13:18 -0700)]
Merge branch 'tr/maint-ident-to-git-memmove'

* tr/maint-ident-to-git-memmove:
  Use memmove in ident_to_git

13 years agoMerge branch 'tr/maint-format-patch-empty-output'
Junio C Hamano [Fri, 2 Sep 2011 20:18:22 +0000 (13:18 -0700)]
Merge branch 'tr/maint-format-patch-empty-output'

* tr/maint-format-patch-empty-output:
  Document negated forms of format-patch --to --cc --add-headers
  t4014: "no-add-headers" is actually called "no-add-header"
  t4014: invoke format-patch with --stdout where intended
  t4014: check for empty files from git format-patch --stdout

13 years agoMerge branch 'gb/maint-am-stgit-author-to-from-fix'
Junio C Hamano [Fri, 2 Sep 2011 20:18:11 +0000 (13:18 -0700)]
Merge branch 'gb/maint-am-stgit-author-to-from-fix'

* gb/maint-am-stgit-author-to-from-fix:
  am: fix stgit patch mangling

13 years agoMerge branch 'gb/maint-am-patch-format-error-message'
Junio C Hamano [Fri, 2 Sep 2011 20:18:07 +0000 (13:18 -0700)]
Merge branch 'gb/maint-am-patch-format-error-message'

* gb/maint-am-patch-format-error-message:
  am: format is in $patch_format, not parse_patch

Conflicts:
git-am.sh

13 years agoMerge branch 'ms/daemon-timeout-is-in-seconds'
Junio C Hamano [Fri, 2 Sep 2011 20:17:58 +0000 (13:17 -0700)]
Merge branch 'ms/daemon-timeout-is-in-seconds'

* ms/daemon-timeout-is-in-seconds:
  git-daemon.txt: specify --timeout in seconds

13 years agoMerge branch 'bg/t5540-osx-grep'
Junio C Hamano [Fri, 2 Sep 2011 20:17:50 +0000 (13:17 -0700)]
Merge branch 'bg/t5540-osx-grep'

* bg/t5540-osx-grep:
  t5540-http-test: shorten grep pattern

13 years agoMerge branch 'jc/clean-exclude-doc'
Junio C Hamano [Fri, 2 Sep 2011 20:17:46 +0000 (13:17 -0700)]
Merge branch 'jc/clean-exclude-doc'

* jc/clean-exclude-doc:
  Documentation: clarify "git clean -e <pattern>"

13 years agoMerge branch 'mg/maint-notes-C-doc'
Junio C Hamano [Fri, 2 Sep 2011 20:17:40 +0000 (13:17 -0700)]
Merge branch 'mg/maint-notes-C-doc'

* mg/maint-notes-C-doc:
  git-notes.txt: clarify -C vs. copy and -F

13 years agoMerge branch 'fg/submodule-ff-check-before-push'
Junio C Hamano [Fri, 2 Sep 2011 20:07:58 +0000 (13:07 -0700)]
Merge branch 'fg/submodule-ff-check-before-push'

* fg/submodule-ff-check-before-push:
  push: Don't push a repository with unpushed submodules

13 years agoMerge branch 'rc/diff-cleanup-records'
Junio C Hamano [Fri, 2 Sep 2011 19:07:11 +0000 (12:07 -0700)]
Merge branch 'rc/diff-cleanup-records'

* rc/diff-cleanup-records:
  xdiff/xprepare: improve O(n*m) performance in xdl_cleanup_records()

13 years agoMerge branch 'fk/use-kwset-pickaxe-grep-f'
Junio C Hamano [Fri, 2 Sep 2011 17:00:38 +0000 (10:00 -0700)]
Merge branch 'fk/use-kwset-pickaxe-grep-f'

* fk/use-kwset-pickaxe-grep-f:
  obstack: Fix portability issues
  Use kwset in grep
  Use kwset in pickaxe
  Adapt the kwset code to Git
  Add string search routines from GNU grep
  Add obstack.[ch] from EGLIBC 2.10

13 years agoMerge branch 'en/merge-recursive-2'
Junio C Hamano [Fri, 2 Sep 2011 17:00:18 +0000 (10:00 -0700)]
Merge branch 'en/merge-recursive-2'

* en/merge-recursive-2: (57 commits)
  merge-recursive: Don't re-sort a list whose order we depend upon
  merge-recursive: Fix virtual merge base for rename/rename(1to2)/add-dest
  t6036: criss-cross + rename/rename(1to2)/add-dest + simple modify
  merge-recursive: Avoid unnecessary file rewrites
  t6022: Additional tests checking for unnecessary updates of files
  merge-recursive: Fix spurious 'refusing to lose untracked file...' messages
  t6022: Add testcase for spurious "refusing to lose untracked" messages
  t3030: fix accidental success in symlink rename
  merge-recursive: Fix working copy handling for rename/rename/add/add
  merge-recursive: add handling for rename/rename/add-dest/add-dest
  merge-recursive: Have conflict_rename_delete reuse modify/delete code
  merge-recursive: Make modify/delete handling code reusable
  merge-recursive: Consider modifications in rename/rename(2to1) conflicts
  merge-recursive: Create function for merging with branchname:file markers
  merge-recursive: Record more data needed for merging with dual renames
  merge-recursive: Defer rename/rename(2to1) handling until process_entry
  merge-recursive: Small cleanups for conflict_rename_rename_1to2
  merge-recursive: Fix rename/rename(1to2) resolution for virtual merge base
  merge-recursive: Introduce a merge_file convenience function
  merge-recursive: Fix modify/delete resolution in the recursive case
  ...

13 years ago(short) documentation for the testgit remote helper
Matthieu Moy [Thu, 1 Sep 2011 16:49:38 +0000 (18:49 +0200)]
(short) documentation for the testgit remote helper

While it's not a command meant to be used by actual users (hence, not
mentionned in git(1)), this command is a very precious help for
remote-helpers authors.

The best place for such technical doc is the source code, but users may
not find it without a link in a manpage.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Acked-by: Sverre Rabbelier <srabbelier@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>