git/jnareb-git.git
11 years agoMerge branch 'kk/revwalk-slop-too-many-commit-within-a-second' into maint-1.8.1
Junio C Hamano [Wed, 3 Apr 2013 15:44:02 +0000 (3 08:44 -0700)]
Merge branch 'kk/revwalk-slop-too-many-commit-within-a-second' into maint-1.8.1

* kk/revwalk-slop-too-many-commit-within-a-second:
  Fix revision walk for commits with the same dates

11 years agoMerge branch 'jk/checkout-attribute-lookup' into maint-1.8.1
Junio C Hamano [Wed, 3 Apr 2013 15:43:40 +0000 (3 08:43 -0700)]
Merge branch 'jk/checkout-attribute-lookup' into maint-1.8.1

* jk/checkout-attribute-lookup:
  t2003: work around path mangling issue on Windows
  entry: fix filter lookup
  t2003: modernize style

11 years agoMerge branch 'jk/fully-peeled-packed-ref' into maint-1.8.1
Junio C Hamano [Wed, 3 Apr 2013 15:43:03 +0000 (3 08:43 -0700)]
Merge branch 'jk/fully-peeled-packed-ref' into maint-1.8.1

* jk/fully-peeled-packed-ref:
  pack-refs: add fully-peeled trait
  pack-refs: write peeled entry for non-tags
  use parse_object_or_die instead of die("bad object")
  avoid segfaults on parse_object failure

11 years agoMerge branch 'ap/maint-diff-rename-avoid-overlap' into maint-1.8.1
Junio C Hamano [Wed, 3 Apr 2013 15:37:39 +0000 (3 08:37 -0700)]
Merge branch 'ap/maint-diff-rename-avoid-overlap' into maint-1.8.1

* ap/maint-diff-rename-avoid-overlap:
  tests: make sure rename pretty print works
  diff: prevent pprint_rename from underrunning input
  diff: Fix rename pretty-print when suffix and prefix overlap

11 years agoMerge branch 'yd/doc-merge-annotated-tag' into maint-1.8.1
Junio C Hamano [Wed, 3 Apr 2013 15:36:52 +0000 (3 08:36 -0700)]
Merge branch 'yd/doc-merge-annotated-tag' into maint-1.8.1

* yd/doc-merge-annotated-tag:
  Documentation: merging a tag is a special case

11 years agoMerge branch 'ap/maint-update-index-h-is-for-help' into maint-1.8.1
Junio C Hamano [Wed, 3 Apr 2013 15:36:10 +0000 (3 08:36 -0700)]
Merge branch 'ap/maint-update-index-h-is-for-help' into maint-1.8.1

* ap/maint-update-index-h-is-for-help:
  update-index: allow "-h" to also display options

11 years agoMerge branch 'jc/perl-cat-blob' into maint-1.8.1
Junio C Hamano [Wed, 3 Apr 2013 15:35:45 +0000 (3 08:35 -0700)]
Merge branch 'jc/perl-cat-blob' into maint-1.8.1

* jc/perl-cat-blob:
  Git.pm: fix cat_blob crashes on large files

11 years agoMerge branch 'ob/imap-send-ssl-verify' into maint-1.8.1
Junio C Hamano [Wed, 3 Apr 2013 15:35:33 +0000 (3 08:35 -0700)]
Merge branch 'ob/imap-send-ssl-verify' into maint-1.8.1

* ob/imap-send-ssl-verify:
  imap-send: support Server Name Indication (RFC4366)

11 years agoMerge branch 'nd/index-pack-l10n-buf-overflow' into maint-1.8.1
Junio C Hamano [Wed, 3 Apr 2013 15:35:06 +0000 (3 08:35 -0700)]
Merge branch 'nd/index-pack-l10n-buf-overflow' into maint-1.8.1

* nd/index-pack-l10n-buf-overflow:
  index-pack: fix buffer overflow caused by translations

11 years agogit-tag(1): we tag HEAD by default
Thomas Rast [Wed, 3 Apr 2013 14:27:14 +0000 (3 16:27 +0200)]
git-tag(1): we tag HEAD by default

The <commit>|<object> argument is actually not explained anywhere
(except implicitly in the description of an unannotated tag).  Write a
little explanation, in particular to cover the default.

Signed-off-by: Thomas Rast <trast@inf.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agodoc: include --guide option description for "git help"
Philip Oakley [Tue, 2 Apr 2013 22:39:52 +0000 (2 23:39 +0100)]
doc: include --guide option description for "git help"

Note that the ability to display an individual guide was always
possible. Include this in the update.

Also tell readers how git(1) can be accessed, especially for Git for
Windows users who do not have the 'man' command.  Likewise include a
commentary on how to access this page (Catch 22).

Signed-off-by: Philip Oakley <philipoakley@iee.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agohelp: mention -a and -g option, and 'git help <concept>' usage.
Philip Oakley [Tue, 2 Apr 2013 22:39:48 +0000 (2 23:39 +0100)]
help: mention -a and -g option, and 'git help <concept>' usage.

Reword the overall help given at the end of "git help -a/-g" to
mention how to get help on individual commands and concepts.

Signed-off-by: Philip Oakley <philipoakley@iee.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agobuiltin/help.c: add list_common_guides_help() function
Philip Oakley [Tue, 2 Apr 2013 22:39:51 +0000 (2 23:39 +0100)]
builtin/help.c: add list_common_guides_help() function

This implements what "help -g" introduced in the previous step does.

Signed-off-by: Philip Oakley <philipoakley@iee.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agobuiltin/help.c: add --guide option
Philip Oakley [Tue, 2 Apr 2013 22:39:50 +0000 (2 23:39 +0100)]
builtin/help.c: add --guide option

Logic, but no actions, included.

The --all commands option, if given, will display the list of
available commands.

The --guide option's list of guides will then be displayed.

The common commands list is only displayed if neither option, nor a
command or guide name, is given.

Signed-off-by: Philip Oakley <philipoakley@iee.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agobuiltin/help.c: split "-a" processing into two
Philip Oakley [Tue, 2 Apr 2013 22:39:49 +0000 (2 23:39 +0100)]
builtin/help.c: split "-a" processing into two

"help -a" (help all) gives the list of available commands and then
further gives hints on the use of "git help".   Separate these into
two steps, because we will add "help -g" (help guides) that want to
also show the overall hints after it is done.

While at it, change the definition of the "-a" option to use OPT_BOOL,
not the deprecated OPT_BOOLEAN.  We do not behave differently when
the user gives the "-a" option multiple times, e.g. "git help -a -a".

Signed-off-by: Philip Oakley <philipoakley@iee.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agobranch: give advice when tracking start-point is missing
Jeff King [Tue, 2 Apr 2013 19:05:12 +0000 (2 15:05 -0400)]
branch: give advice when tracking start-point is missing

If the user requests to --set-upstream-to a branch that does
not exist, then either:

  1. It was a typo.

  2. They thought the branch should exist.

In case (1), there is not much we can do beyond showing the
name we tried to use. For case (2), though, we can help to
guide them through common workflows.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agobranch: mention start_name in set-upstream error messages
Jeff King [Tue, 2 Apr 2013 19:04:51 +0000 (2 15:04 -0400)]
branch: mention start_name in set-upstream error messages

If we refuse a branch operation because the tracking
start_name the user gave us is bogus, we just print
something like:

 fatal: Cannot setup tracking information; start point is not a branch

If we mention the actual name we tried to use, that may help
the user figure out why it didn't work (e.g., if they gave
us the arguments in the wrong order).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agobranch: improve error message for missing --set-upstream-to ref
Jeff King [Tue, 2 Apr 2013 19:04:27 +0000 (2 15:04 -0400)]
branch: improve error message for missing --set-upstream-to ref

If we are trying to set the upstream config for a branch,
the create_branch function will check both that the name
resolves as a ref, and that it is either a local or
remote-tracking branch.

However, before we do so we run get_sha1 on it to find out
whether it resolves at all (since the create_branch function
is also used to create actual branches, it wants to know
where to start the new branch). This means that if you feed
a ref that does not exist to "branch --set-upstream-to",
rather than getting a helpful message about tracking, you
only get "not a valid object name".

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agobranch: factor out "upstream is not a branch" error messages
Jeff King [Tue, 2 Apr 2013 19:03:55 +0000 (2 15:03 -0400)]
branch: factor out "upstream is not a branch" error messages

This message is duplicated, and is quite long. Let's factor
it out, which avoids the repetition and the long lines. It
will also make future patches easier as we tweak the
message.

While we're at it, let's also mark it for translation.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agot3200: test --set-upstream-to with bogus refs
Jeff King [Tue, 2 Apr 2013 19:02:53 +0000 (2 15:02 -0400)]
t3200: test --set-upstream-to with bogus refs

These tests pass with the current code, but let's make sure
we don't accidentally break the behavior in the future.

Note that our tests expect failure when we try to set the
upstream to or from a missing branch. Technically we are
just munging config here, so we do not need the refs to
exist. But seeing that they do exist is a good check that
the user has not made a typo.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoUpdate draft release notes to 1.8.3
Junio C Hamano [Tue, 2 Apr 2013 22:14:26 +0000 (2 15:14 -0700)]
Update draft release notes to 1.8.3

Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoMerge branch 'jk/config-with-empty-section'
Junio C Hamano [Tue, 2 Apr 2013 22:10:53 +0000 (2 15:10 -0700)]
Merge branch 'jk/config-with-empty-section'

Document that "git config --unset" does not remove an empty section
head after removing the last variable in a section, and adding a
new variable does not try to reuse a leftover empty section head.

* jk/config-with-empty-section:
  t1300: document some aesthetic failures of the config editor

11 years agoMerge branch 'js/log-gpg'
Junio C Hamano [Tue, 2 Apr 2013 22:10:49 +0000 (2 15:10 -0700)]
Merge branch 'js/log-gpg'

Teach "show/log" honor gpg.program configuration just like other
parts of the code that use GnuPG.

* js/log-gpg:
  log: read gpg settings for signed commit verification

11 years agoMerge branch 'tr/log-tree-optim'
Junio C Hamano [Tue, 2 Apr 2013 22:10:46 +0000 (2 15:10 -0700)]
Merge branch 'tr/log-tree-optim'

Optimize "log" that shows the difference between the parent and the
child.

* tr/log-tree-optim:
  Avoid loading commits twice in log with diffs

11 years agoMerge branch 'tb/cygwin-shared-repository'
Junio C Hamano [Tue, 2 Apr 2013 22:09:54 +0000 (2 15:09 -0700)]
Merge branch 'tb/cygwin-shared-repository'

Cygwin port has a faster-but-lying lstat(2) emulation whose
incorrectness does not matter in practice except for a few
codepaths, and setting permission bits to directories is a codepath
that needs to use a more correct one.

* tb/cygwin-shared-repository:
  Make core.sharedRepository work under cygwin 1.7

11 years agoMerge branch 'sw/safe-create-leading-dir-race'
Junio C Hamano [Tue, 2 Apr 2013 22:09:48 +0000 (2 15:09 -0700)]
Merge branch 'sw/safe-create-leading-dir-race'

* sw/safe-create-leading-dir-race:
  safe_create_leading_directories: fix race that could give a false negative

11 years agoMerge branch 'bk/document-commit-tree-S'
Junio C Hamano [Tue, 2 Apr 2013 22:09:43 +0000 (2 15:09 -0700)]
Merge branch 'bk/document-commit-tree-S'

* bk/document-commit-tree-S:
  commit-tree: document -S option consistently

11 years agoMerge branch 'jk/no-more-self-assignment'
Junio C Hamano [Tue, 2 Apr 2013 22:09:35 +0000 (2 15:09 -0700)]
Merge branch 'jk/no-more-self-assignment'

This started as a topic to reduce "type var = var" self assignment
tricks that were used to squelch "variable used uninitialized perhaps?"
warning from some compilers, but resulted in rewriting logic with
a version that is simpler and easier to understand for humans.

* jk/no-more-self-assignment:
  match-trees: simplify score_trees() using tree_entry()
  submodule: clarify logic in show_submodule_summary

11 years agostatus: show commit sha1 in "You are currently reverting" message
Matthieu Moy [Tue, 2 Apr 2013 14:20:22 +0000 (2 16:20 +0200)]
status: show commit sha1 in "You are currently reverting" message

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agostatus: show 'revert' state and status hint
Matthieu Moy [Tue, 2 Apr 2013 14:20:21 +0000 (2 16:20 +0200)]
status: show 'revert' state and status hint

This is the logical equivalent for "git status" of 3ee4452 (bash: teach
__git_ps1 about REVERT_HEAD).

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agofilter-branch: return to original dir after filtering
Jeff King [Tue, 2 Apr 2013 14:22:19 +0000 (2 10:22 -0400)]
filter-branch: return to original dir after filtering

The first thing filter-branch does is to create a temporary
directory, either ".git-rewrite" in the current directory
(which may be the working tree or the repository if bare),
or in a directory specified by "-d". We then chdir to
$tempdir/t as our temporary working directory in which to run
tree filters.

After finishing the filter, we then attempt to go back to
the original directory with "cd ../..". This works in the
.git-rewrite case, but if "-d" is used, we end up in a
random directory. The only thing we do after this chdir is
to run git-read-tree, but that means that:

  1. The working directory is not updated to reflect the
     filtered history.

  2. We dump random files into "$tempdir/.." (e.g., if you
     use "-d /tmp/foo", we dump junk into /tmp).

Fix it by recording the full path to the original directory
and returning there explicitly.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agorerere forget: grok files containing NUL
Johannes Sixt [Mon, 1 Apr 2013 21:36:36 +0000 (1 23:36 +0200)]
rerere forget: grok files containing NUL

Using 'git rerere forget .' after a merge that involved binary files
runs into an infinite loop if the binary file contains a zero byte.
Replace a strchrnul by memchr because the former does not make progress
as soon as the NUL is encountered.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoremote.c: introduce branch.<name>.pushremote
Ramkumar Ramachandra [Tue, 2 Apr 2013 07:40:34 +0000 (2 13:10 +0530)]
remote.c: introduce branch.<name>.pushremote

This new configuration variable overrides `remote.pushdefault` and
`branch.<name>.remote` for pushes.  When you pull from one
place (e.g. your upstream) and push to another place (e.g. your own
publishing repository), you would want to set `remote.pushdefault` to
specify the remote to push to for all branches, and use this option to
override it for a specific branch.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoremote.c: introduce remote.pushdefault
Ramkumar Ramachandra [Tue, 2 Apr 2013 07:40:33 +0000 (2 13:10 +0530)]
remote.c: introduce remote.pushdefault

This new configuration variable defines the default remote to push to,
and overrides `branch.<name>.remote` for all branches.  It is useful
in the typical triangular-workflow setup, where the remote you're
fetching from is different from the remote you're pushing to.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoremote.c: introduce a way to have different remotes for fetch/push
Ramkumar Ramachandra [Tue, 2 Apr 2013 07:40:32 +0000 (2 13:10 +0530)]
remote.c: introduce a way to have different remotes for fetch/push

Currently, do_push() in push.c calls remote_get(), which gets the
configured remote for fetching and pushing.  Replace this call with a
call to pushremote_get() instead, a new function that will return the
remote configured specifically for pushing.  This function tries to
work with the string pushremote_name, before falling back to the
codepath of remote_get().  This patch has no visible impact, but
serves to enable future patches to introduce configuration variables
to set pushremote_name.  For example, you can now do the following in
handle_config():

    if (!strcmp(key, "remote.pushdefault"))
       git_config_string(&pushremote_name, key, value);

Then, pushes will automatically go to the remote specified by
remote.pushdefault.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agot5516 (fetch-push): drop implicit arguments from helper functions
Jeff King [Tue, 2 Apr 2013 07:40:31 +0000 (2 13:10 +0530)]
t5516 (fetch-push): drop implicit arguments from helper functions

Many of the tests in t5516 look like:

  mk_empty &&
  git push testrepo ... &&
  check_push_result $commit heads/master

It's reasonably easy to see what is being tested, with the
exception that "testrepo" is a magic global name (it is
implicitly used in the helpers, but we have to name it
explicitly when calling git directly). Let's make it
explicit when call the helpers, too. This is slightly more
typing, but makes the test snippets read more naturally.

It also makes it easy for future tests to use an alternate
or multiple repositories, without a proliferation of helper
functions.

[rr: fixed sloppy quoting]

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agot5516 (fetch-push): update test description
Ramkumar Ramachandra [Tue, 2 Apr 2013 07:40:30 +0000 (2 13:10 +0530)]
t5516 (fetch-push): update test description

The file was originally created in bcdb34f (Test wildcard push/fetch,
2007-06-08), and only contained tests that exercised wildcard
functionality at the time.  In subsequent commits, many other tests
unrelated to wildcards were added but the test description was never
updated.  Fix this.

Helped-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoremote.c: simplify a bit of code using git_config_string()
Ramkumar Ramachandra [Tue, 2 Apr 2013 07:40:29 +0000 (2 13:10 +0530)]
remote.c: simplify a bit of code using git_config_string()

A small segment where handle_config() parses the branch.remote
configuration variable can be simplified using git_config_string().

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agorev-parse: clarify documentation for the --verify option
Michael Haggerty [Sat, 30 Mar 2013 06:44:25 +0000 (30 07:44 +0100)]
rev-parse: clarify documentation for the --verify option

The old version could be read to mean that the argument has to refer
to a valid object, but that is incorrect:

* the object is not necessarily read (e.g., to check for corruption)

* if the argument is a 40-digit string of hex digits, then it is
  accepted whether or not is is the name of an existing object.

So reword the explanation to be less ambiguous.

Also fix the examples involving --verify: to be sure that the argument
refers to a commit (rather than some other kind of object), the
argument has to be suffixed with "^{commit}".  This trick is not
possible in the example involving --default, so don't imply that it is
exactly the same as the previous example.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agosubmodule deinit: clarify work tree removal message
Jens Lehmann [Mon, 1 Apr 2013 19:02:00 +0000 (1 21:02 +0200)]
submodule deinit: clarify work tree removal message

The output of "git submodule deinit sub" of a populated submodule prints

  rm 'sub'

as the first line unless used with the -f option.

The "rm 'sub'" line is exactly the same output the user gets when using
"git rm sub" (because that command is used with the --dry-run option under
the hood to determine if the submodule is clean), which can easily lead to
the false impression that the submodule would be permanently removed. Also
users might be confused that the "rm 'submodule'" line won't show up when
the -f option is used, as the test is skipped in this case.

Silence the "rm 'submodule'" output by using the --quiet option for "git
rm" and always print

  Cleared directory 'submodule'

instead as the first output line. This line is printed as long as the
directory exists, no matter if empty or not.

Also extend the tests in t7400 to make sure the "Cleared directory" line
is printed correctly.

Reported-by: Phil Hord <phil.hord@gmail.com>
Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agot6200: test message for merging of an annotated tag
Junio C Hamano [Mon, 1 Apr 2013 19:51:50 +0000 (1 12:51 -0700)]
t6200: test message for merging of an annotated tag

Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agot6200: use test_config/test_unconfig
Junio C Hamano [Mon, 1 Apr 2013 19:33:52 +0000 (1 12:33 -0700)]
t6200: use test_config/test_unconfig

The tests were already well protected from previous ones by running
"git config --unset" on variables early they do not want to see, but
it is easier to make sure they start from a clean state by using
more modern test_config/test_unconfig helper functions.

It turns out that the last test depended on the merge.summary
configuration previous one leaves behind.  Set it explicitly in it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoUpdate draft release notes to 1.8.3
Junio C Hamano [Mon, 1 Apr 2013 16:13:31 +0000 (1 09:13 -0700)]
Update draft release notes to 1.8.3

Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoMerge branch 'maint'
Junio C Hamano [Mon, 1 Apr 2013 16:23:30 +0000 (1 09:23 -0700)]
Merge branch 'maint'

* maint:
  Update draft release notes to 1.8.2.1

11 years agoUpdate draft release notes to 1.8.2.1
Junio C Hamano [Mon, 1 Apr 2013 16:23:05 +0000 (1 09:23 -0700)]
Update draft release notes to 1.8.2.1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoMerge branch 'ap/maint-diff-rename-avoid-overlap' into maint
Junio C Hamano [Mon, 1 Apr 2013 16:19:46 +0000 (1 09:19 -0700)]
Merge branch 'ap/maint-diff-rename-avoid-overlap' into maint

* ap/maint-diff-rename-avoid-overlap:
  tests: make sure rename pretty print works
  diff: prevent pprint_rename from underrunning input
  diff: Fix rename pretty-print when suffix and prefix overlap

11 years agoMerge branch 'rr/tests-dedup-test-config' into maint
Junio C Hamano [Mon, 1 Apr 2013 16:19:41 +0000 (1 09:19 -0700)]
Merge branch 'rr/tests-dedup-test-config' into maint

* rr/tests-dedup-test-config:
  t4018,7810,7811: remove test_config() redefinition

11 years agoMerge branch 'yd/doc-is-in-asciidoc' into maint
Junio C Hamano [Mon, 1 Apr 2013 16:19:40 +0000 (1 09:19 -0700)]
Merge branch 'yd/doc-is-in-asciidoc' into maint

* yd/doc-is-in-asciidoc:
  CodingGuidelines: our documents are in AsciiDoc

11 years agoMerge branch 'yd/doc-merge-annotated-tag' into maint
Junio C Hamano [Mon, 1 Apr 2013 16:19:37 +0000 (1 09:19 -0700)]
Merge branch 'yd/doc-merge-annotated-tag' into maint

* yd/doc-merge-annotated-tag:
  Documentation: merging a tag is a special case

11 years agoMerge branch 'tb/document-status-u-tradeoff' into maint
Junio C Hamano [Mon, 1 Apr 2013 16:19:30 +0000 (1 09:19 -0700)]
Merge branch 'tb/document-status-u-tradeoff' into maint

* tb/document-status-u-tradeoff:
  status: advise to consider use of -u when read_directory takes too long
  git status: document trade-offs in choosing parameters to the -u option

11 years agoMerge branch 'da/downcase-u-in-usage' into maint
Junio C Hamano [Mon, 1 Apr 2013 16:19:04 +0000 (1 09:19 -0700)]
Merge branch 'da/downcase-u-in-usage' into maint

* da/downcase-u-in-usage:
  contrib/mw-to-git/t/install-wiki.sh: use a lowercase "usage:" string
  contrib/examples/git-remote.perl: use a lowercase "usage:" string
  tests: use a lowercase "usage:" string
  git-svn: use a lowercase "usage:" string
  Documentation/user-manual.txt: use a lowercase "usage:" string
  templates/hooks--update.sample: use a lowercase "usage:" string
  contrib/hooks/setgitperms.perl: use a lowercase "usage:" string
  contrib/examples: use a lowercase "usage:" string
  contrib/fast-import/import-zips.py: use spaces instead of tabs
  contrib/fast-import/import-zips.py: fix broken error message
  contrib/fast-import: use a lowercase "usage:" string
  contrib/credential: use a lowercase "usage:" string
  git-cvsimport: use a lowercase "usage:" string
  git-cvsimport: use a lowercase "usage:" string
  git-cvsexportcommit: use a lowercase "usage:" string
  git-archimport: use a lowercase "usage:" string
  git-merge-one-file: use a lowercase "usage:" string
  git-relink: use a lowercase "usage:" string
  git-svn: use a lowercase "usage:" string
  git-sh-setup: use a lowercase "usage:" string

11 years agoMerge branch 'nd/index-pack-threaded-fixes'
Junio C Hamano [Mon, 1 Apr 2013 16:06:23 +0000 (1 09:06 -0700)]
Merge branch 'nd/index-pack-threaded-fixes'

"index-pack --verify-stat" used a few counters outside protection
of mutex, possibly showing incorrect numbers.

* nd/index-pack-threaded-fixes:
  index-pack: guard nr_resolved_deltas reads by lock
  index-pack: protect deepest_delta in multithread code

11 years agoMerge branch 'jk/index-pack-correct-depth-fix'
Junio C Hamano [Mon, 1 Apr 2013 16:06:19 +0000 (1 09:06 -0700)]
Merge branch 'jk/index-pack-correct-depth-fix'

"index-pack --fix-thin" used uninitialize value to compute delta
depths of objects it appends to the resulting pack.

* jk/index-pack-correct-depth-fix:
  index-pack: always zero-initialize object_entry list

11 years agoMerge branch 'jn/push-tests'
Junio C Hamano [Mon, 1 Apr 2013 16:06:15 +0000 (1 09:06 -0700)]
Merge branch 'jn/push-tests'

Update t5516 with style fixes.

* jn/push-tests:
  push test: rely on &&-chaining instead of 'if bad; then echo Oops; fi'
  push test: simplify check of push result
  push test: use test_config when appropriate

11 years agoMerge branch 'nd/branch-show-rebase-bisect-state'
Junio C Hamano [Mon, 1 Apr 2013 16:05:45 +0000 (1 09:05 -0700)]
Merge branch 'nd/branch-show-rebase-bisect-state'

Add a bit more information to "git status" during a rebase/bisect
session.

* nd/branch-show-rebase-bisect-state:
  status, branch: fix the misleading "bisecting" message
  branch: show more information when HEAD is detached
  status: show more info than "currently not on any branch"
  wt-status: move wt_status_get_state() out to wt_status_print()
  wt-status: split wt_status_state parsing function out
  wt-status: move strbuf into read_and_strip_branch()

11 years agoMerge branch 'jc/nobody-sets-src-peer-ref'
Junio C Hamano [Mon, 1 Apr 2013 16:05:35 +0000 (1 09:05 -0700)]
Merge branch 'jc/nobody-sets-src-peer-ref'

Dead code removal.

* jc/nobody-sets-src-peer-ref:
  match_push_refs(): nobody sets src->peer_ref anymore

11 years agoMerge branch 'jc/remove-export-from-config-mak-in'
Junio C Hamano [Mon, 1 Apr 2013 16:00:01 +0000 (1 09:00 -0700)]
Merge branch 'jc/remove-export-from-config-mak-in'

Stop exporting mandir that used to be exported only when
config.mak.autogen was used.  It would have broken installation of
manpages (but not other documentation formats).

* jc/remove-export-from-config-mak-in:
  Fix `make install` when configured with autoconf
  Makefile: do not export mandir/htmldir/infodir
  config.mak.in: remove unused definitions

11 years agoMerge branch 'kb/name-hash'
Junio C Hamano [Mon, 1 Apr 2013 15:59:53 +0000 (1 08:59 -0700)]
Merge branch 'kb/name-hash'

The code to keep track of what directory names are known to Git on
platforms with case insensitive filesystems can get confused upon
a hash collision between these pathnames and looped forever.

* kb/name-hash:
  name-hash.c: fix endless loop with core.ignorecase=true

11 years agoMerge branch 'jk/common-make-variables-export-safety'
Junio C Hamano [Mon, 1 Apr 2013 15:59:47 +0000 (1 08:59 -0700)]
Merge branch 'jk/common-make-variables-export-safety'

Make the three variables safer to be exported to submakes by
ensuring that they are full paths so that they can be used as
installation location.

* jk/common-make-variables-export-safety:
  Makefile: make mandir, htmldir and infodir absolute

11 years agoMerge branch 'jk/pkt-line-cleanup'
Junio C Hamano [Mon, 1 Apr 2013 15:59:37 +0000 (1 08:59 -0700)]
Merge branch 'jk/pkt-line-cleanup'

Clean up pkt-line API, implementation and its callers to make them
more robust.

* jk/pkt-line-cleanup:
  do not use GIT_TRACE_PACKET=3 in tests
  remote-curl: always parse incoming refs
  remote-curl: move ref-parsing code up in file
  remote-curl: pass buffer straight to get_remote_heads
  teach get_remote_heads to read from a memory buffer
  pkt-line: share buffer/descriptor reading implementation
  pkt-line: provide a LARGE_PACKET_MAX static buffer
  pkt-line: move LARGE_PACKET_MAX definition from sideband
  pkt-line: teach packet_read_line to chomp newlines
  pkt-line: provide a generic reading function with options
  pkt-line: drop safe_write function
  pkt-line: move a misplaced comment
  write_or_die: raise SIGPIPE when we get EPIPE
  upload-archive: use argv_array to store client arguments
  upload-archive: do not copy repo name
  send-pack: prefer prefixcmp over memcmp in receive_status
  fetch-pack: fix out-of-bounds buffer offset in get_ack
  upload-pack: remove packet debugging harness
  upload-pack: do not add duplicate objects to shallow list
  upload-pack: use get_sha1_hex to parse "shallow" lines

11 years agoMerge branch 'bc/append-signed-off-by'
Junio C Hamano [Mon, 1 Apr 2013 15:59:23 +0000 (1 08:59 -0700)]
Merge branch 'bc/append-signed-off-by'

Consolidate codepaths that inspect log-message-to-be and decide to
add a new Signed-off-by line in various commands.

* bc/append-signed-off-by:
  git-commit: populate the edit buffer with 2 blank lines before s-o-b
  Unify appending signoff in format-patch, commit and sequencer
  format-patch: update append_signoff prototype
  t4014: more tests about appending s-o-b lines
  sequencer.c: teach append_signoff to avoid adding a duplicate newline
  sequencer.c: teach append_signoff how to detect duplicate s-o-b
  sequencer.c: always separate "(cherry picked from" from commit body
  sequencer.c: require a conforming footer to be preceded by a blank line
  sequencer.c: recognize "(cherry picked from ..." as part of s-o-b footer
  t/t3511: add some tests of 'cherry-pick -s' functionality
  t/test-lib-functions.sh: allow to specify the tag name to test_commit
  commit, cherry-pick -s: remove broken support for multiline rfc2822 fields
  sequencer.c: rework search for start of footer to improve clarity

11 years agoMerge branch 'sr/am-show-final-message-in-applying-indicator'
Junio C Hamano [Mon, 1 Apr 2013 15:59:18 +0000 (1 08:59 -0700)]
Merge branch 'sr/am-show-final-message-in-applying-indicator'

In addition to the case where the user edits the log message with
the "e)dit" option of "am -i", replace the "Applying: this patch"
message with the final log message contents after applymsg hook
munges it.

* sr/am-show-final-message-in-applying-indicator:
  git-am: show the final log message on "Applying:" indicator

11 years agoMerge branch 'rr/test-3200-style'
Junio C Hamano [Mon, 1 Apr 2013 15:59:14 +0000 (1 08:59 -0700)]
Merge branch 'rr/test-3200-style'

Churns.

* rr/test-3200-style:
  t3200 (branch): modernize style

11 years agotests: notice valgrind error in test_must_fail
Thomas Rast [Sun, 31 Mar 2013 08:37:25 +0000 (31 10:37 +0200)]
tests: notice valgrind error in test_must_fail

We tell valgrind to return 126 if it notices that something is wrong,
but we did not actually handle this in test_must_fail, leading to
false negatives.  Catch and report it.

Signed-off-by: Thomas Rast <trast@inf.ethz.ch>
Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agotests --valgrind: provide a mode without --track-origins
Thomas Rast [Sun, 31 Mar 2013 08:00:17 +0000 (31 10:00 +0200)]
tests --valgrind: provide a mode without --track-origins

With --valgrind=memcheck-fast, the tests run under memcheck but
without the autodetected --track-origins.  If you just run valgrind to
see *if* there is any memory issue with your program, the extra
information is not needed, and it comes at a roughly 30% hit in
runtime.

While it is possible to achieve the same through GIT_VALGRIND_OPTIONS,
this should be more discoverable and hopefully encourage more users to
run their tests with valgrind.

Signed-off-by: Thomas Rast <trast@inf.ethz.ch>
Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agotests: parameterize --valgrind option
Thomas Rast [Sun, 31 Mar 2013 08:00:16 +0000 (31 10:00 +0200)]
tests: parameterize --valgrind option

Running tests under helgrind and DRD recently proved useful in
tracking down thread interaction issues.  This can unfortunately not
be done through GIT_VALGRIND_OPTIONS because any tool other than
memcheck would complain about unknown options.

Let --valgrind take an optional parameter that describes the valgrind
tool to invoke.  The default mode is to run memcheck as before.

Signed-off-by: Thomas Rast <trast@inf.ethz.ch>
Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agot/README: --valgrind already implies -v
Thomas Rast [Sun, 31 Mar 2013 08:00:15 +0000 (31 10:00 +0200)]
t/README: --valgrind already implies -v

This was missed in 3da9365 (Tests: let --valgrind imply --verbose and
--tee, 2009-02-04).

Signed-off-by: Thomas Rast <trast@inf.ethz.ch>
Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agosubmodule summary: support --summary-limit=<n>
René Scharfe [Mon, 1 Apr 2013 13:06:27 +0000 (1 15:06 +0200)]
submodule summary: support --summary-limit=<n>

In addition to "--summary-limit <n>" support the form "--summary-limit=<n>",
for consistency with other parameters and commands.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agopretty printing: extend %G? to include 'N' and 'U'
Sebastian Götte [Sun, 31 Mar 2013 16:03:22 +0000 (31 18:03 +0200)]
pretty printing: extend %G? to include 'N' and 'U'

Expand %G? in pretty format strings to 'N' in case of no GPG signature
and 'U' in case of a good but untrusted GPG signature in addition to
the previous 'G'ood and 'B'ad. This eases writing anyting parsing
git-log output.

Signed-off-by: Sebastian Götte <jaseg@physik-pool.tu-berlin.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agomerge/pull Check for untrusted good GPG signatures
Sebastian Götte [Sun, 31 Mar 2013 16:02:46 +0000 (31 18:02 +0200)]
merge/pull Check for untrusted good GPG signatures

When --verify-signatures is specified, abort the merge in case a good
GPG signature from an untrusted key is encountered.

Signed-off-by: Sebastian Götte <jaseg@physik-pool.tu-berlin.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agosend-email: use the three-arg form of open in recipients_cmd
Ramkumar Ramachandra [Mon, 1 Apr 2013 01:40:42 +0000 (31 18:40 -0700)]
send-email: use the three-arg form of open in recipients_cmd

Perlcritic does not want to see the trailing pipe in the two-args
form of open(), i.e.

open my $fh, "$cmd \Q$file\E |";

If $cmd were a single-token command name, it would make a lot more
sense to use four-or-more-args form "open FILEHANDLE,MODE,CMD,ARGS"
to avoid shell from expanding metacharacters in $file, but we do
expect multi-word string in $to_cmd and $cc_cmd to be expanded by
the shell, so we cannot rewrite it to

open my $fh, "-|", $cmd, $file;

for extra safety.  At least, by using this in the three-arg form:

open my $fh, "-|", "$cmd \Q$file\E";

we can silence Perlcritic, even though we do not gain much safety by
doing so.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agosend-email: drop misleading function prototype
Ramkumar Ramachandra [Mon, 1 Apr 2013 01:40:41 +0000 (31 18:40 -0700)]
send-email: drop misleading function prototype

The subroutine check_file_rev_conflict() is called from two places,
both of which expects to pass a single scalar variable and see if
that can be interpreted as a pathname or a revision name.  It is
defined with a function prototype ($) to force a scalar context
while evaluating the arguments at the calling site but it does not
help the current calling sites.  The only effect it has is to hurt
future calling sites that may want to build an argument list in an
array variable and call it as check_file_rev_confict(@args).

Drop the misleading prototype, as Perlcritic suggests.

While at it, rename the function to avoid new call sites unaware of
this change arising and add a comment clarifying what this function
is for.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agosend-email: use "return;" not "return undef;" on error codepaths
Ramkumar Ramachandra [Mon, 1 Apr 2013 01:40:40 +0000 (31 18:40 -0700)]
send-email: use "return;" not "return undef;" on error codepaths

All the callers of "ask", "extract_valid_address", and "validate_patch"
subroutines assign the return values from them to a single scalar:

$var = subr(...);

and "return undef;" in these subroutine can safely be turned into a
simpler "return;".  Doing so will also future-proof a new caller that
mistakenly does this:

    @foo = ask(...);
    if (@foo) { ... we got an answer ... } else { ... we did not ... }

Note that we leave "return undef;" in validate_address on purpose,
even though Perlcritic may complain.  The primary "return" site of
the function returns whatever is in the scalar variable $address, so
it is pointless to change only the other "return undef;" to "return".
The caller must be prepared to see an array with a single undef as
the return value from this subroutine anyway.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agobranch: give better message when no names specified for rename
Jonathon Mah [Sun, 31 Mar 2013 01:27:44 +0000 (30 18:27 -0700)]
branch: give better message when no names specified for rename

Signed-off-by: Jonathon Mah <me@JonathonMah.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoMerge branch 'maint'
Junio C Hamano [Mon, 1 Apr 2013 02:27:54 +0000 (31 19:27 -0700)]
Merge branch 'maint'

* maint:
  cat-file: Fix an gcc -Wuninitialized warning
  fast-import: Fix an gcc -Wuninitialized warning

11 years agomerge/pull: verify GPG signatures of commits being merged
Sebastian Götte [Sun, 31 Mar 2013 16:02:24 +0000 (31 18:02 +0200)]
merge/pull: verify GPG signatures of commits being merged

When --verify-signatures is specified on the command-line of git-merge
or git-pull, check whether the commits being merged have good gpg
signatures and abort the merge in case they do not. This allows e.g.
auto-deployment from untrusted repo hosts.

Signed-off-by: Sebastian Götte <jaseg@physik-pool.tu-berlin.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agocommit.c/GPG signature verification: Also look at the first GPG status line
Sebastian Götte [Sun, 31 Mar 2013 16:01:34 +0000 (31 18:01 +0200)]
commit.c/GPG signature verification: Also look at the first GPG status line

Signed-off-by: Sebastian Götte <jaseg@physik-pool.tu-berlin.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoMove commit GPG signature verification to commit.c
Sebastian Götte [Sun, 31 Mar 2013 16:00:14 +0000 (31 18:00 +0200)]
Move commit GPG signature verification to commit.c

Signed-off-by: Sebastian Götte <jaseg@physik-pool.tu-berlin.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agobash: teach __git_ps1 about REVERT_HEAD
Robin Rosenberg [Sun, 31 Mar 2013 00:30:48 +0000 (31 01:30 +0100)]
bash: teach __git_ps1 about REVERT_HEAD

Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agopeel_onion(): teach $foo^{object} peeler
Junio C Hamano [Sun, 31 Mar 2013 22:24:12 +0000 (31 15:24 -0700)]
peel_onion(): teach $foo^{object} peeler

A string that names an object can be suffixed with ^{type} peeler to
say "I have this object name; peel it until you get this type. If
you cannot do so, it is an error".  v1.8.2^{commit} asks for a commit
that is pointed at an annotated tag v1.8.2; v1.8.2^{tree} unwraps it
further to the top-level tree object.  A special suffix ^{} (i.e. no
type specified) means "I do not care what it unwraps to; just peel
annotated tag until you get something that is not a tag".

When you have a random user-supplied string, you can turn it to a
bare 40-hex object name, and cause it to error out if such an object
does not exist, with:

git rev-parse --verify "$userstring^{}"

for most objects, but this does not yield the tag object name when
$userstring refers to an annotated tag.

Introduce a new suffix, ^{object}, that only makes sure the given
name refers to an existing object.  Then

git rev-parse --verify "$userstring^{object}"

becomes a way to make sure $userstring refers to an existing object.

This is necessary because the plumbing "rev-parse --verify" is only
about "make sure the argument is something we can feed to get_sha1()
and turn it into a raw 20-byte object name SHA-1" and is not about
"make sure that 20-byte object name SHA-1 refers to an object that
exists in our object store".  When the given $userstring is already
a 40-hex, by definition "rev-parse --verify $userstring" can turn it
into a raw 20-byte object name.  With "$userstring^{object}", we can
make sure that the 40-hex string names an object that exists in our
object store before "--verify" kicks in.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agopeel_onion: disambiguate to favor tree-ish when we know we want a tree-ish
Junio C Hamano [Sun, 31 Mar 2013 22:19:52 +0000 (31 15:19 -0700)]
peel_onion: disambiguate to favor tree-ish when we know we want a tree-ish

The function already knows when interpreting $foo^{commit} to tell
the underlying get_sha1_1() to expect a commit-ish while evaluating
$foo.  Teach it to do the same when asked for $foo^{tree}; we are
expecting a tree-ish and $foo should be disambiguated in favor of a
tree-ish, discarding a possible ambiguous match with a blob object.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agocat-file: Fix an gcc -Wuninitialized warning
Ramsay Jones [Tue, 26 Mar 2013 19:20:11 +0000 (26 19:20 +0000)]
cat-file: Fix an gcc -Wuninitialized warning

After commit cbfd5e1c ("drop some obsolete "x = x" compiler warning
hacks", 21-03-2013) removed a gcc specific hack, older versions of
gcc now issue an "'contents' might be used uninitialized" warning.
In order to suppress the warning, we simply initialize the variable
to NULL in it's declaration.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agofast-import: Fix an gcc -Wuninitialized warning
Ramsay Jones [Tue, 26 Mar 2013 19:09:44 +0000 (26 19:09 +0000)]
fast-import: Fix an gcc -Wuninitialized warning

Commit cbfd5e1c ("drop some obsolete "x = x" compiler warning hacks",
21-03-2013) removed a gcc hack that suppressed an "might be used
uninitialized" warning issued by older versions of gcc.

However, commit 3aa99df8 ('fast-import: clarify "inline" logic in
file_change_m', 21-03-2013) addresses an (almost) identical issue
(with very similar code), but includes additional code in it's
resolution. The solution used by this commit, unlike that used by
commit cbfd5e1c, also suppresses the -Wuninitialized warning on
older versions of gcc.

In order to suppress the warning (against the 'oe' symbol) in the
note_change_n() function, we adopt the same solution used by commit
3aa99df8.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agogit-web--browse: recognize any TERM_PROGRAM as a GUI terminal on OS X
John Szakmeister [Mon, 25 Mar 2013 10:13:18 +0000 (25 06:13 -0400)]
git-web--browse: recognize any TERM_PROGRAM as a GUI terminal on OS X

It turns out that the presence of SECURITYSESSIONID is not sufficient
for detecting the presence of a GUI under Mac OS X.  SECURITYSESSIONID
appears to only be set when the user has Screen Sharing enabled.
Disabling Screen Sharing and relaunching the shell showed that the
variable was missing, at least under Mac OS X 10.6.8.

On the other hand, TERM_PROGRAM seems to be set for any terminals on
OS X, so just check it is set to something, instead of hardcoding
"Apple_Terminal" and missing other terminals such as iTerm.app.

Signed-off-by: John Szakmeister <john@szakmeister.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoclone: leave repo in place after checkout errors
Jeff King [Tue, 26 Mar 2013 22:22:09 +0000 (26 18:22 -0400)]
clone: leave repo in place after checkout errors

If we manage to clone a remote repository but run into an
error in the checkout, it is probably sane to leave the repo
directory in place. That lets the user examine the situation
without spending time to re-clone from the remote (which may
be a lengthy process).

Rather than try to convert each die() from the checkout code
path into an error(), we simply set a flag that tells the
"remove_junk" atexit function to print a helpful message and
leave the repo in place.

Note that the test added in this patch actually passes
without the code change. The reason is that the cleanup code
is buggy; we chdir into the working tree for the checkout,
but still may use relative paths to remove the directories
(which means if you cloned into "foo", we would accidentally
remove "foo" from the working tree!).  There's no point in
fixing it now, since this patch means we will never try to
remove anything after the chdir, anyway.

[jc: replaced the message with a more succinct version from
Jonathan]

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agot7800: run --dir-diff tests with and without symlinks
John Keeping [Fri, 29 Mar 2013 11:28:36 +0000 (29 11:28 +0000)]
t7800: run --dir-diff tests with and without symlinks

Currently the difftool --dir-diff tests may or may not use symlinks
depending on the operating system on which they are run.  In one case
this has caused a test failure to be noticed only on Windows when the
test also fails on Linux when difftool is invoked with --no-symlinks.

Rewrite these tests so that they do not depend on the environment but
run explicitly with both --symlinks and --no-symlinks, protecting the
--symlinks version with a SYMLINKS prerequisite.

Signed-off-by: John Keeping <john@keeping.me.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agot7800: fix tests when difftool uses --no-symlinks
John Keeping [Fri, 29 Mar 2013 11:28:35 +0000 (29 11:28 +0000)]
t7800: fix tests when difftool uses --no-symlinks

When 'git difftool --dir-diff' is using --no-symlinks (either explicitly
or implicitly because it's running on Windows), any working tree files
that have been copied to the temporary directory are copied back after
the difftool completes.

Because an earlier test uses "git add .", the "output" file used by
tests is tracked by Git and the following sequence occurs during some
tests:

1) the shell opens "output" to redirect the difftool output
2) difftool copies the empty "output" to the temporary directory
3) difftool runs "ls" which writes to "output"
4) difftool copies the empty "output" file back over the output of the
   command
5) the output file doesn't contain the expected output, causing the
   test to fail

Instead of adding all changes, explicitly add only the files that the
test is using, allowing later tests to write their result files into the
working tree.

Signed-off-by: John Keeping <john@keeping.me.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agot7800: don't hide grep output
John Keeping [Fri, 29 Mar 2013 11:28:34 +0000 (29 11:28 +0000)]
t7800: don't hide grep output

Remove the stdin_contains and stdin_doesnt_contain helper functions
which add nothing but hide the output of grep, hurting debugging.

Suggested-by: Johannes Sixt <j.sixt@viscovery.net>
Signed-off-by: John Keeping <john@keeping.me.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agodifftool: don't overwrite modified files
John Keeping [Fri, 29 Mar 2013 22:07:39 +0000 (29 22:07 +0000)]
difftool: don't overwrite modified files

After running the user's diff tool, git-difftool will copy any files
that differ between the working tree and the temporary tree.  This is
useful when the user edits the file in their diff tool but is wrong if
they edit the working tree file while examining the diff.

Instead of copying unconditionally when the files differ, create and
index from the working tree files and only copy the temporary file back
if it was modified and the working tree file was not.  If both files
have been modified, print a warning and exit with an error.

Note that we cannot use an existing index in git-difftool since those
contain the modified files that need to be checked out but here we are
looking at those files which are copied from the working tree and not
checked out.  These are precisely the files which are not in the
existing indices.

Signed-off-by: John Keeping <john@keeping.me.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agot1300: document some aesthetic failures of the config editor
Jeff King [Fri, 29 Mar 2013 19:51:55 +0000 (29 15:51 -0400)]
t1300: document some aesthetic failures of the config editor

The config-editing code used by "git config var value" is
built around the regular config callback parser, whose only
triggerable item is an actual key. As a result, it does not
know anything about section headers, which can result in
unnecessarily ugly output:

  1. When we delete the last key in a section, we should be
     able to delete the section header.

  2. When we add a key into a section, we should be able to
     reuse the same section header, even if that section did
     not have any keys in it already.

Unfortunately, fixing these is not trivial with the current
code. It would involve the config parser recording and
passing back information on each item it finds, including
headers, keys, and even comments (or even better, generating
an actual in-memory parse-tree).

Since these behaviors do not cause any functional problems
(i.e., the resulting config parses as expected, it is just
uglier than one would like), fixing them can wait until
somebody feels like substantially refactoring the parsing
code. In the meantime, let's document them as known issues
with some tests.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agotest: resurrect q_to_tab
Junio C Hamano [Fri, 29 Mar 2013 20:38:28 +0000 (29 13:38 -0700)]
test: resurrect q_to_tab

New test may want to use this helper; keep it for them that do not
need to protect literal SP.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agot7800: move '--symlinks' specific test to the end
John Keeping [Fri, 29 Mar 2013 11:28:32 +0000 (29 11:28 +0000)]
t7800: move '--symlinks' specific test to the end

This will group the tests more logically when we introduce a helper to
run most --dir-diff tests with both --symlinks and --no-symlinks.

Signed-off-by: John Keeping <john@keeping.me.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agot: check that a pattern without trailing slash matches a directory
Jeff King [Thu, 28 Mar 2013 21:50:04 +0000 (28 17:50 -0400)]
t: check that a pattern without trailing slash matches a directory

Prior to v1.8.1.1, with:

  git init
  echo content >foo &&
  mkdir subdir &&
  echo content >subdir/bar &&
  echo "subdir export-ignore" >.gitattributes
  git add . &&
  git commit -m one &&
  git archive HEAD | tar tf -

the resulting archive would contain only "foo" and ".gitattributes",
not subdir.  This was broken with a recent change that intended to
allow "subdir/ export-ignore" to also exclude the directory, but
instead ended up _requiring_ the trailing slash by mistake.

A pattern "subdir" should match any path "subdir", whether it is a
directory or a non-directory.  A pattern "subdir/" insists that a
path "subdir" must be a directory for it to match.

This patch adds test not just for this simple case, but also for
deeper cross-directory cases, as well as cases with wildcards.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agodir.c::match_pathname(): pay attention to the length of string parameters
Jeff King [Thu, 28 Mar 2013 21:48:21 +0000 (28 17:48 -0400)]
dir.c::match_pathname(): pay attention to the length of string parameters

This function takes two counted strings: a <pattern, patternlen> pair
and a <pathname, pathlen> pair. But we end up feeding the result to
fnmatch, which expects NUL-terminated strings.

We can fix this by calling the fnmatch_icase_mem function, which
handles re-allocating into a NUL-terminated string if necessary.

While we're at it, we can avoid even calling fnmatch in some cases. In
addition to patternlen, we get "prefix", the size of the pattern that
contains no wildcard characters. We do a straight match of the prefix
part first, and then use fnmatch to cover the rest. But if there are
no wildcards in the pattern at all, we do not even need to call
fnmatch; we would simply be comparing two empty strings.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agodir.c::match_pathname(): adjust patternlen when shifting pattern
Jeff King [Thu, 28 Mar 2013 21:47:47 +0000 (28 17:47 -0400)]
dir.c::match_pathname(): adjust patternlen when shifting pattern

If we receive a pattern that starts with "/", we shift it
forward to avoid looking at the "/" part. Since the prefix
and patternlen parameters are counts of what is in the
pattern, we must decrement them as we increment the pointer.

We remembered to handle prefix, but not patternlen. This
didn't cause any bugs, though, because the patternlen
parameter is not actually used. Since it will be used in
future patches, let's correct this oversight.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agodir.c::match_basename(): pay attention to the length of string parameters
Junio C Hamano [Thu, 28 Mar 2013 21:47:28 +0000 (28 17:47 -0400)]
dir.c::match_basename(): pay attention to the length of string parameters

The function takes two counted strings (<basename, basenamelen> and
<pattern, patternlen>) as parameters, together with prefix (the
length of the prefix in pattern that is to be matched literally
without globbing against the basename) and EXC_* flags that tells it
how to match the pattern against the basename.

However, it did not pay attention to the length of these counted
strings.  Update them to do the following:

 * When the entire pattern is to be matched literally, the pattern
   matches the basename only when the lengths of them are the same,
   and they match up to that length.

 * When the pattern is "*" followed by a string to be matched
   literally, make sure that the basenamelen is equal or longer than
   the "literal" part of the pattern, and the tail of the basename
   string matches that literal part.

 * Otherwise, use the new fnmatch_icase_mem helper to make
   sure we only lookmake sure we use only look at the
   counted part of the strings.  Because these counted strings are
   full strings most of the time, we check for termination
   to avoid unnecessary allocation.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoattr.c::path_matches(): special case paths that end with a slash
Junio C Hamano [Thu, 28 Mar 2013 21:49:13 +0000 (28 17:49 -0400)]
attr.c::path_matches(): special case paths that end with a slash

The function is given a string that ends with a slash to signal that
the path is a directory to make sure that a pattern that ends with a
slash (i.e. MUSTBEDIR) can tell directories and non-directories
apart.  However, the pattern itself (pat->pattern and
pat->patternlen) that came from such a MUSTBEDIR pattern is
represented as a string that ends with a slash, but patternlen does
not count that trailing slash. A MUSTBEDIR pattern "element/" is
represented as a counted string <"element/", 7> and this must match
match pathname "element/".

Because match_basename() and match_pathname() want to see pathname
"element" to match against the pattern <"element/", 7>, reduce the
length of the path to exclude the trailing slash when calling
these functions.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoMerge branch 'yd/use-test-config-unconfig'
Junio C Hamano [Thu, 28 Mar 2013 21:38:27 +0000 (28 14:38 -0700)]
Merge branch 'yd/use-test-config-unconfig'

Bulk-update of the test suite.

* yd/use-test-config-unconfig:
  t5520: use test_config to set/unset git config variables (leftover bits)
  t7600: use test_config to set/unset git config variables
  t7502: remove clear_config
  t7502: use test_config to set/unset git config variables
  t9500: use test_config to set/unset git config variables
  t7508: use test_config to set/unset git config variables
  t7500: use test_config to set/unset git config variables
  t5541: use test_config to set/unset git config variables
  t5520: use test_config to set/unset git config variables
  t4202: use test_config/test_unconfig to set/unset git config variables
  t4034: use test_config/test_unconfig to set/unset git config variables
  t4304: use test_config to set/unset git config variables
  t3400: use test_config to set/unset git config variables

11 years agoMerge branch 'kk/revwalk-slop-too-many-commit-within-a-second'
Junio C Hamano [Thu, 28 Mar 2013 21:38:25 +0000 (28 14:38 -0700)]
Merge branch 'kk/revwalk-slop-too-many-commit-within-a-second'

Allow the revision "slop" code to look deeper while commits with
exactly the same timestamps come next to each other (which can
often happen after a large "am" and "rebase" session).

* kk/revwalk-slop-too-many-commit-within-a-second:
  Fix revision walk for commits with the same dates

11 years agoMerge branch 'rr/tests-dedup-test-config'
Junio C Hamano [Thu, 28 Mar 2013 21:38:23 +0000 (28 14:38 -0700)]
Merge branch 'rr/tests-dedup-test-config'

* rr/tests-dedup-test-config:
  t4018,7810,7811: remove test_config() redefinition