Code

git.git
14 years agoMerge branch 'js/detached-stash'
Junio C Hamano [Sat, 4 Sep 2010 05:45:58 +0000 (22:45 -0700)]
Merge branch 'js/detached-stash'

* js/detached-stash:
  t3903: fix broken test_must_fail calls
  detached-stash: update Documentation
  detached-stash: tests of git stash with stash-like arguments
  detached-stash: simplify git stash show
  detached-stash: simplify git stash branch
  detached-stash: refactor git stash pop implementation
  detached-stash: simplify stash_drop
  detached-stash: simplify stash_apply
  detached-stash: work around git rev-parse failure to detect bad log refs
  detached-stash: introduce parse_flags_and_revs function

14 years agoMerge branch 'js/maint-reflog-beyond-horizon'
Junio C Hamano [Sat, 4 Sep 2010 05:24:29 +0000 (22:24 -0700)]
Merge branch 'js/maint-reflog-beyond-horizon'

* js/maint-reflog-beyond-horizon:
  t1503: fix broken test_must_fail calls
  rev-parse: tests git rev-parse --verify master@{n}, for various n
  sha1_name.c: use warning in preference to fprintf(stderr
  rev-parse: exit with non-zero status if ref@{n} is not valid.

14 years agoMerge branch 'dg/local-mod-error-messages'
Junio C Hamano [Sat, 4 Sep 2010 05:23:49 +0000 (22:23 -0700)]
Merge branch 'dg/local-mod-error-messages'

* dg/local-mod-error-messages:
  t7609-merge-co-error-msgs: test non-fast forward case too.
  Move "show_all_errors = 1" to setup_unpack_trees_porcelain()
  setup_unpack_trees_porcelain: take the whole options struct as parameter
  Move set_porcelain_error_msgs to unpack-trees.c and rename it

Conflicts:
merge-recursive.c

14 years agoMerge branch 'nd/maint-fix-replace'
Junio C Hamano [Sat, 4 Sep 2010 05:23:13 +0000 (22:23 -0700)]
Merge branch 'nd/maint-fix-replace'

* nd/maint-fix-replace:
  parse_object: pass on the original sha1, not the replaced one

14 years agoparse_object: pass on the original sha1, not the replaced one
Nguyễn Thái Ngọc Duy [Fri, 3 Sep 2010 20:51:53 +0000 (22:51 +0200)]
parse_object: pass on the original sha1, not the replaced one

Commit 0e87c36 (object: call "check_sha1_signature" with the
replacement sha1) changed the first argument passed to
parse_object_buffer() from "sha1" to "repl". With that change,
the returned obj pointer has the replacement SHA1 in obj->sha1,
not the original one.

But when using lookup_commit() and then parse_commit() on a
commit, we get an object pointer with the original sha1, but
the commit content comes from the replacement commit.

So the result we get from using parse_object() is different
from the we get from using lookup_commit() followed by
parse_commit().

It looks much simpler and safer to fix this inconsistency by
passing "sha1" to parse_object_bufer() instead of "repl".

The commit comment should be used to tell the the replacement
commit is replacing another commit and why. So it should be
easy to see that we have a replacement commit instead of an
original one.

And it is not a problem if the content of the commit is not
consistent with the sha1 as cat-file piped to hash-object can
be used to see the difference.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoRE: [PATCH] Avoid rename/add conflict when contents are identical
Schalk, Ken [Wed, 1 Sep 2010 20:15:32 +0000 (13:15 -0700)]
RE: [PATCH] Avoid rename/add conflict when contents are identical

>Due to this this (and maybe all the tests) need to depend on the
>SYMLINKS prereq.

Here's a third attempt with no use of symlinks in the test:

Skip the entire rename/add conflict case if the file added on the
other branch has the same contents as the file being renamed.  This
avoids giving the user an extra copy of the same file and presenting a
conflict that is confusing and pointless.

A simple test of this case has been added in
t/t3030-merge-recursive.sh.

Signed-off-by: Ken Schalk <ken.schalk@intel.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMerge branch 'ab/compat-regex'
Junio C Hamano [Fri, 3 Sep 2010 16:43:45 +0000 (09:43 -0700)]
Merge branch 'ab/compat-regex'

* ab/compat-regex:
  Fix compat/regex ANSIfication on MinGW
  autoconf: regex library detection typofix
  autoconf: don't use platform regex if it lacks REG_STARTEND
  t/t7008-grep-binary.sh: un-TODO a test that needs REG_STARTEND
  compat/regex: get rid of old-style definition
  compat/regex: define out variables only used under RE_ENABLE_I18N
  Change regerror() declaration from K&R style to ANSI C (C89)
  compat/regex: get the gawk regex engine to compile within git
  compat/regex: use the regex engine from gawk for compat

Conflicts:
compat/regex/regex.c

14 years agoMerge branch 'nd/clone-depth-zero'
Junio C Hamano [Fri, 3 Sep 2010 16:43:45 +0000 (09:43 -0700)]
Merge branch 'nd/clone-depth-zero'

* nd/clone-depth-zero:
  clone: warn users --depth is ignored in local clones

14 years agoMerge branch 'jn/maint-doc-user-manual-html-doctype'
Junio C Hamano [Fri, 3 Sep 2010 16:43:44 +0000 (09:43 -0700)]
Merge branch 'jn/maint-doc-user-manual-html-doctype'

* jn/maint-doc-user-manual-html-doctype:
  docs: fix Makefile dependency for user manual
  Documentation: set a !DOCTYPE for user manual

14 years agoMerge branch 'cb/maint-mergetool-no-tty'
Junio C Hamano [Fri, 3 Sep 2010 16:43:44 +0000 (09:43 -0700)]
Merge branch 'cb/maint-mergetool-no-tty'

* cb/maint-mergetool-no-tty:
  mergetool: Remove explicit references to /dev/tty

Conflicts:
git-mergetool.sh

14 years agoMerge branch 'jn/apply-filename-with-sp'
Junio C Hamano [Fri, 3 Sep 2010 16:43:44 +0000 (09:43 -0700)]
Merge branch 'jn/apply-filename-with-sp'

* jn/apply-filename-with-sp:
  apply: handle traditional patches with space in filename
  tests: exercise "git apply" with weird filenames
  apply: split quoted filename handling into new function

14 years agoMerge branch 'jn/merge-custom-no-trivial'
Junio C Hamano [Fri, 3 Sep 2010 16:43:43 +0000 (09:43 -0700)]
Merge branch 'jn/merge-custom-no-trivial'

* jn/merge-custom-no-trivial:
  t7606: Avoid using head as a file name
  merge: let custom strategies intervene in trivial merges
  t7606 (merge-theirs): modernize style

14 years agoMerge branch 'jc/maint-doc-em-dash'
Junio C Hamano [Fri, 3 Sep 2010 16:43:42 +0000 (09:43 -0700)]
Merge branch 'jc/maint-doc-em-dash'

* jc/maint-doc-em-dash:
  Work around em-dash handling in newer AsciiDoc

14 years agoMerge branch 'mg/doc-bundle'
Junio C Hamano [Fri, 3 Sep 2010 16:43:42 +0000 (09:43 -0700)]
Merge branch 'mg/doc-bundle'

* mg/doc-bundle:
  git-bundle.txt: Clarify rev-list-args restrictions
  git-bundle.txt: whitespace cleanup
  git-bundle.txt: Cleanup

Conflicts:
Documentation/git-bundle.txt

14 years agoMerge branch 'jn/doc-backslash'
Junio C Hamano [Fri, 3 Sep 2010 16:43:42 +0000 (09:43 -0700)]
Merge branch 'jn/doc-backslash'

* jn/doc-backslash:
  Documentation: remove stray backslash in show-branch discussion
  Documentation: remove stray backslashes from "Fighting regressions" article
  Documentation: do not convert ... operator to ellipses
  Documentation: avoid stray backslash in user manual
  Documentation: avoid stray backslashes in core tutorial
  Documentation: remove stray backslashes in rev-parse manual
  Documentation: remove backslash before ~ in fast-import manual
  Documentation: remove stray backslash from "git bundle" manual
  Documentation/technical: avoid stray backslash in parse-options API docs
  Documentation: remove backslashes in manpage synopses
  Documentation: clarify quoting in gitignore docs
  Documentation: clarify quoting in "git rm" example
  Documentation: add missing quotes to "git grep" examples
  Documentation: clarify quoting in "git add" example
  Documentation: unbreak regex in show-ref manual
  Documentation: quoting trouble in "git rm" discussion
  Documentation: tweak description of log.date

14 years agoMerge branch 'jn/update-contrib-example-merge'
Junio C Hamano [Fri, 3 Sep 2010 16:43:42 +0000 (09:43 -0700)]
Merge branch 'jn/update-contrib-example-merge'

* jn/update-contrib-example-merge: (24 commits)
  merge script: learn --[no-]rerere-autoupdate
  merge script: notice @{-1} shorthand
  merge script: handle --no-ff --no-commit correctly
  merge script: --ff-only to disallow true merge
  merge script: handle many-way octopus
  merge script: handle -m --log correctly
  merge script: forbid merge -s index
  merge script: allow custom strategies
  merge script: merge -X<option>
  merge script: improve log message subject
  merge script: refuse to merge during merge
  merge script: tweak unmerged files message to match builtin
  merge script: --squash, --ff from unborn branch are errors
  fmt-merge-msg -m to override merge title
  merge-base --independent to print reduced parent list in a merge
  merge-base --octopus to mimic show-branch --merge-base
  Documentation: add a SEE ALSO section for merge-base
  t6200 (fmt-merge-msg): style nitpicks
  t6010 (merge-base): modernize style
  t7600 (merge): test merge from branch yet to be born
  ...

14 years agoMerge branch 'jn/merge-renormalize'
Junio C Hamano [Fri, 3 Sep 2010 16:43:41 +0000 (09:43 -0700)]
Merge branch 'jn/merge-renormalize'

* jn/merge-renormalize:
  merge-recursive --renormalize
  rerere: never renormalize
  rerere: migrate to parse-options API
  t4200 (rerere): modernize style
  ll-merge: let caller decide whether to renormalize
  ll-merge: make flag easier to populate
  Documentation/technical: document ll_merge
  merge-trees: let caller decide whether to renormalize
  merge-trees: push choice to renormalize away from low level
  t6038 (merge.renormalize): check that it can be turned off
  t6038 (merge.renormalize): try checkout -m and cherry-pick
  t6038 (merge.renormalize): style nitpicks
  Don't expand CRLFs when normalizing text during merge
  Try normalizing files to avoid delete/modify conflicts when merging
  Avoid conflicts when merging branches with mixed normalization

Conflicts:
builtin/rerere.c
t/t4200-rerere.sh

14 years agoSync with 1.7.2.3
Junio C Hamano [Fri, 3 Sep 2010 16:39:38 +0000 (09:39 -0700)]
Sync with 1.7.2.3

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoGit 1.7.2.3 v1.7.2.3
Junio C Hamano [Fri, 3 Sep 2010 16:38:53 +0000 (09:38 -0700)]
Git 1.7.2.3

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agobuiltin/merge_recursive.c: Add an usage string and make use of it.
Thiago Farina [Mon, 30 Aug 2010 03:30:22 +0000 (00:30 -0300)]
builtin/merge_recursive.c: Add an usage string and make use of it.

This improves the usage output by adding builtin_merge_recursive_usage string
that follows the same pattern used by the other builtin commands.

The previous output for git merger-recursive was:
usage: merge-recursive <base>... -- <head> <remote> ...

Now the output is:
usage: git merge-recursive <base>... -- <head> <remote> ...

Since cmd_merge_recursive is used to handle four different commands we need
the %s in the usage string, so the following example:

$ git merge-subtree -h

Will output:
usage: git merge-subtree <base>... -- <head> <remote> ...

Signed-off-by: Thiago Farina <tfransosi@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agot7406 & t7407: add missing && at end of lines
Jens Lehmann [Wed, 1 Sep 2010 21:28:27 +0000 (23:28 +0200)]
t7406 & t7407: add missing && at end of lines

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agot7405: cd inside subshell instead of around
Jens Lehmann [Wed, 1 Sep 2010 21:01:49 +0000 (23:01 +0200)]
t7405: cd inside subshell instead of around

Instead of using `cd dir && (...) && cd..` use `(cd dir && ...)`

This ensures that the test doesn't get caught in the subdirectory if there
is an error in the subshell.

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agot7609-merge-co-error-msgs: test non-fast forward case too.
Matthieu Moy [Fri, 3 Sep 2010 15:25:33 +0000 (17:25 +0200)]
t7609-merge-co-error-msgs: test non-fast forward case too.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMove "show_all_errors = 1" to setup_unpack_trees_porcelain()
Matthieu Moy [Thu, 2 Sep 2010 16:08:15 +0000 (18:08 +0200)]
Move "show_all_errors = 1" to setup_unpack_trees_porcelain()

Not only this makes the code clearer since setting up the porcelain error
message is meant to work with show_all_errors, but this fixes a call to
setup_unpack_trees_porcelain() in git_merge_trees() which did not set
show_all_errors.

add_rejected_path() used to double-check whether it was running in
plumbing mode. This check was ineffective since it was setting
show_all_errors too late for traverse_trees() to see it, and is made
useless by this patch. Remove it.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agosetup_unpack_trees_porcelain: take the whole options struct as parameter
Matthieu Moy [Thu, 2 Sep 2010 11:57:34 +0000 (13:57 +0200)]
setup_unpack_trees_porcelain: take the whole options struct as parameter

This is a preparation patch to let setup_unpack_trees_porcelain set
show_all_errors itself.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMove set_porcelain_error_msgs to unpack-trees.c and rename it
Matthieu Moy [Thu, 2 Sep 2010 11:57:33 +0000 (13:57 +0200)]
Move set_porcelain_error_msgs to unpack-trees.c and rename it

The function is currently dealing only with error messages, but the
intent of calling it is really to notify the unpack-tree mechanics that
it is running in porcelain mode.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoPrepare for 1.7.3
Junio C Hamano [Wed, 1 Sep 2010 21:17:32 +0000 (14:17 -0700)]
Prepare for 1.7.3

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMerge branch 'maint'
Junio C Hamano [Wed, 1 Sep 2010 22:10:18 +0000 (15:10 -0700)]
Merge branch 'maint'

* maint:
  Prepare for 1.7.2.3

14 years agoPrepare for 1.7.2.3
Junio C Hamano [Wed, 1 Sep 2010 21:15:35 +0000 (14:15 -0700)]
Prepare for 1.7.2.3

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMerge branch 'gp/pack-refs-remove-empty-dirs' into maint
Junio C Hamano [Wed, 1 Sep 2010 21:05:05 +0000 (14:05 -0700)]
Merge branch 'gp/pack-refs-remove-empty-dirs' into maint

* gp/pack-refs-remove-empty-dirs:
  pack-refs: remove newly empty directories

14 years agoMerge branch 'sg/rerere-gc-old-still-used' into maint
Junio C Hamano [Wed, 1 Sep 2010 20:57:23 +0000 (13:57 -0700)]
Merge branch 'sg/rerere-gc-old-still-used' into maint

* sg/rerere-gc-old-still-used:
  rerere: fix overeager gc
  mingw_utime(): handle NULL times parameter

14 years agoMerge branch 'np/maint-huge-delta-generation' into maint
Junio C Hamano [Wed, 1 Sep 2010 20:56:10 +0000 (13:56 -0700)]
Merge branch 'np/maint-huge-delta-generation' into maint

* np/maint-huge-delta-generation:
  fix >4GiB source delta assertion failure

14 years agoMerge branch 'dj/fetch-tagopt' into maint
Junio C Hamano [Wed, 1 Sep 2010 20:52:10 +0000 (13:52 -0700)]
Merge branch 'dj/fetch-tagopt' into maint

* dj/fetch-tagopt:
  fetch: allow command line --tags to override config

14 years agoMerge branch 'da/fix-submodule-sync-superproject-config' into maint
Junio C Hamano [Wed, 1 Sep 2010 20:50:46 +0000 (13:50 -0700)]
Merge branch 'da/fix-submodule-sync-superproject-config' into maint

* da/fix-submodule-sync-superproject-config:
  submodule sync: Update "submodule.<name>.url"

14 years agoMerge branch 'en/rebase-against-rebase-fix' into maint
Junio C Hamano [Wed, 1 Sep 2010 20:43:55 +0000 (13:43 -0700)]
Merge branch 'en/rebase-against-rebase-fix' into maint

* 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

14 years agoAdd global and system-wide gitattributes
Petr Onderka [Tue, 31 Aug 2010 22:42:43 +0000 (00:42 +0200)]
Add global and system-wide gitattributes

Allow gitattributes to be set globally and system wide. This way, settings
for particular file types can be set in one place and apply for all user's
repositories.

The location of system-wide attributes file is $(prefix)/etc/gitattributes.
The location of the global file can be configured by setting
core.attributesfile.

Some parts of the code were copied from the implementation of the same
functionality in config.c.

Signed-off-by: Petr Onderka <gsvick@gmail.com>
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoinstall-webdoc: filter timestamp-only changes correctly
Junio C Hamano [Wed, 1 Sep 2010 16:25:17 +0000 (09:25 -0700)]
install-webdoc: filter timestamp-only changes correctly

The timestamp that follows "Last updated " is formatted differently
depending on the version of AsciiDoc.  Looking at 4604fe56 on "html"
branch, you can see that AsciiDoc 7.0.2 used to give "02-Jul-2008 03:02:14
UTC" but AsciiDoc 8.2.5 gave "2008-09-19 06:33:25 UTC".  We haven't been
correctly filtering out phantom changes that result from only the build
date for some time now, it seems.

Just filter lines that begin with "Last updated ".

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agobuiltin.h: Move two functions definitions to help.h.
Thiago Farina [Wed, 1 Sep 2010 02:29:08 +0000 (23:29 -0300)]
builtin.h: Move two functions definitions to help.h.

The two functions defined here are implemented in help.c, so makes more sense
to put the definition of those in help.h instead of in builtin.h.

Signed-off-by: Thiago Farina <tfransosi@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMerge branch 'np/maint-huge-delta-generation'
Junio C Hamano [Tue, 31 Aug 2010 23:34:16 +0000 (16:34 -0700)]
Merge branch 'np/maint-huge-delta-generation'

* np/maint-huge-delta-generation:
  fix >4GiB source delta assertion failure

14 years agoMerge branch 'da/fix-submodule-sync-superproject-config'
Junio C Hamano [Tue, 31 Aug 2010 23:25:29 +0000 (16:25 -0700)]
Merge branch 'da/fix-submodule-sync-superproject-config'

* da/fix-submodule-sync-superproject-config:
  submodule sync: Update "submodule.<name>.url"

14 years agoMerge branch 'jn/cherry-revert-message-clean-up'
Junio C Hamano [Tue, 31 Aug 2010 23:25:11 +0000 (16:25 -0700)]
Merge branch 'jn/cherry-revert-message-clean-up'

* jn/cherry-revert-message-clean-up:
  tests: fix syntax error in "Use advise() for hints" test
  cherry-pick/revert: Use advise() for hints
  cherry-pick/revert: Use error() for failure message
  Introduce advise() to print hints
  Eliminate “Finished cherry-pick/revert” message
  t3508: add check_head_differs_from() helper function and use it
  revert: improve success message by adding abbreviated commit sha1
  revert: don't print "Finished one cherry-pick." if commit failed
  revert: refactor commit code into a new run_git_commit() function
  revert: report success when using option --strategy

14 years agoMerge branch 'cb/binary-patch-id'
Junio C Hamano [Tue, 31 Aug 2010 23:24:48 +0000 (16:24 -0700)]
Merge branch 'cb/binary-patch-id'

* cb/binary-patch-id:
  hash binary sha1 into patch id

14 years agoMerge branch 'ab/maint-reset-mixed-w-pathspec-advice'
Junio C Hamano [Tue, 31 Aug 2010 23:24:36 +0000 (16:24 -0700)]
Merge branch 'ab/maint-reset-mixed-w-pathspec-advice'

* ab/maint-reset-mixed-w-pathspec-advice:
  reset: suggest what to do upon "git reset --mixed <paths>"

14 years agoMerge branch 'dj/fetch-tagopt'
Junio C Hamano [Tue, 31 Aug 2010 23:24:24 +0000 (16:24 -0700)]
Merge branch 'dj/fetch-tagopt'

* dj/fetch-tagopt:
  fetch: allow command line --tags to override config

14 years agoMerge branch 'en/d-f-conflict-fix'
Junio C Hamano [Tue, 31 Aug 2010 23:23:58 +0000 (16:23 -0700)]
Merge branch 'en/d-f-conflict-fix'

* en/d-f-conflict-fix:
  merge-recursive: Avoid excessive output for and reprocessing of renames
  merge-recursive: Fix multiple file rename across D/F conflict
  t6031: Add a testcase covering multiple renames across a D/F conflict
  merge-recursive: Fix typo
  Mark tests that use symlinks as needing SYMLINKS prerequisite
  t/t6035-merge-dir-to-symlink.sh: Remove TODO on passing test
  fast-import: Improve robustness when D->F changes provided in wrong order
  fast-export: Fix output order of D/F changes
  merge_recursive: Fix renames across paths below D/F conflicts
  merge-recursive: Fix D/F conflicts
  Add a rename + D/F conflict testcase
  Add additional testcases for D/F conflicts

Conflicts:
merge-recursive.c

14 years agoMerge branch 'jn/svn-fe'
Junio C Hamano [Tue, 31 Aug 2010 23:23:38 +0000 (16:23 -0700)]
Merge branch 'jn/svn-fe'

* jn/svn-fe:
  t/t9010-svn-fe.sh: add an +x bit to this test
  t9010 (svn-fe): avoid symlinks in test
  t9010 (svn-fe): use Unix-style path in URI
  vcs-svn: Avoid %z in format string
  vcs-svn: Rename dirent pool to build on Windows
  compat: add strtok_r()
  treap: style fix
  vcs-svn: remove build artifacts on "make clean"
  svn-fe manual: Clarify warning about deltas in dump files
  Update svn-fe manual
  SVN dump parser
  Infrastructure to write revisions in fast-export format
  Add stream helper library
  Add string-specific memory pool
  Add treap implementation
  Add memory pool library
  Introduce vcs-svn lib

14 years agoMerge branch 'tr/maint-no-unquote-plus'
Junio C Hamano [Tue, 31 Aug 2010 23:23:35 +0000 (16:23 -0700)]
Merge branch 'tr/maint-no-unquote-plus'

* tr/maint-no-unquote-plus:
  Do not unquote + into ' ' in URLs

14 years agoMerge branch 'jn/paginate-fix'
Junio C Hamano [Tue, 31 Aug 2010 23:23:31 +0000 (16:23 -0700)]
Merge branch 'jn/paginate-fix'

* jn/paginate-fix:
  t7006 (pager): add missing TTY prerequisites
  merge-file: run setup_git_directory_gently() sooner
  var: run setup_git_directory_gently() sooner
  ls-remote: run setup_git_directory_gently() sooner
  index-pack: run setup_git_directory_gently() sooner
  config: run setup_git_directory_gently() sooner
  bundle: run setup_git_directory_gently() sooner
  apply: run setup_git_directory_gently() sooner
  grep: run setup_git_directory_gently() sooner
  shortlog: run setup_git_directory_gently() sooner
  git wrapper: allow setup_git_directory_gently() be called earlier
  setup: remember whether repository was found
  git wrapper: introduce startup_info struct

Conflicts:
builtin/index-pack.c

14 years agoMerge branch 'jn/maint-setup-fix'
Junio C Hamano [Tue, 31 Aug 2010 23:23:19 +0000 (16:23 -0700)]
Merge branch 'jn/maint-setup-fix'

* jn/maint-setup-fix:
  setup: split off a function to handle ordinary .git directories
  Revert "rehabilitate 'git index-pack' inside the object store"
  setup: do not forget working dir from subdir of gitdir
  t4111 (apply): refresh index before applying patches to it
  setup: split off get_device_or_die helper
  setup: split off a function to handle hitting ceiling in repo search
  setup: split off code to handle stumbling upon a repository
  setup: split off a function to checks working dir for .git file
  setup: split off $GIT_DIR-set case from setup_git_directory_gently
  tests: try git apply from subdir of toplevel
  t1501 (rev-parse): clarify

Conflicts:
builtin/index-pack.c

14 years agoMerge branch 'en/fast-export-fix'
Junio C Hamano [Tue, 31 Aug 2010 23:15:20 +0000 (16:15 -0700)]
Merge branch 'en/fast-export-fix'

* en/fast-export-fix:
  fast-export: Add a --full-tree option
  fast-export: Fix dropping of files with --import-marks and path limiting

14 years agoMerge branch 'hv/autosquash-config'
Junio C Hamano [Tue, 31 Aug 2010 23:15:03 +0000 (16:15 -0700)]
Merge branch 'hv/autosquash-config'

* hv/autosquash-config:
  add configuration variable for --autosquash option of interactive rebase

14 years agoMerge branch 'sg/rerere-gc-old-still-used'
Junio C Hamano [Tue, 31 Aug 2010 23:14:27 +0000 (16:14 -0700)]
Merge branch 'sg/rerere-gc-old-still-used'

* sg/rerere-gc-old-still-used:
  rerere: fix overeager gc
  mingw_utime(): handle NULL times parameter

14 years agodiff/log -G<pattern>: tests
Junio C Hamano [Tue, 31 Aug 2010 21:27:41 +0000 (14:27 -0700)]
diff/log -G<pattern>: tests

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agogit log/diff: add -G<regexp> that greps in the patch text
Junio C Hamano [Mon, 23 Aug 2010 17:17:03 +0000 (10:17 -0700)]
git log/diff: add -G<regexp> that greps in the patch text

Teach "-G<regexp>" that is similar to "-S<regexp> --pickaxe-regexp" to the
"git diff" family of commands.  This limits the diff queue to filepairs
whose patch text actually has an added or a deleted line that matches the
given regexp.  Unlike "-S<regexp>", changing other parts of the line that
has a substring that matches the given regexp IS counted as a change, as
such a change would appear as one deletion followed by one addition in a
patch text.

Unlike -S (pickaxe) that is intended to be used to quickly detect a commit
that changes the number of occurrences of hits between the preimage and
the postimage to serve as a part of larger toolchain, this is meant to be
used as the top-level Porcelain feature.

The implementation unfortunately has to run "diff" twice if you are
running "log" family of commands to produce patches in the final output
(e.g. "git log -p" or "git format-patch").  I think we _could_ cache the
result in-core if we wanted to, but that would require larger surgery to
the diffcore machinery (i.e. adding an extra pointer in the filepair
structure to keep a pointer to a strbuf around, stuff the textual diff to
the strbuf inside diffgrep_consume(), and make use of it in later stages
when it is available) and it may not be worth it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agodiff: pass the entire diff-options to diffcore_pickaxe()
Junio C Hamano [Tue, 31 Aug 2010 20:44:39 +0000 (13:44 -0700)]
diff: pass the entire diff-options to diffcore_pickaxe()

That would make it easier to give enhanced feature to the
pickaxe transformation.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agogitdiffcore doc: update pickaxe description
Junio C Hamano [Tue, 31 Aug 2010 21:16:39 +0000 (14:16 -0700)]
gitdiffcore doc: update pickaxe description

The old text described the original design (one side does not have it at
all while the other side has it); this was later amended to check if the
number of occurrences changed, which is what we currently do with -S.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agotests: factor HOME=$(pwd) in test-lib.sh
Matthieu Moy [Mon, 30 Aug 2010 09:50:42 +0000 (11:50 +0200)]
tests: factor HOME=$(pwd) in test-lib.sh

The same pattern is used in many tests, and makes it easy for new ones to
rely on $HOME being a trashable, clean, directory.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agotest-lib: use subshell instead of cd $new && .. && cd $old
Ævar Arnfjörð Bjarmason [Mon, 30 Aug 2010 12:00:42 +0000 (12:00 +0000)]
test-lib: use subshell instead of cd $new && .. && cd $old

Change the test_create_repo code added in v1.2.2~6 to use a subshell
instead of keeping track of the old working directory and cd-ing back
when it's done.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agotests: simplify "missing PREREQ" message
Jonathan Nieder [Tue, 24 Aug 2010 07:34:10 +0000 (02:34 -0500)]
tests: simplify "missing PREREQ" message

When a test has no prerequisites satisfied (the usual case), instead
of "missing THING of THING", just say "missing THING".  This does not
affect the output when a test is skipped due to a missing
prerequisites if another prerequisite is satisfied.

For example: instead of

 ok 8 # skip notes work (missing EXPENSIVE of EXPENSIVE)
 ok 9 # skip notes timing with /usr/bin/time (missing EXPENSIVE of USR_BIN_TIME,EXPENSIVE)

write

 ok 8 # skip notes work (missing EXPENSIVE)
 ok 9 # skip notes timing with /usr/bin/time (missing EXPENSIVE of USR_BIN_TIME,EXPENSIVE)

Cc: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agot/t0000-basic.sh: Run the passing TODO test inside its own test-lib
Ævar Arnfjörð Bjarmason [Thu, 19 Aug 2010 16:08:12 +0000 (16:08 +0000)]
t/t0000-basic.sh: Run the passing TODO test inside its own test-lib

Change the passing TODO test in t0000-basic.sh to run inside its own
test-lib.sh. The motivation is to have nothing out of the ordinary on
a normal test run for test smoking purposes.

If every normal test run has a passing TODO you're more likely to turn
a blind eye to it and not to investigate cases where things really are
passing unexpectedly.

It also makes the prove(1) output less noisy. Before:

    All tests successful.

    Test Summary Report
    -------------------
    ./t0000-basic.sh                                   (Wstat: 0 Tests: 46 Failed: 0)
      TODO passed:   5
    Files=484, Tests=6229, 143 wallclock secs ( 4.00 usr  4.15 sys + 104.77 cusr 351.57 csys = 464.49 CPU)
    Result: PASS

And after:

    All tests successful.
    Files=484, Tests=6228, 139 wallclock secs ( 4.07 usr  4.25 sys + 104.54 cusr 350.85 csys = 463.71 CPU)
    Result: PASS

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agotest-lib: Allow overriding of TEST_DIRECTORY
Ævar Arnfjörð Bjarmason [Thu, 19 Aug 2010 16:08:11 +0000 (16:08 +0000)]
test-lib: Allow overriding of TEST_DIRECTORY

Tests that test the test-lib.sh itself need to be executed in the
dynamically created trash directory, so we can't assume
$TEST_DIRECTORY is ../ for those.

As a side benefit this change also makes it easy for us to move the
t/*.sh tests into subdirectories if we ever want to do that.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agotest-lib: Use "$GIT_BUILD_DIR" instead of "$TEST_DIRECTORY"/../
Ævar Arnfjörð Bjarmason [Thu, 19 Aug 2010 16:08:10 +0000 (16:08 +0000)]
test-lib: Use "$GIT_BUILD_DIR" instead of "$TEST_DIRECTORY"/../

Change code that used $TEST_DIRECTORY/.. to use $GIT_BUILD_DIR
instead, the two are equivalent, but the latter is easier to read.

This required moving the assignment od GIT_BUILD_DIR to earlier in the
test-lib.sh file.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agotest-lib: Use $TEST_DIRECTORY or $GIT_BUILD_DIR instead of $(pwd) and ../
Ævar Arnfjörð Bjarmason [Thu, 19 Aug 2010 16:08:09 +0000 (16:08 +0000)]
test-lib: Use $TEST_DIRECTORY or $GIT_BUILD_DIR instead of $(pwd) and ../

Change the redundant calls to $(pwd) to use $TEST_DIRECTORY
instead. None of these were being executed after we cd'd somewhere
else so they weren't actually needed.

This also makes it easier to add support for overriding the test
library location and run tests in a different directory than t/.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agotest: Introduce $GIT_BUILD_DIR
Thomas Rast [Sun, 25 Jul 2010 14:55:46 +0000 (16:55 +0200)]
test: Introduce $GIT_BUILD_DIR

Introduce a new variable $GIT_BUILD_DIR which can be used to locate
data that resides under the build directory, and use that instead.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agotests: make test_might_fail fail on missing commands
Jonathan Nieder [Tue, 31 Aug 2010 17:26:57 +0000 (12:26 -0500)]
tests: make test_might_fail fail on missing commands

Detect and report hard-to-notice spelling mistakes like

 test_might_fail "git config --unset whatever"

(the extra quotes prevent the shell from running git as intended;
instead, the shell looks for a "git config --unset whatever" file).

Cc: Jeff King <peff@peff.net>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agotests: make test_might_fail more verbose
Jonathan Nieder [Tue, 31 Aug 2010 17:10:55 +0000 (12:10 -0500)]
tests: make test_might_fail more verbose

Let test_might_fail say something about its failures for consistency
with test_must_fail.

Cc: Jeff King <peff@peff.net>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agonotes: Don't create (empty) commit when removing non-existing notes
Johan Herland [Tue, 31 Aug 2010 15:56:50 +0000 (17:56 +0200)]
notes: Don't create (empty) commit when removing non-existing notes

Extend remove_note() in the notes API to return whether or not a note was
actually removed. Use this in 'git notes remove' to skip the creation of
a notes commit when no notes were actually removed.

Also add a test illustrating the change in behavior.

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoExtend documentation of core.askpass and GIT_ASKPASS.
Knut Franke [Mon, 30 Aug 2010 13:40:29 +0000 (15:40 +0200)]
Extend documentation of core.askpass and GIT_ASKPASS.

Signed-off-by: Knut Franke <k.franke@science-computing.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoAllow core.askpass to override SSH_ASKPASS.
Knut Franke [Mon, 30 Aug 2010 13:39:38 +0000 (15:39 +0200)]
Allow core.askpass to override SSH_ASKPASS.

Modify handling of the 'core.askpass' option so that it has the same effect as
GIT_ASKPASS also if SSH_ASKPASS is set.

Signed-off-by: Knut Franke <k.franke@science-computing.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoAdd a new option 'core.askpass'.
Anselm Kruis [Mon, 30 Aug 2010 13:38:38 +0000 (15:38 +0200)]
Add a new option 'core.askpass'.

Setting this option has the same effect as setting the environment variable
'GIT_ASKPASS'.

Signed-off-by: Knut Franke <k.franke@science-computing.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agotests: make test_must_fail fail on missing commands
Jeff King [Tue, 31 Aug 2010 15:56:53 +0000 (11:56 -0400)]
tests: make test_must_fail fail on missing commands

The point of it is to run a command that produces failure. A
missing command is more likely an error in the test script
(e.g., using 'test_must_fail "command with arguments"', or
relying on a missing command).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agotests: make test_must_fail more verbose
Jeff King [Tue, 31 Aug 2010 15:56:36 +0000 (11:56 -0400)]
tests: make test_must_fail more verbose

Because test_must_fail fails when a command succeeds, the
command frequently does not produce any output (since, after
all, it thought it was succeeding). So let's have
test_must_fail itself report that a problem occurred.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agogitweb: Don't die_error in git_tag after already printing headers
Anders Kaseorg [Fri, 27 Aug 2010 17:38:16 +0000 (13:38 -0400)]
gitweb: Don't die_error in git_tag after already printing headers

This fixes an XML error when visiting a nonexistent tag
(i.e. "../gitweb.cgi?p=git.git;a=tag;h=refs/tags/BADNAME").

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Acked-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agot3903: fix broken test_must_fail calls
Jon Seymour [Tue, 31 Aug 2010 14:49:20 +0000 (00:49 +1000)]
t3903: fix broken test_must_fail calls

Some tests in detached-stash are calling test_must_fail
in such a way that the arguments to test_must_fail do, indeed, fail
but not in the manner expected by the test.

This patch removes the unnecessary and unhelpful double quotes.

Signed-off-by: Jon Seymour <jon.seymour@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agot1503: fix broken test_must_fail calls
Jon Seymour [Tue, 31 Aug 2010 14:49:19 +0000 (00:49 +1000)]
t1503: fix broken test_must_fail calls

Some tests in maint-reflog-beyond-horizon are calling test_must_fail
in such a way that the arguments to test_must_fail do, indeed, fail
but not in the manner expected by the test.

This patch removes the unnecessary and unhelpful double quotes.

Signed-off-by: Jon Seymour <jon.seymour@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agocheckout: Use submodule.*.ignore settings from .git/config and .gitmodules
Jens Lehmann [Sat, 28 Aug 2010 14:50:07 +0000 (16:50 +0200)]
checkout: Use submodule.*.ignore settings from .git/config and .gitmodules

For "git status" and the diff family the submodule.*.ignore settings from
.git/config and .gitmodules can be used to override the default set via
diff.ignoreSubmodules on a per-submodule basis. Let's do this consistently
and teach checkout to use these settings too.

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agocheckout: Add test for diff.ignoreSubmodules
Jens Lehmann [Sat, 28 Aug 2010 14:49:25 +0000 (16:49 +0200)]
checkout: Add test for diff.ignoreSubmodules

While at it, document that checkout uses this flag too in the Documentation.

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMerge branch 'maint'
Junio C Hamano [Mon, 30 Aug 2010 06:37:02 +0000 (23:37 -0700)]
Merge branch 'maint'

* maint:
  t0003: add missing && at end of lines

14 years agoMerge branch 'maint-1.7.1' into maint
Junio C Hamano [Mon, 30 Aug 2010 06:36:57 +0000 (23:36 -0700)]
Merge branch 'maint-1.7.1' into maint

* maint-1.7.1:
  t0003: add missing && at end of lines

14 years agoobject.h: Add OBJECT_ARRAY_INIT macro and make use of it.
Thiago Farina [Sun, 29 Aug 2010 02:04:17 +0000 (23:04 -0300)]
object.h: Add OBJECT_ARRAY_INIT macro and make use of it.

Signed-off-by: Thiago Farina <tfransosi@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agot0003: add missing && at end of lines
Matthieu Moy [Sat, 28 Aug 2010 18:18:36 +0000 (20:18 +0200)]
t0003: add missing && at end of lines

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoformat-patch: Don't go over merge commits
Ramkumar Ramachandra [Fri, 27 Aug 2010 20:28:16 +0000 (01:58 +0530)]
format-patch: Don't go over merge commits

If the topmost three commits in a branch were merge commits, 'git
format-patch -3' used to output nothing. Since Git can't prepare
patches out of merge commits anyway, don't go over them in the first
place. 'git format-patch -3' now prepares three patches from the
topmost three commits without counting merge commits. Also add a
corresponding test in t4014-format-patch and update documentation.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agot4014-format-patch: Call test_tick before committing
Ramkumar Ramachandra [Fri, 27 Aug 2010 20:28:15 +0000 (01:58 +0530)]
t4014-format-patch: Call test_tick before committing

Call test_tick before attempting to commit in the setup routine to
preserve the order of the commits.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agofilter-branch: retire --remap-to-ancestor
Csaba Henk [Fri, 27 Aug 2010 20:44:56 +0000 (20:44 +0000)]
filter-branch: retire --remap-to-ancestor

We can be clever and know by ourselves when we need the behavior
implied by "--remap-to-ancestor". No need to encumber users by having
them exposed to it as a tunable. (Option kept for backward compatibility,
but it's now a no-op.)

Signed-off-by: Csaba Henk <csaba@gluster.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agobundle: detect if bundle file cannot be created
Csaba Henk [Fri, 27 Aug 2010 20:31:47 +0000 (20:31 +0000)]
bundle: detect if bundle file cannot be created

bundle command silently died with no sign of failure if it
could not create the bundle file. (Eg.: its path resovles to a directory,
or the parent dir is sticky while file already exists and is owned
by someone else.)

Signed-off-by: Csaba Henk <csaba@gluster.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoshell: Display errors from improperly-formatted command lines
Greg Brockman [Fri, 27 Aug 2010 05:36:13 +0000 (01:36 -0400)]
shell: Display errors from improperly-formatted command lines

The interface for split_cmdline has changed such that the caller holds
responsibility for printing any error messages.  This patch changes
the git shell to print these error messages as appropriate.

Signed-off-by: Greg Brockman <gdb@mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agomerge-recursive: options to ignore whitespace changes
Justin Frankel [Thu, 26 Aug 2010 05:51:47 +0000 (00:51 -0500)]
merge-recursive: options to ignore whitespace changes

Add support for merging with ignoring line endings (specifically
--ignore-space-at-eol) when using recursive merging.  This is
as a strategy-option, so that you can do:

git merge --strategy-option=ignore-space-at-eol <branch>

and

git rebase --strategy-option=ignore-space-at-eol <branch>

This can be useful for coping with line-ending damage (Xcode 3.1 has a
nasty habit of converting all CRLFs to LFs, and VC6 tends to just use
CRLFs for inserted lines).

The only option I need is ignore-space-at-eol, but while at it,
include the other xdiff whitespace options (ignore-space-change,
ignore-all-space), too.

[jn: with documentation]

Signed-off-by: Justin Frankel <justin@cockos.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMerge branch 'gb/split-cmdline-errmsg' into gb/shell-ext
Junio C Hamano [Fri, 27 Aug 2010 16:46:47 +0000 (09:46 -0700)]
Merge branch 'gb/split-cmdline-errmsg' into gb/shell-ext

* gb/split-cmdline-errmsg:
  split_cmdline: Allow caller to access error string

14 years agoMerge branch 'maint'
Junio C Hamano [Thu, 26 Aug 2010 23:42:59 +0000 (16:42 -0700)]
Merge branch 'maint'

* maint:
  for-each-ref: fix objectname:short bug
  tree-walk: Correct bitrotted comment about tree_entry()
  Fix 'git log' early pager startup error case

14 years agofor-each-ref: fix objectname:short bug
Jay Soffian [Thu, 26 Aug 2010 21:34:29 +0000 (17:34 -0400)]
for-each-ref: fix objectname:short bug

When objectname:short was introduced, it forgot to copy the result of
find_unique_abbrev. Because the result of find_unique_abbrev is a
pointer to static buffer, this resulted in the same value being
substituted in for each ref.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agodiff_tree(): Skip skip_uninteresting() when all remaining paths interesting
Elijah Newren [Thu, 26 Aug 2010 06:21:49 +0000 (00:21 -0600)]
diff_tree(): Skip skip_uninteresting() when all remaining paths interesting

In 1d848f6 (tree_entry_interesting(): allow it to say "everything is
interesting" 2007-03-21), both show_tree() and skip_uninteresting() were
modified to determine if all remaining tree entries were interesting.
However, the latter returns as soon as it finds the first interesting path,
without any way to signal to its caller (namely, diff_tree()) that all
remaining paths are interesting, making these extra checks useless.

Pass whether all remaining entries are interesting back to diff_tree(), and
whenever they are, have diff_tree() skip subsequent calls to
skip_uninteresting().

With this change, I measure speedups of 3-4% for the commands

  $ git rev-list --quiet HEAD -- Documentation/
  $ git rev-list --quiet HEAD -- t/

in git.git.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agotree_entry_interesting(): Make return value more specific
Elijah Newren [Thu, 26 Aug 2010 06:21:48 +0000 (00:21 -0600)]
tree_entry_interesting(): Make return value more specific

tree_entry_interesting() can signal to its callers not only if the given
entry matches one of the specified paths, but whether all remaining paths
will (or will not) match.  When no paths are specified, all paths are
considered interesting, so intead of returning 1 (this path is interesting)
return 2 (all paths are interesting).

This will allow the caller to avoid calling tree_entry_interesting() again,
which theoretically should speed up tree walking.  I am not able to measure
any actual gains in practice, but it certainly can not hurt and seems to
make the code more readable to me.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agotree-walk: Correct bitrotted comment about tree_entry()
Elijah Newren [Thu, 26 Aug 2010 06:21:47 +0000 (00:21 -0600)]
tree-walk: Correct bitrotted comment about tree_entry()

There was a code comment that referred to the "above two functions" but
over time the functions immediately preceding the comment have changed.
Just mention the relevant functions by name.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoDocument pre-condition for tree_entry_interesting
Elijah Newren [Thu, 26 Aug 2010 06:21:46 +0000 (00:21 -0600)]
Document pre-condition for tree_entry_interesting

tree_entry_interesting will fail to find appropriate matches if the base
directory path is not terminated with a slash.  Knowing this earlier would
have saved me some debugging time.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoFix compat/regex ANSIfication on MinGW
Johannes Sixt [Thu, 26 Aug 2010 07:58:26 +0000 (09:58 +0200)]
Fix compat/regex ANSIfication on MinGW

compat/regexec.c had a weird combination of function declaration in ANSI
style and function definition in K&R style, for example:

 static unsigned
 re_copy_regs (struct re_registers *regs, regmatch_t *pmatch,
      int nregs, int regs_allocated) internal_function;

 static unsigned
 re_copy_regs (regs, pmatch, nregs, regs_allocated)
     struct re_registers *regs;
     regmatch_t *pmatch;
     int nregs, regs_allocated;
 { ... }

with this #define:

 #ifndef _LIBC
 # ifdef __i386__
 #  define internal_function   __attribute ((regparm (3), stdcall))
 # else
 #  define internal_function
 # endif
 #endif

The original version as shown above was fine, but with the ANSIfied
function definition and in the case where internal_function is not empty,
gcc identifies the declaration and definition as different and bails out.

Adding internal_function to the definition doesn't help (it results in
a syntax error); hence, remove it from the subset of declarations that gcc
flags as erroneous.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agomerge-recursive --patience
Justin Frankel [Thu, 26 Aug 2010 05:50:45 +0000 (00:50 -0500)]
merge-recursive --patience

Teach the merge-recursive strategy a --patience option to use the
"patience diff" algorithm, which tends to improve results when
cherry-picking a patch that reorders functions at the same time as
refactoring them.

To support this, struct merge_options and ll_merge_options gain an
xdl_opts member, so programs can use arbitrary xdiff flags (think
"XDF_IGNORE_WHITESPACE") in a git-aware merge.

git merge and git rebase can be passed the -Xpatience option to
use this.

[jn: split from --ignore-space patch; with documentation]

Signed-off-by: Justin Frankel <justin@cockos.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoll-merge: replace flag argument with options struct
Jonathan Nieder [Thu, 26 Aug 2010 05:49:53 +0000 (00:49 -0500)]
ll-merge: replace flag argument with options struct

Keeping track of the flag bits is proving more trouble than it's
worth.  Instead, use a pointer to an options struct like most similar
APIs do.

Callers with no special requests can pass NULL to request the default
options.

Cc: Bert Wesarg <bert.wesarg@googlemail.com>
Cc: Avery Pennarun <apenwarr@gmail.com>
Helped-by: Justin Frankel <justin@cockos.com>
Helped-by: Bert Wesarg <bert.wesarg@googlemail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agomerge-recursive: expose merge options for builtin merge
Jonathan Nieder [Thu, 26 Aug 2010 05:47:58 +0000 (00:47 -0500)]
merge-recursive: expose merge options for builtin merge

There are two very similar blocks of code that recognize options for
the "recursive" merge strategy.  Unify them.

No functional change intended.

Cc: Avery Pennarun <apenwarr@gmail.com>
Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agotree-walk: Correct bitrotted comment about tree_entry()
Elijah Newren [Wed, 25 Aug 2010 02:53:11 +0000 (20:53 -0600)]
tree-walk: Correct bitrotted comment about tree_entry()

There was a code comment that referred to the "above two functions" but
over time the functions immediately preceding the comment have changed.
Just mention the relevant functions by name.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agobuiltin/fetch.c: ignore merge config when not fetching from branch's remote
Brandon Casey [Wed, 25 Aug 2010 17:52:56 +0000 (12:52 -0500)]
builtin/fetch.c: ignore merge config when not fetching from branch's remote

When 'git fetch' is supplied a single argument, it tries to match it
against a configured remote and then fetch the refs specified by the
named remote's fetchspec.  Additionally, or alternatively, if the current
branch has a merge ref configured, and if the name of the remote supplied
to fetch matches the one in the branch's configuration, then git also adds
the merge ref to the list of refs to update.

If the argument to fetch does not specify a named remote, or if the name
supplied does not match the remote configured for the current branch, then
the current branch's merge configuration should not be considered.

git currently mishandles the case when the argument to fetch specifies a
GIT URL(i.e. not a named remote) and the current branch has a configured
merge ref.  In this case, fetch should ignore the branch's merge ref and
attempt to fetch from the remote repository's HEAD branch.  But, since
fetch only checks _whether_ the current branch has a merge ref configured,
and does _not_ check whether the branch's configured remote matches the
command line argument (until later), it will mistakenly enter the wrong
branch of an 'if' statement and will not fall back to fetch the HEAD branch.
The fetch ends up doing nothing and returns with a successful zero status.

Fix this by comparing the remote repository's name to the branch's remote
name, in addition to whether it has a configured merge ref, sooner, so that
fetch can correctly decide whether the branch's configuration is interesting
or not, and fall back to fetching from the remote's HEAD branch when
appropriate.

This fixes the test in t5510.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>