Code

git.git
13 years agoMerge branch 'hv/submodule-find-ff-merge'
Junio C Hamano [Sun, 22 Aug 2010 06:27:59 +0000 (23:27 -0700)]
Merge branch 'hv/submodule-find-ff-merge'

* hv/submodule-find-ff-merge:
  Implement automatic fast-forward merge for submodules
  setup_revisions(): Allow walking history in a submodule
  Teach ref iteration module about submodules

Conflicts:
submodule.c

13 years agoMerge branch 'en/rebase-against-rebase-fix'
Junio C Hamano [Sun, 22 Aug 2010 06:27:29 +0000 (23:27 -0700)]
Merge branch 'en/rebase-against-rebase-fix'

* en/rebase-against-rebase-fix:
  pull --rebase: Avoid spurious conflicts and reapplying unnecessary patches
  t5520-pull: Add testcases showing spurious conflicts from git pull --rebase

13 years agoMerge branch 'dg/local-mod-error-messages'
Junio C Hamano [Sun, 22 Aug 2010 06:26:46 +0000 (23:26 -0700)]
Merge branch 'dg/local-mod-error-messages'

* dg/local-mod-error-messages:
  t7609: test merge and checkout error messages
  unpack_trees: group error messages by type
  merge-recursive: distinguish "removed" and "overwritten" messages
  merge-recursive: porcelain messages for checkout
  Turn unpack_trees_options.msgs into an array + enum

Conflicts:
t/t3400-rebase.sh

13 years agoMerge branch 'po/userdiff-csharp'
Junio C Hamano [Sun, 22 Aug 2010 06:20:51 +0000 (23:20 -0700)]
Merge branch 'po/userdiff-csharp'

* po/userdiff-csharp:
  Userdiff patterns for C#

13 years agoMerge branch 'ab/perl-install'
Junio C Hamano [Sun, 22 Aug 2010 06:20:31 +0000 (23:20 -0700)]
Merge branch 'ab/perl-install'

* ab/perl-install:
  perl/Makefile: Unset INSTALL_BASE when making perl.mak

13 years agoMerge branch 'maint'
Junio C Hamano [Sun, 22 Aug 2010 06:16:32 +0000 (23:16 -0700)]
Merge branch 'maint'

* maint:
  t7403: add missing &&'s
  Tell ignore file about generate files in /gitweb/static

13 years agot7403: add missing &&'s
Jens Lehmann [Wed, 18 Aug 2010 21:20:33 +0000 (23:20 +0200)]
t7403: add missing &&'s

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoTell ignore file about generate files in /gitweb/static
Mark Rada [Sat, 21 Aug 2010 16:18:37 +0000 (12:18 -0400)]
Tell ignore file about generate files in /gitweb/static

Signed-off-by: Mark Rada <marada@uwaterloo.ca>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'maint'
Junio C Hamano [Fri, 20 Aug 2010 19:55:41 +0000 (12:55 -0700)]
Merge branch 'maint'

* maint:
  xmalloc: include size in the failure message

13 years agoMerge branch 'jc/maint-follow-rename-fix' into maint
Junio C Hamano [Fri, 20 Aug 2010 19:53:09 +0000 (12:53 -0700)]
Merge branch 'jc/maint-follow-rename-fix' into maint

* jc/maint-follow-rename-fix:
  log: test for regression introduced in v1.7.2-rc0~103^2~2
  diff --follow: do call diffcore_std() as necessary
  diff --follow: do not waste cycles while recursing

13 years agoMerge branch 'jn/maint-plug-leak' into maint
Junio C Hamano [Fri, 20 Aug 2010 19:53:09 +0000 (12:53 -0700)]
Merge branch 'jn/maint-plug-leak' into maint

* jn/maint-plug-leak:
  write-tree: Avoid leak when index refers to an invalid object
  read-tree: stop leaking tree objects
  core: Stop leaking ondisk_cache_entrys

13 years agoMerge branch 'jn/fix-abbrev' into maint
Junio C Hamano [Fri, 20 Aug 2010 19:53:09 +0000 (12:53 -0700)]
Merge branch 'jn/fix-abbrev' into maint

* jn/fix-abbrev:
  examples/commit: use --abbrev for commit summary
  checkout, commit: remove confusing assignments to rev.abbrev
  archive: abbreviate substituted commit ids again

13 years agoMerge branch 'vs/doc-spell' into maint
Junio C Hamano [Fri, 20 Aug 2010 19:53:08 +0000 (12:53 -0700)]
Merge branch 'vs/doc-spell' into maint

* vs/doc-spell:
  Documentation: spelling fixes

13 years agoMerge branch 'jn/rebase-rename-am' into maint
Junio C Hamano [Fri, 20 Aug 2010 19:53:08 +0000 (12:53 -0700)]
Merge branch 'jn/rebase-rename-am' into maint

* jn/rebase-rename-am:
  rebase: protect against diff.renames configuration
  t3400 (rebase): whitespace cleanup
  Teach "apply --index-info" to handle rename patches
  t4150 (am): futureproof against failing tests
  t4150 (am): style fix

13 years agoMerge branch 'jn/doc-pull' into maint
Junio C Hamano [Fri, 20 Aug 2010 19:53:08 +0000 (12:53 -0700)]
Merge branch 'jn/doc-pull' into maint

* jn/doc-pull:
  Documentation: flesh out “git pull” description

13 years agoMerge branch 'bc/use-more-hardlinks-in-install' into maint
Junio C Hamano [Fri, 20 Aug 2010 19:53:07 +0000 (12:53 -0700)]
Merge branch 'bc/use-more-hardlinks-in-install' into maint

* bc/use-more-hardlinks-in-install:
  Makefile: make hard/symbolic links for non-builtins too
  Makefile: link builtins residing in bin directory to main git binary too

13 years agoMerge branch 'tr/rfc-reset-doc' into maint
Junio C Hamano [Fri, 20 Aug 2010 19:53:07 +0000 (12:53 -0700)]
Merge branch 'tr/rfc-reset-doc' into maint

* tr/rfc-reset-doc:
  Documentation/reset: move "undo permanently" example behind "make topic"
  Documentation/reset: reorder examples to match description
  Documentation/reset: promote 'examples' one section up
  Documentation/reset: separate options by mode
  Documentation/git-reset: reorder modes for soft-mixed-hard progression

13 years agobuiltin/checkout: Fix message when switching to an existing branch
Ramkumar Ramachandra [Fri, 20 Aug 2010 17:41:47 +0000 (23:11 +0530)]
builtin/checkout: Fix message when switching to an existing branch

Fix "Switched to a new branch <name>" to read "Switched to branch
<name>" when <name> corresponds to an existing branch. This bug was
introduced in 02ac983 while introducing the `-B` switch.

Cc: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoxmalloc: include size in the failure message
Matthieu Moy [Fri, 20 Aug 2010 15:09:51 +0000 (17:09 +0200)]
xmalloc: include size in the failure message

Out-of-memory errors can either be actual lack of memory, or bugs (like
code trying to call xmalloc(-1) by mistake). A little more information
may help tracking bugs reported by users.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'maint' to sync with 1.7.2.2
Junio C Hamano [Thu, 19 Aug 2010 23:04:41 +0000 (16:04 -0700)]
Merge branch 'maint' to sync with 1.7.2.2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoGit 1.7.2.2 v1.7.2.2
Junio C Hamano [Thu, 19 Aug 2010 23:03:18 +0000 (16:03 -0700)]
Git 1.7.2.2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'tr/xsize-bits' into maint
Junio C Hamano [Thu, 19 Aug 2010 22:49:54 +0000 (15:49 -0700)]
Merge branch 'tr/xsize-bits' into maint

* tr/xsize-bits:
  xsize_t: check whether we lose bits

13 years agoMerge branch 'jc/sha1-name-find-fix' into maint
Junio C Hamano [Thu, 19 Aug 2010 22:49:24 +0000 (15:49 -0700)]
Merge branch 'jc/sha1-name-find-fix' into maint

* jc/sha1-name-find-fix:
  sha1_name.c: fix parsing of ":/token" syntax

Conflicts:
sha1_name.c

13 years agot9155: fix compatibility with older SVN
Eric Wong [Thu, 19 Aug 2010 19:03:18 +0000 (12:03 -0700)]
t9155: fix compatibility with older SVN

The "--parents" option did not appear until SVN 1.5.x
and is completely unnecessary in this case.

Reported-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Eric Wong <normalperson@yhbt.net>
13 years agoMerge branch 'sp/fix-smart-http-deadlock-on-error' into maint
Junio C Hamano [Wed, 18 Aug 2010 23:30:11 +0000 (16:30 -0700)]
Merge branch 'sp/fix-smart-http-deadlock-on-error' into maint

* sp/fix-smart-http-deadlock-on-error:
  smart-http: Don't deadlock on server failure

13 years agoMerge branch 'jc/maint-follow-rename-fix'
Junio C Hamano [Wed, 18 Aug 2010 19:47:18 +0000 (12:47 -0700)]
Merge branch 'jc/maint-follow-rename-fix'

* jc/maint-follow-rename-fix:
  log: test for regression introduced in v1.7.2-rc0~103^2~2
  diff --follow: do call diffcore_std() as necessary
  diff --follow: do not waste cycles while recursing

13 years agoMerge branch 'tf/string-list-init'
Junio C Hamano [Wed, 18 Aug 2010 19:47:04 +0000 (12:47 -0700)]
Merge branch 'tf/string-list-init'

* tf/string-list-init:
  string_list: Add STRING_LIST_INIT macro and make use of it.

13 years agoMerge branch 'cc/find-commit-subject'
Junio C Hamano [Wed, 18 Aug 2010 19:46:55 +0000 (12:46 -0700)]
Merge branch 'cc/find-commit-subject'

* cc/find-commit-subject:
  blame: use find_commit_subject() instead of custom code
  merge-recursive: use find_commit_subject() instead of custom code
  bisect: use find_commit_subject() instead of custom code
  revert: rename variables related to subject in get_message()
  revert: refactor code to find commit subject in find_commit_subject()
  revert: fix off by one read when searching the end of a commit subject

13 years agoMerge branch 'jn/maint-plug-leak'
Junio C Hamano [Wed, 18 Aug 2010 19:37:09 +0000 (12:37 -0700)]
Merge branch 'jn/maint-plug-leak'

* jn/maint-plug-leak:
  write-tree: Avoid leak when index refers to an invalid object
  read-tree: stop leaking tree objects
  core: Stop leaking ondisk_cache_entrys

13 years agoMerge branch 'jl/submodule-ignore-diff'
Junio C Hamano [Wed, 18 Aug 2010 19:36:25 +0000 (12:36 -0700)]
Merge branch 'jl/submodule-ignore-diff'

* jl/submodule-ignore-diff:
  Add tests for the diff.ignoreSubmodules config option
  Add the 'diff.ignoreSubmodules' config setting
  Submodules: Use "ignore" settings from .gitmodules too for diff and status
  Submodules: Add the new "ignore" config option for diff and status

Conflicts:
diff.c

13 years agoMerge branch 'ml/rebase-x-strategy'
Junio C Hamano [Wed, 18 Aug 2010 19:29:47 +0000 (12:29 -0700)]
Merge branch 'ml/rebase-x-strategy'

* ml/rebase-x-strategy:
  rebase: support -X to pass through strategy options

13 years agoMerge branch 'jn/fix-abbrev'
Junio C Hamano [Wed, 18 Aug 2010 19:28:58 +0000 (12:28 -0700)]
Merge branch 'jn/fix-abbrev'

* jn/fix-abbrev:
  examples/commit: use --abbrev for commit summary
  checkout, commit: remove confusing assignments to rev.abbrev
  archive: abbreviate substituted commit ids again

13 years agoMerge branch 'vs/doc-spell'
Junio C Hamano [Wed, 18 Aug 2010 19:28:24 +0000 (12:28 -0700)]
Merge branch 'vs/doc-spell'

* vs/doc-spell:
  Documentation: spelling fixes

13 years agoMerge branch 'jh/use-test-must-fail'
Junio C Hamano [Wed, 18 Aug 2010 19:17:17 +0000 (12:17 -0700)]
Merge branch 'jh/use-test-must-fail'

* jh/use-test-must-fail:
  Convert "! git" to "test_must_fail git"

13 years agoMerge branch 'jh/clean-exclude'
Junio C Hamano [Wed, 18 Aug 2010 19:17:02 +0000 (12:17 -0700)]
Merge branch 'jh/clean-exclude'

* jh/clean-exclude:
  Add test for git clean -e.
  Add -e/--exclude to git-clean.

13 years agoMerge branch 'kf/post-receive-sample-hook'
Junio C Hamano [Wed, 18 Aug 2010 19:16:50 +0000 (12:16 -0700)]
Merge branch 'kf/post-receive-sample-hook'

* kf/post-receive-sample-hook:
  post-receive-email: optional message line count limit

13 years agoMerge branch 'ab/report-corrupt-object-with-type'
Junio C Hamano [Wed, 18 Aug 2010 19:16:41 +0000 (12:16 -0700)]
Merge branch 'ab/report-corrupt-object-with-type'

* ab/report-corrupt-object-with-type:
  sha1_file: Show the the type and path to corrupt objects

13 years agoMerge branch 'jn/rebase-rename-am'
Junio C Hamano [Wed, 18 Aug 2010 19:16:31 +0000 (12:16 -0700)]
Merge branch 'jn/rebase-rename-am'

* jn/rebase-rename-am:
  rebase: protect against diff.renames configuration
  t3400 (rebase): whitespace cleanup
  Teach "apply --index-info" to handle rename patches
  t4150 (am): futureproof against failing tests
  t4150 (am): style fix

13 years agoMerge branch 'jn/fast-import-subtree'
Junio C Hamano [Wed, 18 Aug 2010 19:14:41 +0000 (12:14 -0700)]
Merge branch 'jn/fast-import-subtree'

* jn/fast-import-subtree:
  Teach fast-import to import subtrees named by tree id

13 years agoMerge branch 'ar/string-list-foreach'
Junio C Hamano [Wed, 18 Aug 2010 19:14:38 +0000 (12:14 -0700)]
Merge branch 'ar/string-list-foreach'

* ar/string-list-foreach:
  Convert the users of for_each_string_list to for_each_string_list_item macro
  Add a for_each_string_list_item macro

13 years agoMerge branch 'jh/graph-next-line'
Junio C Hamano [Wed, 18 Aug 2010 19:14:32 +0000 (12:14 -0700)]
Merge branch 'jh/graph-next-line'

* jh/graph-next-line:
  Enable custom schemes for column colors in the graph API
  Make graph_next_line() available in the graph.h API

13 years agoMerge branch 'tr/xsize-bits'
Junio C Hamano [Wed, 18 Aug 2010 19:14:23 +0000 (12:14 -0700)]
Merge branch 'tr/xsize-bits'

* tr/xsize-bits:
  xsize_t: check whether we lose bits

13 years agoMerge branch 'tc/checkout-B'
Junio C Hamano [Wed, 18 Aug 2010 18:42:47 +0000 (11:42 -0700)]
Merge branch 'tc/checkout-B'

* tc/checkout-B:
  builtin/checkout: handle -B from detached HEAD correctly
  builtin/checkout: learn -B
  builtin/checkout: reword hint for -b
  add tests for checkout -b

13 years agomergetool: Skip autoresolved paths
David Aguilar [Tue, 17 Aug 2010 09:22:46 +0000 (02:22 -0700)]
mergetool: Skip autoresolved paths

When mergetool is run without path limiters it loops
over each entry in 'git ls-files -u'.  This includes
autoresolved paths.

Teach mergetool to only merge files listed in 'rerere status'
when rerere is enabled.

There are some subtle but harmless changes in behavior.
We now call cd_to_toplevel when no paths are given.
We do this because 'rerere status' paths are always relative
to the root.  This is beneficial for the non-rerere use as
well in that mergetool now runs against all unmerged files
regardless of the current directory.

This also slightly tweaks the output when run without paths
to be more readable.

The old output:

Merging the files: foo
bar
baz

The new output:

Merging:
foo
bar
baz

Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoUserdiff patterns for C#
Petr Onderka [Mon, 16 Aug 2010 17:01:02 +0000 (17:01 +0000)]
Userdiff patterns for C#

Add userdiff patterns for C#. This code is an improved version of
code by Adam Petaccia from 21 June 2009 mail to the list.

Signed-off-by: Petr Onderka <gsvick@gmail.com>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agolog: test for regression introduced in v1.7.2-rc0~103^2~2
Ævar Arnfjörð Bjarmason [Sun, 15 Aug 2010 10:16:25 +0000 (10:16 +0000)]
log: test for regression introduced in v1.7.2-rc0~103^2~2

Add a regression test for the git log -M --follow $diff_option bug
introduced in v1.7.2-rc0~103^2~2, $diff_option being diff related
options like -p, --stat, --name-only etc.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogit-svn: fix fetch with deleted tag
David D. Kilzer [Sun, 15 Aug 2010 13:15:55 +0000 (06:15 -0700)]
git-svn: fix fetch with deleted tag

Currently git-svn assumes that two tags created from the same
revision will have the same repo url, so it uses a ref to the
tag without checking that its url matches the current url.

This causes issues when fetching an svn repo where a tag was
created, deleted, and then recreated under the following
circumstances:

- Both tags were copied from the same revision.
- Both tags had the same name.
- Both tags had different repository paths.
- [Optional] Both tags have a file with the same name but
  different content.

When all four conditions are met, a checksum mismatch error
occurs because the content of two files with the same path
differs (see t/t9155--git-svn-fetch-deleted-tag.sh):

    Checksum mismatch: ChangeLog 065854....
    expected: ce771b....
         got: 9563fd....

When only the first three conditions are met, no error occurs
but the tag in git matches the first (deleted) tag instead of
the last (most recent) tag (see
t/t9156-git-svn-fetch-deleted-tag-2.sh).

The fix is to verify that the repo url for the ref matches the
current url.  If the urls do not match, then a "tail" is grown
on the tag name by appending a dash and rechecking the new ref's
repo url until either a matching repo url is found or a new tag
is created.

Signed-off-by: David D. Kilzer <ddkilzer@kilzer.net>
Acked-by: Eric Wong <normalperson@yhbt.net>
13 years agogit-svn: fix regex to remove "tail" from svn tags
David D. Kilzer [Sun, 15 Aug 2010 13:15:54 +0000 (06:15 -0700)]
git-svn: fix regex to remove "tail" from svn tags

Fix a regular expression used to remove the revision from the
end of an svn tag or branch name.  The regex did not account for
any "tail" (dashes) that may have been added to the end of the
tag name (which first appeared in v1.4.1-rc2~11).  If not fixed,
tags with names like "tags/mytag@5--@2" may be created.

Signed-off-by: David D. Kilzer <ddkilzer@kilzer.net>
Acked-by: Eric Wong <normalperson@yhbt.net>
13 years agodiff --follow: do call diffcore_std() as necessary
Junio C Hamano [Fri, 13 Aug 2010 19:17:45 +0000 (12:17 -0700)]
diff --follow: do call diffcore_std() as necessary

Usually, diff frontends populate the output queue with filepairs without
any rename information and call diffcore_std() to sort the renames out.
When --follow is in effect, however, diff-tree family of frontend has a
hack that looks like this:

    diff-tree frontend
    -> diff_tree_sha1()
       . populate diff_queued_diff
       . if --follow is in effect and there is only one change that
         creates the target path, then
       -> try_to_follow_renames()
  -> diff_tree_sha1() with no pathspec but with -C
  -> diffcore_std() to find renames
  . if rename is found, tweak diff_queued_diff and put a
    single filepair that records the found rename there
    -> diffcore_std()
       . tweak elements on diff_queued_diff by
       - rename detection
       - path ordering
       - pickaxe filtering

We need to skip parts of the second call to diffcore_std() that is related
to rename detection, and do so only when try_to_follow_renames() did find
a rename.  Earlier 1da6175 (Make diffcore_std only can run once before a
diff_flush, 2010-05-06) tried to deal with this issue incorrectly; it
unconditionally disabled any second call to diffcore_std().

This hopefully fixes the breakage.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agodiff --follow: do not waste cycles while recursing
Junio C Hamano [Fri, 13 Aug 2010 17:36:01 +0000 (10:36 -0700)]
diff --follow: do not waste cycles while recursing

The "--follow" logic is called from diff_tree_sha1() function, but the
input trees to diff_tree_sha1() are not necessarily the top-level trees
(compare_tree_entry() calls it while it recursively descends into
subtrees).  When a newly created path lives in somewhere deep in the
source hierarchy, e.g. "platform/", but the rename source is in a totally
different place in the destination hierarchy, e.g. "lang-api/src/com/...",
running "try_to_find_renames()" while base is set to "platform/" is a
wasted call.

We only need to run the rename following at the very top level.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoperl/Makefile: Unset INSTALL_BASE when making perl.mak
Ævar Arnfjörð Bjarmason [Tue, 3 Aug 2010 10:30:11 +0000 (10:30 +0000)]
perl/Makefile: Unset INSTALL_BASE when making perl.mak

PREFIX and INSTALL_BASE are mutually exclusive. If both are supplied
by INSTALL_BASE being set in PERL_MM_OPT ExtUtils::MakeMaker will
produce an error:

    $ echo $PERL_MM_OPT
    INSTALL_BASE=/home/avar/perl5
    $ make -C perl  PERL_PATH='/usr/bin/perl' prefix='/home/avar' perl.mak
    make: Entering directory `/home/avar/g/git/perl'
    /usr/bin/perl Makefile.PL PREFIX='/home/avar'
    Only one of PREFIX or INSTALL_BASE can be given.  Not both.
    make: *** [perl.mak] Error 255
    make: Leaving directory `/home/avar/g/git/perl'

Change the perl Makefile to work around this by explicitly unsetting
INSTALL_BASE.

INSTALL_BASE is set in PERL_MM_OPT by e.g. the popular local::lib
package, from its documentation:

    eval $(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib 2>/dev/null)

Many other environments might also have set PERL_MM_OPT before
building Git. This change enables us to build in these environments.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agopull --rebase: Avoid spurious conflicts and reapplying unnecessary patches
Elijah Newren [Fri, 13 Aug 2010 01:50:50 +0000 (19:50 -0600)]
pull --rebase: Avoid spurious conflicts and reapplying unnecessary patches

Prior to c85c792 (pull --rebase: be cleverer with rebased upstream
branches, 2008-01-26), pull --rebase would run

  git rebase $merge_head

which resulted in a call to

  git format-patch ... --ignore-if-in-upstream $merge_head..$cur_branch

This resulted in patches from $merge_head..$cur_branch being applied, as
long as they did not already exist in $cur_branch..$merge_head.

Unfortunately, when upstream is rebased, $merge_head..$cur_branch also
refers to "old" commits that have already been rebased upstream, meaning
that many patches that were already fixed upstream would be reapplied.
This could result in many spurious conflicts, as well as reintroduce
patches that were intentionally dropped upstream.

So the algorithm was changed in c85c792 (pull --rebase: be cleverer with
rebased upstream branches, 2008-01-26) and d44e712 (pull: support rebased
upstream + fetch + pull --rebase, 2009-07-19).  Defining $old_remote_ref to
be the most recent entry in the reflog for @{upstream} that is an ancestor
of $cur_branch, pull --rebase was changed to run

  git rebase --onto $merge_head $old_remote_ref

which results in a call to

  git format-patch ... --ignore-if-in-upstream $old_remote_ref..$cur_branch

The whole point of this change was to reduce the number of commits being
reapplied, by avoiding commits that upstream already has or had.

In the rebased upstream case, this change achieved that purpose.  It is
worth noting, though, that since $old_remote_ref is always an ancestor of
$cur_branch (by its definition), format-patch will not know what upstream
is and thus will not be able to determine if any patches are already
upstream; they will all be reapplied.

In the non-rebased upstream case, this new form is usually the same as the
original code but in some cases $old_remote_ref can be an ancestor of

   $(git merge-base $merge_head $cur_branch)

meaning that instead of avoiding reapplying commits that upstream already
has, it actually includes more such commits.  Combined with the fact that
format-patch can no longer detect commits that are already upstream (since
it is no longer told what upstream is), results in lots of confusion for
users (e.g. "git is giving me lots of conflicts in stuff I didn't even
change since my last push.")

Cases where additional commits could be reapplied include forking from a
commit other than the tracking branch, or amending/rebasing after pushing.
Cases where the inability to detect upstreamed commits cause problems
include independent discovery of a fix and having your patches get
upstreamed by some alternative route (e.g. pulling your changes to a third
machine, pushing from there, and then going back to your original machine
and trying to pull --rebase).

Fix the non-rebased upstream case by ignoring $old_remote_ref whenever it
is contained in $(git merge-base $merge_head $cur_branch).  This should
have no affect on the rebased upstream case.

Acked-by: Santi Béjar <santi@agolina.net>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agot5520-pull: Add testcases showing spurious conflicts from git pull --rebase
Elijah Newren [Fri, 13 Aug 2010 01:50:49 +0000 (19:50 -0600)]
t5520-pull: Add testcases showing spurious conflicts from git pull --rebase

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'jc/sha1-name-find-fix'
Junio C Hamano [Fri, 13 Aug 2010 01:32:49 +0000 (18:32 -0700)]
Merge branch 'jc/sha1-name-find-fix'

* jc/sha1-name-find-fix:
  sha1_name.c: fix parsing of ":/token" syntax

Conflicts:
sha1_name.c

13 years agoMerge branch 'jn/doc-pull'
Junio C Hamano [Fri, 13 Aug 2010 01:32:37 +0000 (18:32 -0700)]
Merge branch 'jn/doc-pull'

* jn/doc-pull:
  Documentation: flesh out “git pull” description

13 years agoMerge branch 'jn/maint-gitweb-dynconf'
Junio C Hamano [Fri, 13 Aug 2010 01:32:31 +0000 (18:32 -0700)]
Merge branch 'jn/maint-gitweb-dynconf'

* jn/maint-gitweb-dynconf:
  gitweb: allow configurations that change with each request

13 years agoMerge branch 'bc/use-more-hardlinks-in-install'
Junio C Hamano [Fri, 13 Aug 2010 01:32:20 +0000 (18:32 -0700)]
Merge branch 'bc/use-more-hardlinks-in-install'

* bc/use-more-hardlinks-in-install:
  Makefile: make hard/symbolic links for non-builtins too
  Makefile: link builtins residing in bin directory to main git binary too

13 years agoMerge branch 'tr/rfc-reset-doc'
Junio C Hamano [Fri, 13 Aug 2010 01:31:43 +0000 (18:31 -0700)]
Merge branch 'tr/rfc-reset-doc'

* tr/rfc-reset-doc:
  Documentation/reset: move "undo permanently" example behind "make topic"
  Documentation/reset: reorder examples to match description
  Documentation/reset: promote 'examples' one section up
  Documentation/reset: separate options by mode
  Documentation/git-reset: reorder modes for soft-mixed-hard progression

13 years agoMerge branch 'jn/parse-date-basic'
Junio C Hamano [Fri, 13 Aug 2010 01:31:03 +0000 (18:31 -0700)]
Merge branch 'jn/parse-date-basic'

* jn/parse-date-basic:
  Export parse_date_basic() to convert a date string to timestamp

13 years agoMerge branch 'sp/fix-smart-http-deadlock-on-error'
Junio C Hamano [Fri, 13 Aug 2010 01:27:01 +0000 (18:27 -0700)]
Merge branch 'sp/fix-smart-http-deadlock-on-error'

* sp/fix-smart-http-deadlock-on-error:
  smart-http: Don't deadlock on server failure

13 years agoMerge branch 'maint'
Junio C Hamano [Fri, 13 Aug 2010 01:07:09 +0000 (18:07 -0700)]
Merge branch 'maint'

* maint:
  push: mention "git pull" in error message for non-fast forwards
  Standardize do { ... } while (0) style
  t/t7003: replace \t with literal tab in sed expression
  index-pack: Don't follow replace refs.

13 years agopush: mention "git pull" in error message for non-fast forwards
Matthieu Moy [Mon, 2 Aug 2010 13:42:44 +0000 (15:42 +0200)]
push: mention "git pull" in error message for non-fast forwards

The message remains fuzzy to include "git pull", "git pull --rebase" and
others, but directs the user to the simplest solution in the vast
majority of cases.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoStandardize do { ... } while (0) style
Jonathan Nieder [Thu, 12 Aug 2010 22:11:15 +0000 (17:11 -0500)]
Standardize do { ... } while (0) style

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agot/t7003: replace \t with literal tab in sed expression
Brandon Casey [Thu, 12 Aug 2010 20:55:54 +0000 (15:55 -0500)]
t/t7003: replace \t with literal tab in sed expression

The sed utilities on IRIX and Solaris do not interpret the sequence '\t'
to mean a tab character;  they read a literal character 't'.  So, use a
literal tab instead.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoindex-pack: Don't follow replace refs.
Nelson Elhage [Thu, 12 Aug 2010 14:18:12 +0000 (10:18 -0400)]
index-pack: Don't follow replace refs.

Without this, attempting to index a pack containing objects that have been
replaced results in a fatal error that looks like:

fatal: SHA1 COLLISION FOUND WITH <replaced-object> !

Signed-off-by: Nelson Elhage <nelhage@ksplice.com>
Acked-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'maint'
Junio C Hamano [Wed, 11 Aug 2010 18:32:00 +0000 (11:32 -0700)]
Merge branch 'maint'

* maint:
  post-receive-email: remove spurious commas in email subject
  fast-import: export correctly marks larger than 2^20-1
  t/lib-git-svn.sh: use $PERL_PATH for perl, not perl from $PATH
  diff: strip extra "/" when stripping prefix

13 years agopost-receive-email: remove spurious commas in email subject
Matthieu Moy [Wed, 11 Aug 2010 08:14:13 +0000 (10:14 +0200)]
post-receive-email: remove spurious commas in email subject

The previous form produced subjects like

  [SCM] project.git branch, foo, updated. ...

The new one will produce the lighter

  [SCM] project.git branch foo updated. ...

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agofast-import: export correctly marks larger than 2^20-1
Raja R Harinath [Tue, 13 Jul 2010 11:51:48 +0000 (17:21 +0530)]
fast-import: export correctly marks larger than 2^20-1

dump_marks_helper() has a bug when dumping marks larger than 2^20-1,
i.e., when the sparse array has more than two levels.  The bug was
that the 'base' counter was being shifted by 20 bits at level 3, and
then again by 10 bits at level 2, rather than a total shift of 20 bits
in this argument to the recursive call:

  (base + k) << m->shift

There are two ways to fix this correctly, the elegant:

  (base + k) << 10

and the one I chose due to edit distance:

  base + (k << m->shift)

Signed-off-by: Raja R Harinath <harinath@hurrynot.org>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agot/lib-git-svn.sh: use $PERL_PATH for perl, not perl from $PATH
Ævar Arnfjörð Bjarmason [Tue, 10 Aug 2010 12:14:25 +0000 (12:14 +0000)]
t/lib-git-svn.sh: use $PERL_PATH for perl, not perl from $PATH

Change the git-svn tests to use $PERL_PATH, not the "perl" in $PATH.

Using perl in $PATH was added by Sam Vilain in v1.6.6-rc0~95^2~3,
Philippe Bruhat introduced $PERL_PATH to the test suite in
v1.6.6-rc0~9^2, but the lib-git-svn.sh tests weren't updated to use
the new convention.

This resulted in the git-svn tests always being skipped on my
system. My /usr/bin/perl has access to SVN::Core and SVN::Repos, but
the perl in my $PATH does not.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agot7609: test merge and checkout error messages
Diane Gasselin [Wed, 11 Aug 2010 08:38:08 +0000 (10:38 +0200)]
t7609: test merge and checkout error messages

Test porcelain and plumbing error messages for different types of errors
of merge and checkout.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agounpack_trees: group error messages by type
Matthieu Moy [Wed, 11 Aug 2010 08:38:07 +0000 (10:38 +0200)]
unpack_trees: group error messages by type

When an error is encountered, it calls add_rejected_file() which either
- directly displays the error message and stops if in plumbing mode
  (i.e. if show_all_errors is not initialized at 1)
- or stores it so that it will be displayed at the end with display_error_msgs(),

Storing the files by error type permits to have a list of files for
which there is the same error instead of having a serie of almost
identical errors.

As each bind_overlap error combines a file and an old file, a list cannot be
done, therefore, theses errors are not stored but directly displayed.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agomerge-recursive: distinguish "removed" and "overwritten" messages
Matthieu Moy [Wed, 11 Aug 2010 08:38:06 +0000 (10:38 +0200)]
merge-recursive: distinguish "removed" and "overwritten" messages

To limit the number of possible error messages, the error messages for
the case would_lose_untracked_file and would_lose_orphaned in
unpack_trees_options.msgs were handled with a single string,
parameterized by an action string ("overwritten" or "removed").

Instead, we consider them as two different cases, with unparameterized
string. This will make it easier to make separate lists sorted by error
types later.

Only the bind_overlap case still takes two %s parameters, but that's
unavoidable.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agomerge-recursive: porcelain messages for checkout
Diane Gasselin [Wed, 11 Aug 2010 08:38:05 +0000 (10:38 +0200)]
merge-recursive: porcelain messages for checkout

A porcelain message was first added in checkout.c in the commit
8ccba008 (Junio C Hamano, Sat May 17 21:03:49 2008, unpack-trees:
allow Porcelain to give different error messages) to give better feedback
in the case of merge errors.

This patch adapts the porcelain messages for the case of checkout
instead. This way, when having a checkout error, "merge" no longer
appears in the error message.

While we're there, we add an advice in the case of
would_lose_untracked_file.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoTurn unpack_trees_options.msgs into an array + enum
Matthieu Moy [Wed, 11 Aug 2010 08:38:04 +0000 (10:38 +0200)]
Turn unpack_trees_options.msgs into an array + enum

The list of error messages was introduced as a structure, but an array
indexed over an enum is more flexible, since it allows one to store a
type of error message (index in the array) in a variable.

This change needs to rename would_lose_untracked ->
would_lose_untracked_file to avoid a clash with the function
would_lose_untracked in merge-recursive.c.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agowrite-tree: Avoid leak when index refers to an invalid object
Jonathan Nieder [Tue, 10 Aug 2010 03:32:11 +0000 (22:32 -0500)]
write-tree: Avoid leak when index refers to an invalid object

Noticed by valgrind during test t0000.35 “writing this tree without
--missing-ok”.

Even in the cherry-pick foo..bar code path, such an error is the
end of the line.  But maybe some day an interactive porcelain will
want to link to libgit, making this matter.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoread-tree: stop leaking tree objects
Jonathan Nieder [Tue, 10 Aug 2010 03:33:44 +0000 (22:33 -0500)]
read-tree: stop leaking tree objects

The underlying problem is that the fill_tree_descriptor()
API is easy to misuse, and this patch does not fix that.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agocore: Stop leaking ondisk_cache_entrys
Jonathan Nieder [Tue, 10 Aug 2010 03:28:07 +0000 (22:28 -0500)]
core: Stop leaking ondisk_cache_entrys

Noticed with valgrind.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agodiff: strip extra "/" when stripping prefix
Jakub Narebski [Mon, 9 Aug 2010 14:50:53 +0000 (10:50 -0400)]
diff: strip extra "/" when stripping prefix

There are two ways a user might want to use "diff --relative":

  1. For a file in a directory, like "subdir/file", the user
     can use "--relative=subdir/" to strip the directory.

  2. To strip part of a filename, like "foo-10", they can
     use "--relative=foo-".

We currently handle both of those situations. However, if the user passes
"--relative=subdir" (without the trailing slash), we produce inconsistent
results. For the unified diff format, we collapse the double-slash of
"a//file" correctly into "a/file". But for other formats (raw, stat,
name-status), we end up with "/file".

We can do what the user means here and strip the extra "/" (and only a
slash).  We are not hurting any existing users of (2) above with this
behavior change because the existing output for this case was nonsensical.

Patch by Jakub, tests and commit message by Jeff King.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'maint'
Junio C Hamano [Mon, 9 Aug 2010 20:05:47 +0000 (13:05 -0700)]
Merge branch 'maint'

* maint:
  gitweb: clarify search results page when no matching commit found
  Documentation: add a FILES section for show-ref
  Makefile: add missing dependency on http.h
  Makefile: add missing dependencies on url.h
  Documentation/git-log: Clarify --full-diff
  git-rebase: fix typo when parsing --force-rebase
  imap-send: Fix sprintf usage
  prune: allow --dry-run for -n and --verbose for -v
  notes: allow --dry-run for -n and --verbose for -v
  Document -B<n>[/<m>], -M<n> and -C<n> variants of -B, -M and -C
  Documentation: cite git-am from git-apply
  t7003: fix subdirectory-filter test
  Allow "check-ref-format --branch" from subdirectory
  check-ref-format: handle subcommands in separate functions
  pretty-options.txt: match --format's documentation with implementation.

13 years agogitweb: clarify search results page when no matching commit found
Jonathan Nieder [Sat, 7 Aug 2010 21:56:47 +0000 (16:56 -0500)]
gitweb: clarify search results page when no matching commit found

When searching commits for a string that never occurs, the results
page looks something like this:

projects / foo.git / search                                 \o/
summary | ... | tree          [commit] search: [ kfjdkas ] [ ]re
first ⋅ prev ⋅ next

Merge branch 'maint'

Foo: a demonstration project

Without a list of hits to compare it to, the header describing the
commit named by the hash parameter (usually HEAD) may itself look
like a hit.  Add some text (“No match.”) to replace the empty
list of hits and avoid this confusion.

While at it, remove some nearby dead code, left behind from a
simplification a few years ago (v1.5.4-rc0~276^2~4, 2007-11-01).

Noticed-by: Erick Mattos <erick.mattos@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Acked-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agobuiltin/checkout: handle -B from detached HEAD correctly
Tay Ray Chuan [Mon, 9 Aug 2010 16:52:26 +0000 (00:52 +0800)]
builtin/checkout: handle -B from detached HEAD correctly

Ensure that strcmp() isn't called when head is null.

Previously we were getting segfaults when checkout -B was done from a
detached HEAD.

Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoDocumentation: add a FILES section for show-ref
Jonathan Nieder [Mon, 9 Aug 2010 01:32:43 +0000 (20:32 -0500)]
Documentation: add a FILES section for show-ref

A peek at where the refs are kept might help understanding, even if,
as the DESCRIPTION section suggests, direct access is not part of the
public API.

Balance that out with a pointer to update-ref.

Suggested-by: Geoff Russell <geoffrey.russell@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMakefile: add missing dependency on http.h
Jonathan Nieder [Sun, 8 Aug 2010 21:48:59 +0000 (16:48 -0500)]
Makefile: add missing dependency on http.h

v1.7.1-rc0~65^2~2 (http: init and cleanup separately from
http-walker, 2010-03-02) introduced a direct dependency from
http-fetch on the HTTP request library.  Declare it.

Detected with "make CHECK_HEADER_DEPENDENCIES=1".

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Acked-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMakefile: add missing dependencies on url.h
Jonathan Nieder [Sun, 8 Aug 2010 21:25:11 +0000 (16:25 -0500)]
Makefile: add missing dependencies on url.h

v1.7.2-rc0~56^2 and its parent (decode file:// and ssh://
URLs, 2010-05-23) introduced a new url library.  Update the
Makefile with the relevant dependencies.

Detected with "make CHECK_HEADER_DEPENDENCIES=1".

Cc: Jeff King <peff@peff.net>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoDocumentation/git-log: Clarify --full-diff
Michael J Gruber [Sun, 8 Aug 2010 15:31:34 +0000 (17:31 +0200)]
Documentation/git-log: Clarify --full-diff

The current description gives the impression that "--full-diff" affects
"log -p" only.

Make it clearer that it affects all diff-based output types.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogit-rebase: fix typo when parsing --force-rebase
Willy Tarreau [Sun, 8 Aug 2010 05:13:32 +0000 (07:13 +0200)]
git-rebase: fix typo when parsing --force-rebase

Due to two missing hyphens, The "force" keyword on the command line
would be taken as an alias for the --force-rebase option.

Signed-off-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoimap-send: Fix sprintf usage
Ævar Arnfjörð Bjarmason [Sat, 7 Aug 2010 23:09:45 +0000 (18:09 -0500)]
imap-send: Fix sprintf usage

When composing a command for the imap server, imap-send uses a single
nfsnprintf() invocation for brevity instead of dealing separately with
the case when there is a message to be sent and the case when there
isn’t.  The unused argument in the second case, while valid, is
confusing for static analyzers and human readers.

v1.6.4-rc0~117 (imap-send: add support for IPv6, 2009-05-25)
mistakenly used %hu as the format for an int “port”, by analogy with
existing usage for the unsigned short “addr.sin_port”.  Use %d
instead.

Noticed with clang.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoprune: allow --dry-run for -n and --verbose for -v
René Scharfe [Fri, 6 Aug 2010 20:28:05 +0000 (22:28 +0200)]
prune: allow --dry-run for -n and --verbose for -v

For consistency with other git commands, let git prune accept the long
options --dry-run and --verbose for the respective short ones -n and -v.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agonotes: allow --dry-run for -n and --verbose for -v
René Scharfe [Fri, 6 Aug 2010 20:28:09 +0000 (22:28 +0200)]
notes: allow --dry-run for -n and --verbose for -v

For consistency with other git commands, let the prune subcommand of
git notes accept the long options --dry-run and --verbose for the
respective short ones -n and -v.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'webrick' of git://git.bogomips.org/git-svn
Junio C Hamano [Mon, 9 Aug 2010 16:46:52 +0000 (09:46 -0700)]
Merge branch 'webrick' of git://git.bogomips.org/git-svn

* 'webrick' of git://git.bogomips.org/git-svn:
  instaweb: add access+error logging for WEBrick
  instaweb: minimize moving parts for WEBrick
  instaweb: fix WEBrick server support

13 years agoDocument -B<n>[/<m>], -M<n> and -C<n> variants of -B, -M and -C
Matthieu Moy [Thu, 5 Aug 2010 16:14:25 +0000 (18:14 +0200)]
Document -B<n>[/<m>], -M<n> and -C<n> variants of -B, -M and -C

These options take an optional argument, but this optional argument was
not documented.

Original patch by Matthieu Moy, but documentation for -B mostly copied
from the explanations of Junio C Hamano.

While we're there, fix a typo in a comment in diffcore.h.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoDocumentation: cite git-am from git-apply
Brad King [Tue, 3 Aug 2010 18:41:50 +0000 (14:41 -0400)]
Documentation: cite git-am from git-apply

Users reading git-apply documentation may also be interested in git-am,
especially after receiving an email created with git-format-patch.  The
documentation for git-am already references git-apply.  Add the reverse.

Signed-off-by: Brad King <brad.king@kitware.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agot7003: fix subdirectory-filter test
Thomas Rast [Thu, 29 Jul 2010 15:10:22 +0000 (17:10 +0200)]
t7003: fix subdirectory-filter test

The test would not fail if the filtering failed to do anything, since
in

  test -z "$(git diff HEAD directorymoved:newsubdir)"'

'directorymoved:newsubdir' is not valid, so git-diff fails without
printing anything on stdout.  But then the exit status of git-diff is
lost, whereas test -z "" succeeds.

Use 'git diff --exit-code' instead, which does the right thing and has
the added bonus of showing the differences if there are any.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoAdd tests for the diff.ignoreSubmodules config option
Jens Lehmann [Thu, 5 Aug 2010 23:27:15 +0000 (01:27 +0200)]
Add tests for the diff.ignoreSubmodules config option

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoAdd the 'diff.ignoreSubmodules' config setting
Johannes Schindelin [Thu, 5 Aug 2010 08:49:55 +0000 (10:49 +0200)]
Add the 'diff.ignoreSubmodules' config setting

When you have a lot of submodules checked out, the time penalty to check
for dirty submodules can easily imply a multiplication of the total time
by the factor 20. This makes the difference between almost instantaneous
(< 2 seconds) and unbearably slow (> 50 seconds) here, since the disk
caches are constantly overloaded.

To this end, the submodule.*.ignore config option was introduced, but it
is per-submodule.

This commit introduces a global config setting to set a default
(porcelain) value for the --ignore-submodules option, keeping the
default at 'none'. It can be overridden by the submodule.*.ignore
setting and by the --ignore-submodules option.

Incidentally, this commit fixes an issue with the overriding logic:
multiple --ignore-submodules options would not clear the previously
set flags.

While at it, fix a typo in the documentation for submodule.*.ignore.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoSubmodules: Use "ignore" settings from .gitmodules too for diff and status
Jens Lehmann [Thu, 5 Aug 2010 22:40:48 +0000 (00:40 +0200)]
Submodules: Use "ignore" settings from .gitmodules too for diff and status

The .gitmodules file is parsed for "submodule.<name>.ignore" entries
before looking for them in .git/config. Thus settings found in .git/config
will override those from .gitmodules, thereby allowing the local developer
to ignore settings given by the remote side while also letting upstream
set defaults for those users who don't have special needs.

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoSubmodules: Add the new "ignore" config option for diff and status
Jens Lehmann [Thu, 5 Aug 2010 22:39:25 +0000 (00:39 +0200)]
Submodules: Add the new "ignore" config option for diff and status

The new "ignore" config option controls the default behavior for "git
status" and the diff family. It specifies under what circumstances they
consider submodules as modified and can be set separately for each
submodule.

The command line option "--ignore-submodules=" has been extended to accept
the new parameter "none" for both status and diff.

Users that chose submodules to get rid of long work tree scanning times
might want to set the "dirty" option for those submodules. This brings
back the pre 1.7.0 behavior, where submodule work trees were never
scanned for modifications. By using "--ignore-submodules=none" on the
command line the status and diff commands can be told to do a full scan.

This option can be set to the following values (which have the same name
and meaning as for the "--ignore-submodules" option of status and diff):

"all": All changes to the submodule will be ignored.

"dirty": Only differences of the commit recorded in the superproject and
the submodules HEAD will be considered modifications, all changes
to the work tree of the submodule will be ignored. When using this
value, the submodule will not be scanned for work tree changes at
all, leading to a performance benefit on large submodules.

"untracked": Only untracked files in the submodules work tree are ignored,
a changed HEAD and/or modified files in the submodule will mark it
as modified.

"none" (which is the default): Either untracked or modified files in a
submodules work tree or a difference between the subdmodules HEAD
and the commit recorded in the superproject will make it show up
as changed. This value is added as a new parameter for the
"--ignore-submodules" option of the diff family and "git status"
so the user can override the settings in the configuration.

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agosmart-http: Don't deadlock on server failure
Shawn O. Pearce [Fri, 6 Aug 2010 21:19:44 +0000 (14:19 -0700)]
smart-http: Don't deadlock on server failure

If the remote HTTP server fails (e.g. returns 404 or 500) when we
posted the RPC to it, we won't have sent anything to the background
Git process that is supposed to handle the stream.  Because we
didn't send anything, its waiting for input from remote-curl, and
remote-curl cannot read its response payload because doing so would
lead to a deadlock.

Send the background task EOF on its input before we try to read
its response back, that way it will break out of its read loop
and terminate.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoAllow "check-ref-format --branch" from subdirectory
Jonathan Nieder [Fri, 6 Aug 2010 03:39:22 +0000 (22:39 -0500)]
Allow "check-ref-format --branch" from subdirectory

check-ref-format --branch requires access to the repository
to resolve refs like @{-1}.

Noticed by Nguyễn Thái Ngọc Duy.

Cc: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agocheck-ref-format: handle subcommands in separate functions
Jonathan Nieder [Fri, 6 Aug 2010 03:36:07 +0000 (22:36 -0500)]
check-ref-format: handle subcommands in separate functions

The code for each subcommand should be easier to read and manipulate
this way.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>