gitweb.git
archive-zip: use a local variable to store the creator... René Scharfe Sat, 22 Aug 2015 19:06:31 +0000 (21:06 +0200)

archive-zip: use a local variable to store the creator version

Use a simpler conditional right next to the code which makes a higher
creator version necessary -- namely symlink handling and support for
executable files -- instead of a long line with a ternary operator.
The resulting code has more lines but is simpler and allows reuse of
the value easily.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t5004: test ZIP archives with many entriesRené Scharfe Sat, 22 Aug 2015 19:06:12 +0000 (21:06 +0200)

t5004: test ZIP archives with many entries

A ZIP file directory has a 16-bit field for the number of entries it
contains. There are 64-bit extensions to deal with that. Demonstrate
that git archive --format=zip currently doesn't use them and instead
overflows the field.

InfoZIP's unzip doesn't care about this field and extracts all files
anyway. Software that uses the directory for presenting a filesystem
like view quickly -- notably Windows -- depends on it, but doesn't
lend itself to an automatic test case easily. Use InfoZIP's zipinfo,
which probably isn't available everywhere but at least can provides
*some* way to check this field.

To speed things up a bit create and commit only a subset of the files
and build a fake tree out of duplicates and pass that to git archive.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Sixth batch for 2.6Junio C Hamano Wed, 26 Aug 2015 22:47:48 +0000 (15:47 -0700)

Sixth batch for 2.6

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'sg/help-group'Junio C Hamano Wed, 26 Aug 2015 22:45:39 +0000 (15:45 -0700)

Merge branch 'sg/help-group'

We rewrote one of the build scripts in Perl but this reimplements
in Bourne shell.

* sg/help-group:
generate-cmdlist: re-implement as shell script

Merge branch 'sg/wt-status-header-inclusion'Junio C Hamano Wed, 26 Aug 2015 22:45:38 +0000 (15:45 -0700)

Merge branch 'sg/wt-status-header-inclusion'

* sg/wt-status-header-inclusion:
wt-status: move #include "pathspec.h" to the header

Merge branch 'as/docfix-reflog-expire-unreachable'Junio C Hamano Wed, 26 Aug 2015 22:45:37 +0000 (15:45 -0700)

Merge branch 'as/docfix-reflog-expire-unreachable'

* as/docfix-reflog-expire-unreachable:
Documentation/config: fix inconsistent label on gc.*.reflogExpireUnreachable

Merge branch 'sg/t3020-typofix'Junio C Hamano Wed, 26 Aug 2015 22:45:35 +0000 (15:45 -0700)

Merge branch 'sg/t3020-typofix'

* sg/t3020-typofix:
t3020: fix typo in test description

Merge branch 'jc/calloc-pathspec'Junio C Hamano Wed, 26 Aug 2015 22:45:33 +0000 (15:45 -0700)

Merge branch 'jc/calloc-pathspec'

* jc/calloc-pathspec:
ps_matched: xcalloc() takes nmemb and then element size

Merge branch 'dt/untracked-sparse'Junio C Hamano Wed, 26 Aug 2015 22:45:33 +0000 (15:45 -0700)

Merge branch 'dt/untracked-sparse'

Test update.

* dt/untracked-sparse:
t7063: use --force-untracked-cache to speed up a bit

Merge branch 'pt/am-builtin'Junio C Hamano Wed, 26 Aug 2015 22:45:33 +0000 (15:45 -0700)

Merge branch 'pt/am-builtin'

Rewrite "am" in "C".

* pt/am-builtin:
i18n: am: fix typo in description of -b option

Merge branch 'pt/am-builtin-abort-fix'Junio C Hamano Wed, 26 Aug 2015 22:45:32 +0000 (15:45 -0700)

Merge branch 'pt/am-builtin-abort-fix'

"git am" that was recently reimplemented in C had a performance
regression in "git am --abort" that goes back to the version before
an attempted (and failed) patch application.

* pt/am-builtin-abort-fix:
am --skip/--abort: merge HEAD/ORIG_HEAD tree into index

Merge branch 'po/po-readme'Junio C Hamano Wed, 26 Aug 2015 22:45:32 +0000 (15:45 -0700)

Merge branch 'po/po-readme'

* po/po-readme:
po/README: Update directions for l10n contributors

Merge branch 'jv/send-email-selective-smtp-auth'Junio C Hamano Wed, 26 Aug 2015 22:45:31 +0000 (15:45 -0700)

Merge branch 'jv/send-email-selective-smtp-auth'

"git send-email" learned a new option --smtp-auth to limit the SMTP
AUTH mechanisms to be used to a subset of what the system library
supports.

* jv/send-email-selective-smtp-auth:
send-email: provide whitelist of SMTP AUTH mechanisms

Merge branch 'ep/http-configure-ssl-version'Junio C Hamano Wed, 26 Aug 2015 22:45:31 +0000 (15:45 -0700)

Merge branch 'ep/http-configure-ssl-version'

A new configuration variable http.sslVersion can be used to specify
what specific version of SSL/TLS to use to make a connection.

* ep/http-configure-ssl-version:
http: add support for specifying the SSL version

Merge branch 'ss/fix-config-fd-leak'Junio C Hamano Wed, 26 Aug 2015 22:45:30 +0000 (15:45 -0700)

Merge branch 'ss/fix-config-fd-leak'

* ss/fix-config-fd-leak:
config: close config file handle in case of error

i18n: am: fix typo in description of -b optionJiang Xin Wed, 26 Aug 2015 15:51:19 +0000 (23:51 +0800)

i18n: am: fix typo in description of -b option

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

trailer: retitle a test and correct an in-comment messageChristian Couder Wed, 26 Aug 2015 02:51:00 +0000 (04:51 +0200)

trailer: retitle a test and correct an in-comment message

Signed-off-by: Christian Couder <christian.couder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-svn doc: mention "svn-remote.<name>.include-paths"Brett Randall Mon, 24 Aug 2015 00:23:45 +0000 (10:23 +1000)

git-svn doc: mention "svn-remote.<name>.include-paths"

Mention the configuration variable in a way similar to how
"svn-remote.<name>.ignore-paths" is mentioned.

Signed-off-by: Brett Randall <javabrett@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Sync with maintJunio C Hamano Tue, 25 Aug 2015 23:09:30 +0000 (16:09 -0700)

Sync with maint

* maint:
pull: pass upload_pack only when it was given

Merge branch 'jk/guess-repo-name-regression-fix' into... Junio C Hamano Tue, 25 Aug 2015 23:09:17 +0000 (16:09 -0700)

Merge branch 'jk/guess-repo-name-regression-fix' into maint

"git clone $URL" in recent releases of Git contains a regression in
the code that invents a new repository name incorrectly based on
the $URL. This has been corrected.

* jk/guess-repo-name-regression-fix:
clone: use computed length in guess_dir_name
clone: add tests for output directory

Merge branch 'jk/test-with-x' into maintJunio C Hamano Tue, 25 Aug 2015 23:09:16 +0000 (16:09 -0700)

Merge branch 'jk/test-with-x' into maint

Running tests with the "-x" option to make them verbose had some
unpleasant interactions with other features of the test suite.

* jk/test-with-x:
test-lib: disable trace when test is not verbose
test-lib: turn off "-x" tracing during chain-lint check

Merge branch 'sb/check-return-from-read-ref' into maintJunio C Hamano Tue, 25 Aug 2015 23:09:16 +0000 (16:09 -0700)

Merge branch 'sb/check-return-from-read-ref' into maint

* sb/check-return-from-read-ref:
transport-helper: die on errors reading refs.

Merge branch 'mm/pull-upload-pack' into maintJunio C Hamano Tue, 25 Aug 2015 23:09:15 +0000 (16:09 -0700)

Merge branch 'mm/pull-upload-pack' into maint

"git pull" in recent releases of Git has a regression in the code
that allows custom path to the --upload-pack=<program>. This has
been corrected.

Note that this is irrelevant for 'master' with "git pull" rewritten
in C.

* mm/pull-upload-pack:
pull: pass upload_pack only when it was given
pull.sh: quote $upload_pack when passing it to git-fetch

pull: pass upload_pack only when it was givenJunio C Hamano Tue, 25 Aug 2015 23:06:53 +0000 (16:06 -0700)

pull: pass upload_pack only when it was given

The upload_pack shell variable is initialized to an empty string, so
conditional expansion with ${upload_pack+"$upload_pack"} would not
work very well. You need a colon there.

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Fifth batch for 2.6Junio C Hamano Tue, 25 Aug 2015 22:00:15 +0000 (15:00 -0700)

Fifth batch for 2.6

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'cb/open-noatime-clear-errno'Junio C Hamano Tue, 25 Aug 2015 21:57:10 +0000 (14:57 -0700)

Merge branch 'cb/open-noatime-clear-errno'

When trying to see that an object does not exist, a state errno
leaked from our "first try to open a packfile with O_NOATIME and
then if it fails retry without it" logic on a system that refuses
O_NOATIME. This confused us and caused us to die, saying that the
packfile is unreadable, when we should have just reported that the
object does not exist in that packfile to the caller.

* cb/open-noatime-clear-errno:
git_open_noatime: return with errno=0 on success

Merge branch 'mh/tempfile'Junio C Hamano Tue, 25 Aug 2015 21:57:09 +0000 (14:57 -0700)

Merge branch 'mh/tempfile'

The "lockfile" API has been rebuilt on top of a new "tempfile" API.

* mh/tempfile:
credential-cache--daemon: use tempfile module
credential-cache--daemon: delete socket from main()
gc: use tempfile module to handle gc.pid file
lock_repo_for_gc(): compute the path to "gc.pid" only once
diff: use tempfile module
setup_temporary_shallow(): use tempfile module
write_shared_index(): use tempfile module
register_tempfile(): new function to handle an existing temporary file
tempfile: add several functions for creating temporary files
prepare_tempfile_object(): new function, extracted from create_tempfile()
tempfile: a new module for handling temporary files
commit_lock_file(): use get_locked_file_path()
lockfile: add accessor get_lock_file_path()
lockfile: add accessors get_lock_file_fd() and get_lock_file_fp()
create_bundle(): duplicate file descriptor to avoid closing it twice
lockfile: move documentation to lockfile.h and lockfile.c

Merge branch 'pt/am-builtin-options'Junio C Hamano Tue, 25 Aug 2015 21:57:08 +0000 (14:57 -0700)

Merge branch 'pt/am-builtin-options'

After "git am --opt1" stops, running "git am --opt2" pays attention
to "--opt2" only for the patch that caused the original invocation
to stop.

* pt/am-builtin-options:
am: let --signoff override --no-signoff
am: let command-line options override saved options
test_terminal: redirect child process' stdin to a pty

Merge branch 'dt/refs-pseudo'Junio C Hamano Tue, 25 Aug 2015 21:57:08 +0000 (14:57 -0700)

Merge branch 'dt/refs-pseudo'

To prepare for allowing a different "ref" backend to be plugged in
to the system, update_ref()/delete_ref() have been taught about
ref-like things like MERGE_HEAD that are per-worktree (they will
always be written to the filesystem inside $GIT_DIR).

* dt/refs-pseudo:
pseudoref: check return values from read_ref()
sequencer: replace write_cherry_pick_head with update_ref
bisect: use update_ref
pseudorefs: create and use pseudoref update and delete functions
refs: add ref_type function
refs: introduce pseudoref and per-worktree ref concepts

Merge branch 'dt/notes-multiple'Junio C Hamano Tue, 25 Aug 2015 21:57:08 +0000 (14:57 -0700)

Merge branch 'dt/notes-multiple'

When linked worktree is used, simultaneous "notes merge" instances
for the same ref in refs/notes/* are prevented from stomping on
each other.

* dt/notes-multiple:
notes: handle multiple worktrees
worktrees: add find_shared_symref

Merge branch 'nd/dwim-wildcards-as-pathspecs'Junio C Hamano Tue, 25 Aug 2015 21:57:07 +0000 (14:57 -0700)

Merge branch 'nd/dwim-wildcards-as-pathspecs'

Test updates for Windows.

* nd/dwim-wildcards-as-pathspecs:
t2019: skip test requiring '*' in a file name non Windows

Merge branch 'jk/long-error-messages'Junio C Hamano Tue, 25 Aug 2015 21:57:06 +0000 (14:57 -0700)

Merge branch 'jk/long-error-messages'

The codepath to produce error messages had a hard-coded limit to
the size of the message, primarily to avoid memory allocation while
calling die().

* jk/long-error-messages:
vreportf: avoid intermediate buffer
vreportf: report to arbitrary filehandles

Merge branch 'ee/clean-remove-dirs'Junio C Hamano Tue, 25 Aug 2015 21:57:06 +0000 (14:57 -0700)

Merge branch 'ee/clean-remove-dirs'

Test updates for Windows.

* ee/clean-remove-dirs:
t7300-clean: require POSIXPERM for chmod 0 test

Merge branch 'jh/strbuf-read-use-read-in-full'Junio C Hamano Tue, 25 Aug 2015 21:57:05 +0000 (14:57 -0700)

Merge branch 'jh/strbuf-read-use-read-in-full'

strbuf_read() used to have one extra iteration (and an unnecessary
strbuf_grow() of 8kB), which was eliminated.

* jh/strbuf-read-use-read-in-full:
strbuf_read(): skip unnecessary strbuf_grow() at eof

builtin/log.c: minor reformatJunio C Hamano Thu, 20 Aug 2015 22:51:45 +0000 (15:51 -0700)

builtin/log.c: minor reformat

Two logical lines that were not overly long was split in the middle,
which made them read worse.

Signed-off-by: Junio C Hamano <gitster@pobox.com>

write_file(): drop caller-supplied LF from calls to... Junio C Hamano Mon, 24 Aug 2015 20:20:39 +0000 (13:20 -0700)

write_file(): drop caller-supplied LF from calls to create a one-liner file

All of the callsites covered by this change call write_file() or
write_file_gently() to create a one-liner file. Drop the caller
supplied LF and let these callees to append it as necessary.

Signed-off-by: Junio C Hamano <gitster@pobox.com>

write_file_v(): do not leave incomplete line at the endJunio C Hamano Mon, 24 Aug 2015 16:39:48 +0000 (09:39 -0700)

write_file_v(): do not leave incomplete line at the end

All existing callers to this function use it to produce a text file
or an empty file, and a new callsite that mimick them must end their
payload with a LF. If they forget to do so, the resulting file will
end with an incomplete line.

Teach write_file_v() to complete the incomplete line, if exists, so
that the callers do not have to.

With this, the caller-side fix in builtin/am.c becomes unnecessary.

Signed-off-by: Junio C Hamano <gitster@pobox.com>

generate-cmdlist: re-implement as shell scriptEric Sunshine Sun, 23 Aug 2015 21:31:09 +0000 (17:31 -0400)

generate-cmdlist: re-implement as shell script

527ec39 (generate-cmdlist: parse common group commands, 2015-05-21)
replaced generate-cmdlist.sh with a more functional Perl version,
generate-cmdlist.perl. The Perl version gleans named tags from a new
"common groups" section in command-list.txt and recognizes those
tags in "command list" section entries in place of the old 'common'
tag. This allows git-help to, not only recognize, but also group
common commands.

Although the tests require Perl, 527ec39 creates an unconditional
dependence upon Perl in the build system itself, which can not be
overridden with NO_PERL. Such a dependency may be undesirable; for
instance, the 'git-lite' package in the FreeBSD ports tree is
intended as a minimal Git installation (which may, for example, be
useful on servers needing only local clone and update capability),
which, historically, has not depended upon Perl[1].

Therefore, revive generate-cmdlist.sh and extend it to recognize
"common groups" and its named tags. Retire generate-cmdlist.perl.

[1]: http://thread.gmane.org/gmane.comp.version-control.git/275905/focus=276132

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

setup: update the right file in multiple checkoutsNguyễn Thái Ngọc Duy Tue, 25 Aug 2015 10:30:46 +0000 (17:30 +0700)

setup: update the right file in multiple checkouts

This code is introduced in 23af91d (prune: strategies for linked
checkouts - 2014-11-30), and it's supposed to implement this rule from
that commit's message:

- linked checkouts are supposed to keep its location in $R/gitdir up
to date. The use case is auto fixup after a manual checkout move.

Note the name, "$R/gitdir", not "$R/gitfile". Correct the path to be
updated accordingly.

While at there, make sure I/O errors are not silently dropped.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

describe --contains: default to HEAD when no commit... SZEDER Gábor Mon, 24 Aug 2015 16:15:18 +0000 (18:15 +0200)

describe --contains: default to HEAD when no commit-ish is given

'git describe --contains' doesn't default to HEAD when no commit is
given, and it doesn't produce any output, not even an error:

~/src/git ((v2.5.0))$ ./git describe --contains
~/src/git ((v2.5.0))$ ./git describe --contains HEAD
v2.5.0^0

Unlike other 'git describe' options, the '--contains' code path is
implemented by calling 'name-rev' with a bunch of options plus all the
commit-ishes that were passed to 'git describe'. If no commit-ish was
present, then 'name-rev' got invoked with none, which then leads to the
behavior illustrated above.

Porcelain commands usually default to HEAD when no commit-ish is given,
and 'git describe' already does so in all other cases, so it should do
so with '--contains' as well.

Pass HEAD to 'name-rev' when no commit-ish is given on the command line
to make '--contains' behave consistently with other 'git describe'
options. While at it, use argv_array_pushv() instead of the loop to
pass commit-ishes to 'git name-rev'.

'git describe's short help already indicates that the commit-ish is
optional, but the synopsis in the man page doesn't, so update it
accordingly as well.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

write_file(): drop "fatal" parameterJunio C Hamano Mon, 24 Aug 2015 20:03:07 +0000 (13:03 -0700)

write_file(): drop "fatal" parameter

All callers except three passed 1 for the "fatal" parameter to ask
this function to die upon error, but to a casual reader of the code,
it was not all obvious what that 1 meant. Instead, split the
function into two based on a common write_file_v() that takes the
flag, introduce write_file_gently() as a new way to attempt creating
a file without dying on error, and make three callers to call it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>

builtin/am: make sure state files are textJunio C Hamano Mon, 24 Aug 2015 16:43:41 +0000 (09:43 -0700)

builtin/am: make sure state files are text

We forgot to terminate the payload given to write_file() with LF,
resulting in files that end with an incomplete line. Teach the
wrappers builtin/am uses to make sure it adds LF at the end as
necessary.

Signed-off-by: Junio C Hamano <gitster@pobox.com>

builtin/am: introduce write_state_*() helper functionsJunio C Hamano Mon, 24 Aug 2015 16:12:53 +0000 (09:12 -0700)

builtin/am: introduce write_state_*() helper functions

There are many calls to write_file() that repeat the same pattern in
the implementation of the builtin version of "am". They all share
the same traits, i.e they

- produce a text file with a single string in it;

- have enough information to produce the entire contents of that
file;

- generate the pathname of the file by making a call to am_path(); and

- they ask write_file() to die() upon failure.

The slight differences among the call sites throw them into roughly
three categories:

- many write either "t" or "f" based on a boolean value to a file;

- some write the integer value in decimal text;

- some others write more general string, e.g. an object name in
hex, an empty string (i.e. the presense of the file itself serves
as a flag), etc.

Introduce three helpers, write_state_bool(), write_state_count() and
write_state_text(), to reduce direct calls to write_file().

This is a preparatory step for the next step to ensure that no
"state" file this command leaves in $GIT_DIR is with an incomplete
line at the end.

Suggested-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

rev-list: make it obvious that we do not support notesJeff King Sun, 23 Aug 2015 17:56:40 +0000 (13:56 -0400)

rev-list: make it obvious that we do not support notes

The rev-list command does not have the internal
infrastructure to display notes. Running:

git rev-list --notes HEAD

will silently ignore the "--notes" option. Running:

git rev-list --notes --grep=. HEAD

will crash on an assert. Running:

git rev-list --format=%N HEAD

will place a literal "%N" in the output (it does not even
expand to an empty string).

Let's have rev-list tell the user that it cannot fill the
user's request, rather than silently producing wrong data.
Likewise, let's remove mention of the notes options from the
rev-list documentation.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

config: silence warnings for command names with invalid... Jeff King Mon, 24 Aug 2015 06:11:33 +0000 (02:11 -0400)

config: silence warnings for command names with invalid keys

When we are running the git command "foo", we may have to
look up the config keys "pager.foo" and "alias.foo". These
config schemes are mis-designed, as the command names can be
anything, but the config syntax has some restrictions. For
example:

$ git foo_bar
error: invalid key: pager.foo_bar
error: invalid key: alias.foo_bar
git: 'foo_bar' is not a git command. See 'git --help'.

You cannot name an alias with an underscore. And if you have
an external command with one, you cannot configure its
pager.

In the long run, we may develop a different config scheme
for these features. But in the near term (and because we'll
need to support the existing scheme indefinitely), we should
at least squelch the error messages shown above.

These errors come from git_config_parse_key. Ideally we
would pass a "quiet" flag to the config machinery, but there
are many layers between the pager code and the key parsing.
Passing a flag through all of those would be an invasive
change.

Instead, let's provide a config function to report on
whether a key is syntactically valid, and have the pager and
alias code skip lookup for bogus keys. We can build this
easily around the existing git_config_parse_key, with two
minor modifications:

1. We now handle a NULL store_key, to validate but not
write out the normalized key.

2. We accept a "quiet" flag to avoid writing to stderr.
This doesn't need to be a full-blown public "flags"
field, because we can make the existing implementation
a static helper function, keeping the mess contained
inside config.c.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

wt-status: move #include "pathspec.h" to the headerSZEDER Gábor Thu, 20 Aug 2015 14:06:27 +0000 (16:06 +0200)

wt-status: move #include "pathspec.h" to the header

The declaration of 'struct wt_status' requires the declararion of 'struct
pathspec'.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

trailer: ignore first line of messageChristian Couder Thu, 20 Aug 2015 21:59:15 +0000 (23:59 +0200)

trailer: ignore first line of message

When looking for the start of the trailers in the message
we are passed, we should ignore the first line of the message.

The reason is that if we are passed a patch or commit message
then the first line should be the patch title.
If we are passed only trailers we can expect that they start
with an empty line that can be ignored too.

This way we can properly process commit messages that have
only one line with something that looks like a trailer, for
example like "area of code: change we made".

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Documentation/config: fix inconsistent label on gc... Andreas Schwab Fri, 21 Aug 2015 15:06:18 +0000 (17:06 +0200)

Documentation/config: fix inconsistent label on gc.*.reflogExpireUnreachable

Change <ref> to <pattern> in the description of
gc.*.reflogExpireUnreachable, since that is what the text refers to.

Signed-off-by: Andreas Schwab <schwab@linux-m68k.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

log: show merge commit when --cc is givenJunio C Hamano Thu, 20 Aug 2015 21:36:49 +0000 (14:36 -0700)

log: show merge commit when --cc is given

We defaulted to ignoring merge diffs because long long ago, in a
galaxy far away, we didn't have a great way to show the diffs. The
whole "--cc" option goes back to January '06 and commit d8f4790e6fe7
("diff-tree --cc: denser combined diff output for a merge commit").
And before that option - so for about 8 months - we had no good way
to show the diffs of merges in a good dense way. So the whole
"don't show diffs for merges by default" actually made a lot of
sense originally, because our merge diffs were not very useful.

And this was carried forward to this day. "git log --cc" still
ignores merge commits, and you need to say "git log -m --cc" to view
a sensible rendition of merge and non-merge commits, even with the
previous change to make "--cc" imply "-p".

Teach "git log" that "--cc" means the user wants to see interesting
changes in merge commits by turning "-m" on.

Signed-off-by: Junio C Hamano <gitster@pobox.com>

log: when --cc is given, default to -p unless told... Junio C Hamano Thu, 20 Aug 2015 21:36:49 +0000 (14:36 -0700)

log: when --cc is given, default to -p unless told otherwise

The "--cc" option to "git log" is clearly a request to show some
sort of combined diff (be it --patch or --raw), but traditionally
we required the command line to explicitly ask for "git log -p --cc".

Teach the command line parser to treat a lone "--cc" as if the user
specified "-p --cc". Formats that do ask for other forms of diff
output, e.g. "log --raw --cc", are not overriden.

Signed-off-by: Junio C Hamano <gitster@pobox.com>

log: rename "tweak" helpersJunio C Hamano Thu, 20 Aug 2015 21:14:46 +0000 (14:14 -0700)

log: rename "tweak" helpers

The revision walking API allows the callers to tweak its
configuration at the last minute, immediately after all the revision
and pathspec parameters are parsed from the command line but before
the default actions are decided based on them, by defining a "tweak"
callback function when calling setup_revisions(). Traditionally,
this facility was used by "git show" to turn on the patch output
"-p" by default when no diff output option (e.g. "--raw" or "-s" to
squelch the output altogether) is given on the command line, and
further give dense combined diffs "--cc" for merge commits when no
option to countermand it (e.g. "-m" to show pairwise patches).

Recently, "git log" started using the same facility, but we named
the callback function "default_follow_tweak()", as if the only kind
of tweaking we would want for "git log" will forever be limited to
turning "--follow" on by default when told by a configuration
variable. That was myopic.

Rename it to more generic name "log_setup_revisions_tweak()", and
match the one used by show "show_setup_revisions_tweak()".

Signed-off-by: Junio C Hamano <gitster@pobox.com>

get_urlmatch: avoid useless strbuf writeJeff King Thu, 20 Aug 2015 14:49:45 +0000 (10:49 -0400)

get_urlmatch: avoid useless strbuf write

We create a strbuf only to insert a single string, pass the
resulting buffer to a function (which does not modify the
string), and then free it. We can just pass the original
string instead.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

format_config: simplify buffer handlingJeff King Thu, 20 Aug 2015 14:47:34 +0000 (10:47 -0400)

format_config: simplify buffer handling

When formatting a config value into a strbuf, we may end
up stringifying it into a fixed-size buffer using sprintf,
and then copying that buffer into the strbuf. We can
eliminate the middle-man (and drop some calls to sprintf!)
by writing directly to the strbuf.

The reason it was written this way in the first place is
that we need to know before writing the value whether to
insert a delimiter. Instead of delaying the write of the
value, we speculatively write the delimiter, and roll it
back in the single case that cares.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

format_config: don't init strbufJeff King Thu, 20 Aug 2015 14:46:04 +0000 (10:46 -0400)

format_config: don't init strbuf

It's unusual for a function which writes to a passed-in
strbuf to call strbuf_init; that will throw away anything
already there, leaking memory. In this case, there are
exactly two callers; one relies on this initialization and
the other passes in an already-initialized buffer.

There's no leak, as the initialized buffer doesn't have
anything in it. But let's bump the strbuf_init out to the
one caller who needs it, making format_config more
idiomatic.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

config: restructure format_config() for better control... SZEDER Gábor Thu, 20 Aug 2015 14:14:22 +0000 (16:14 +0200)

config: restructure format_config() for better control flow

Commit 578625fa91 (config: add '--name-only' option to list only
variable names, 2015-08-10) modified format_config() such that it
returned from the middle of the function when showing only keys,
resulting in ugly code structure.

Reorganize the if statements and dealing with the key-value delimiter to
make the function easier to read.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t3020: fix typo in test descriptionSZEDER Gábor Thu, 20 Aug 2015 13:58:55 +0000 (15:58 +0200)

t3020: fix typo in test description

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

ps_matched: xcalloc() takes nmemb and then element... Junio C Hamano Thu, 20 Aug 2015 16:57:32 +0000 (09:57 -0700)

ps_matched: xcalloc() takes nmemb and then element size

Even though multiplication is commutative, the order of arguments
should be xcalloc(nmemb, size). ps_matched is an array of 1-byte
element whose size is the same as the number of pathspec elements.

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Sync with maintJunio C Hamano Wed, 19 Aug 2015 21:49:37 +0000 (14:49 -0700)

Sync with maint

* maint:
Start preparing for 2.5.1

Fourth batch for 2.6Junio C Hamano Wed, 19 Aug 2015 21:46:09 +0000 (14:46 -0700)

Fourth batch for 2.6

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'tb/complete-rebase-i-edit-todo'Junio C Hamano Wed, 19 Aug 2015 21:48:56 +0000 (14:48 -0700)

Merge branch 'tb/complete-rebase-i-edit-todo'

The command-line completion script (in contrib/) has been updated.

* tb/complete-rebase-i-edit-todo:
completion: offer '--edit-todo' during interactive rebase

Merge branch 'jk/git-path'Junio C Hamano Wed, 19 Aug 2015 21:48:56 +0000 (14:48 -0700)

Merge branch 'jk/git-path'

git_path() and mkpath() are handy helper functions but it is easy
to misuse, as the callers need to be careful to keep the number of
active results below 4. Their uses have been reduced.

* jk/git-path:
memoize common git-path "constant" files
get_repo_path: refactor path-allocation
find_hook: keep our own static buffer
refs.c: remove_empty_directories can take a strbuf
refs.c: avoid git_path assignment in lock_ref_sha1_basic
refs.c: avoid repeated git_path calls in rename_tmp_log
refs.c: simplify strbufs in reflog setup and writing
path.c: drop git_path_submodule
refs.c: remove extra git_path calls from read_loose_refs
remote.c: drop extraneous local variable from migrate_file
prefer mkpathdup to mkpath in assignments
prefer git_pathdup to git_path in some possibly-dangerous cases
add_to_alternates_file: don't add duplicate entries
t5700: modernize style
cache.h: complete set of git_path_submodule helpers
cache.h: clarify documentation for git_path, et al

Merge branch 'jc/finalize-temp-file'Junio C Hamano Wed, 19 Aug 2015 21:48:55 +0000 (14:48 -0700)

Merge branch 'jc/finalize-temp-file'

Long overdue micro clean-up.

* jc/finalize-temp-file:
sha1_file.c: rename move_temp_to_file() to finalize_object_file()

Merge branch 'ps/guess-repo-name-at-root'Junio C Hamano Wed, 19 Aug 2015 21:48:54 +0000 (14:48 -0700)

Merge branch 'ps/guess-repo-name-at-root'

"git clone $URL", when cloning from a site whose sole purpose is to
host a single repository (hence, no path after <scheme>://<site>/),
tried to use the site name as the new repository name, but did not
remove username or password when <site> part was of the form
<user>@<pass>:<host>. The code is taught to redact these.

* ps/guess-repo-name-at-root:
clone: abort if no dir name could be guessed
clone: do not use port number as dir name
clone: do not include authentication data in guessed dir

Merge branch 'jk/guess-repo-name-regression-fix'Junio C Hamano Wed, 19 Aug 2015 21:48:54 +0000 (14:48 -0700)

Merge branch 'jk/guess-repo-name-regression-fix'

"git clone $URL" in recent releases of Git contains a regression in
the code that invents a new repository name incorrectly based on
the $URL. This has been corrected.

* jk/guess-repo-name-regression-fix:
clone: use computed length in guess_dir_name
clone: add tests for output directory

Merge branch 'jk/negative-hiderefs'Junio C Hamano Wed, 19 Aug 2015 21:48:53 +0000 (14:48 -0700)

Merge branch 'jk/negative-hiderefs'

A negative !ref entry in multi-value transfer.hideRefs
configuration can be used to say "don't hide this one".

* jk/negative-hiderefs:
refs: support negative transfer.hideRefs
docs/config.txt: reorder hideRefs config

Merge branch 'jk/test-with-x'Junio C Hamano Wed, 19 Aug 2015 21:48:53 +0000 (14:48 -0700)

Merge branch 'jk/test-with-x'

Running tests with the "-x" option to make them verbose had some
unpleasant interactions with other features of the test suite.

* jk/test-with-x:
test-lib: disable trace when test is not verbose
test-lib: turn off "-x" tracing during chain-lint check

Merge branch 'ps/t1509-chroot-test-fixup'Junio C Hamano Wed, 19 Aug 2015 21:48:52 +0000 (14:48 -0700)

Merge branch 'ps/t1509-chroot-test-fixup'

t1509 test that requires a dedicated VM environment had some
bitrot, which has been corrected.

* ps/t1509-chroot-test-fixup:
tests: fix cleanup after tests in t1509-root-worktree
tests: fix broken && chains in t1509-root-worktree

Merge branch 'sb/check-return-from-read-ref'Junio C Hamano Wed, 19 Aug 2015 21:48:52 +0000 (14:48 -0700)

Merge branch 'sb/check-return-from-read-ref'

* sb/check-return-from-read-ref:
transport-helper: die on errors reading refs.

Merge branch 'mm/pull-upload-pack'Junio C Hamano Wed, 19 Aug 2015 21:48:51 +0000 (14:48 -0700)

Merge branch 'mm/pull-upload-pack'

"git pull" in recent releases of Git has a regression in the code
that allows custom path to the --upload-pack=<program>. This has
been corrected.

Note that this is irrelevant for 'master' with "git pull" rewritten
in C.

* mm/pull-upload-pack:
pull.sh: quote $upload_pack when passing it to git-fetch

Start preparing for 2.5.1Junio C Hamano Wed, 19 Aug 2015 21:26:31 +0000 (14:26 -0700)

Start preparing for 2.5.1

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'ta/docfix-index-format-tech' into maintJunio C Hamano Wed, 19 Aug 2015 21:41:34 +0000 (14:41 -0700)

Merge branch 'ta/docfix-index-format-tech' into maint

* ta/docfix-index-format-tech:
typofix for index-format.txt

Merge branch 'sb/parse-options-codeformat' into maintJunio C Hamano Wed, 19 Aug 2015 21:41:33 +0000 (14:41 -0700)

Merge branch 'sb/parse-options-codeformat' into maint

* sb/parse-options-codeformat:
parse-options: align curly braces for all options

Merge branch 'sb/remove-unused-var-from-builtin-add... Junio C Hamano Wed, 19 Aug 2015 21:41:33 +0000 (14:41 -0700)

Merge branch 'sb/remove-unused-var-from-builtin-add' into maint

* sb/remove-unused-var-from-builtin-add:
add: remove dead code

Merge branch 'kn/tag-doc-fix' into maintJunio C Hamano Wed, 19 Aug 2015 21:41:32 +0000 (14:41 -0700)

Merge branch 'kn/tag-doc-fix' into maint

* kn/tag-doc-fix:
Documentation/tag: remove double occurance of "<pattern>"

Merge branch 'es/doc-clean-outdated-tools' into maintJunio C Hamano Wed, 19 Aug 2015 21:41:31 +0000 (14:41 -0700)

Merge branch 'es/doc-clean-outdated-tools' into maint

* es/doc-clean-outdated-tools:
Documentation/git-tools: retire manually-maintained list
Documentation/git-tools: drop references to defunct tools
Documentation/git-tools: fix item text formatting
Documentation/git-tools: improve discoverability of Git wiki
Documentation/git: drop outdated Cogito reference

Merge branch 'nd/export-worktree' into maintJunio C Hamano Wed, 19 Aug 2015 21:41:30 +0000 (14:41 -0700)

Merge branch 'nd/export-worktree' into maint

Running an aliased command from a subdirectory when the .git thing
in the working tree is a gitfile pointing elsewhere did not work.

* nd/export-worktree:
setup: set env $GIT_WORK_TREE when work tree is set, like $GIT_DIR

Merge branch 'mh/fast-import-optimize-current-from... Junio C Hamano Wed, 19 Aug 2015 21:41:29 +0000 (14:41 -0700)

Merge branch 'mh/fast-import-optimize-current-from' into maint

Often a fast-import stream builds a new commit on top of the
previous commit it built, and it often unconditionally emits a
"from" command to specify the first parent, which can be omitted in
such a case. This caused fast-import to forget the tree of the
previous commit and then re-read it from scratch, which was
inefficient. Optimize for this common case.

* mh/fast-import-optimize-current-from:
fast-import: do less work when given "from" matches current branch head

Merge branch 'ib/scripted-parse-opt-better-hint-string... Junio C Hamano Wed, 19 Aug 2015 21:41:29 +0000 (14:41 -0700)

Merge branch 'ib/scripted-parse-opt-better-hint-string' into maint

The "rev-parse --parseopt" mode parsed the option specification
and the argument hint in a strange way to allow '=' and other
special characters in the option name while forbidding them from
the argument hint. This made it impossible to define an option
like "--pair <key>=<value>" with "pair=key=value" specification,
which instead would have defined a "--pair=key <value>" option.

* ib/scripted-parse-opt-better-hint-string:
rev-parse --parseopt: allow [*=?!] in argument hints

Merge branch 'se/doc-checkout-ours-theirs' into maintJunio C Hamano Wed, 19 Aug 2015 21:41:28 +0000 (14:41 -0700)

Merge branch 'se/doc-checkout-ours-theirs' into maint

A "rebase" replays changes of the local branch on top of something
else, as such they are placed in stage #3 and referred to as
"theirs", while the changes in the new base, typically a foreign
work, are placed in stage #2 and referred to as "ours". Clarify
the "checkout --ours/--theirs".

* se/doc-checkout-ours-theirs:
checkout: document subtlety around --ours/--theirs

Merge branch 'cb/uname-in-untracked' into maintJunio C Hamano Wed, 19 Aug 2015 21:41:27 +0000 (14:41 -0700)

Merge branch 'cb/uname-in-untracked' into maint

An experimental "untracked cache" feature used uname(2) in a
slightly unportable way.

* cb/uname-in-untracked:
untracked: fix detection of uname(2) failure

Merge branch 'as/sparse-checkout-removal' into maintJunio C Hamano Wed, 19 Aug 2015 21:41:27 +0000 (14:41 -0700)

Merge branch 'as/sparse-checkout-removal' into maint

"sparse checkout" misbehaved for a path that is excluded from the
checkout when switching between branches that differ at the path.

* as/sparse-checkout-removal:
unpack-trees: don't update files with CE_WT_REMOVE set

Merge branch 'db/send-pack-user-signingkey' into maintJunio C Hamano Wed, 19 Aug 2015 21:41:26 +0000 (14:41 -0700)

Merge branch 'db/send-pack-user-signingkey' into maint

The low-level "git send-pack" did not honor 'user.signingkey'
configuration variable when sending a signed-push.

* db/send-pack-user-signingkey:
builtin/send-pack.c: respect user.signingkey

Merge branch 'jx/do-not-crash-receive-pack-wo-head... Junio C Hamano Wed, 19 Aug 2015 21:41:26 +0000 (14:41 -0700)

Merge branch 'jx/do-not-crash-receive-pack-wo-head' into maint

An attempt to delete a ref by pushing into a repositorywhose HEAD
symbolic reference points at an unborn branch that cannot be
created due to ref D/F conflict (e.g. refs/heads/a/b exists, HEAD
points at refs/heads/a) failed.

* jx/do-not-crash-receive-pack-wo-head:
receive-pack: crash when checking with non-exist HEAD

Merge branch 'da/subtree-date-confusion' into maintJunio C Hamano Wed, 19 Aug 2015 21:41:24 +0000 (14:41 -0700)

Merge branch 'da/subtree-date-confusion' into maint

"git subtree" (in contrib/) depended on "git log" output to be
stable, which was a no-no. Apply a workaround to force a
particular date format.

* da/subtree-date-confusion:
contrib/subtree: ignore log.date configuration

push: add a config option push.gpgSign for default... Dave Borowitz Wed, 19 Aug 2015 15:26:47 +0000 (11:26 -0400)

push: add a config option push.gpgSign for default signed pushes

Signed-off-by: Dave Borowitz <dborowitz@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

push: support signing pushes iff the server supports itDave Borowitz Wed, 19 Aug 2015 15:26:46 +0000 (11:26 -0400)

push: support signing pushes iff the server supports it

Add a new flag --sign=true (or --sign=false), which means the same
thing as the original --signed (or --no-signed). Give it a third
value --sign=if-asked to tell push and send-pack to send a push
certificate if and only if the server advertised a push cert nonce.

If not, warn the user that their push may not be as secure as they
thought.

Signed-off-by: Dave Borowitz <dborowitz@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

builtin/send-pack.c: use parse_options APIDave Borowitz Wed, 19 Aug 2015 15:26:45 +0000 (11:26 -0400)

builtin/send-pack.c: use parse_options API

The old option parsing code in this plumbing command predates this
API, so option parsing was done more manually. Using the new API
brings send-pack more in line with push, and accepts new variants
like --no-* for negating options.

Signed-off-by: Dave Borowitz <dborowitz@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

config.c: rename git_config_maybe_bool_text and export... Dave Borowitz Wed, 19 Aug 2015 15:26:44 +0000 (11:26 -0400)

config.c: rename git_config_maybe_bool_text and export it as git_parse_maybe_bool

This helper function does not complain about the config variable
but just silently reports failure to the caller. It is useful for
callers that need to parse any string that could be boolean or other
string (e.g. tristate yes/no/auto).

Signed-off-by: Dave Borowitz <dborowitz@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

transport: remove git_transport_options.push_certDave Borowitz Wed, 19 Aug 2015 15:26:43 +0000 (11:26 -0400)

transport: remove git_transport_options.push_cert

This field was set in transport_set_option, but never read in the push
code. The push code basically ignores the smart_options field
entirely, and derives its options from the flags arguments to the
push* callbacks. Note that in git_transport_push there are already
several args set from flags that have no corresponding field in
git_transport_options; after this change, push_cert is just like
those.

Signed-off-by: Dave Borowitz <dborowitz@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

gitremote-helpers.txt: document pushcert optionDave Borowitz Wed, 19 Aug 2015 15:26:42 +0000 (11:26 -0400)

gitremote-helpers.txt: document pushcert option

Signed-off-by: Dave Borowitz <dborowitz@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Documentation/git-send-pack.txt: document --signedDave Borowitz Wed, 19 Aug 2015 15:26:41 +0000 (11:26 -0400)

Documentation/git-send-pack.txt: document --signed

Signed-off-by: Dave Borowitz <dborowitz@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Documentation/git-send-pack.txt: wrap long synopsis... Dave Borowitz Wed, 19 Aug 2015 15:26:40 +0000 (11:26 -0400)

Documentation/git-send-pack.txt: wrap long synopsis line

Signed-off-by: Dave Borowitz <dborowitz@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Documentation/git-push.txt: document when --signed... Dave Borowitz Wed, 19 Aug 2015 15:26:39 +0000 (11:26 -0400)

Documentation/git-push.txt: document when --signed may fail

Like --atomic, --signed will fail if the server does not advertise the
necessary capability. In addition, it requires gpg on the client side.

Signed-off-by: Dave Borowitz <dborowitz@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

submodule: allow erroneous values for the fetchRecurseS... Heiko Voigt Tue, 18 Aug 2015 00:22:00 +0000 (17:22 -0700)

submodule: allow erroneous values for the fetchRecurseSubmodules option

We should not die when reading the submodule config cache since the
user might not be able to get out of that situation when the
configuration is part of the history.

We should handle this condition later when the value is about to be
used.

Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net>
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

submodule: use new config API for worktree configurationsHeiko Voigt Tue, 18 Aug 2015 00:21:59 +0000 (17:21 -0700)

submodule: use new config API for worktree configurations

We remove the extracted functions and directly parse into and read out
of the cache. This allows us to have one unified way of accessing
submodule configuration values specific to single submodules. Regardless
whether we need to access a configuration from history or from the
worktree.

Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

submodule: extract functions for config set and lookupHeiko Voigt Tue, 18 Aug 2015 00:21:58 +0000 (17:21 -0700)

submodule: extract functions for config set and lookup

This is one step towards using the new configuration API. We just
extract these functions to make replacing the actual code easier.

Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net>
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

submodule: implement a config API for lookup of .gitmod... Heiko Voigt Tue, 18 Aug 2015 00:21:57 +0000 (17:21 -0700)

submodule: implement a config API for lookup of .gitmodules values

In a superproject some commands need to interact with submodules. They
need to query values from the .gitmodules file either from the worktree
of from certain revisions. At the moment this is quite hard since a
caller would need to read the .gitmodules file from the history and then
parse the values. We want to provide an API for this so we have one
place to get values from .gitmodules from any revision (including the
worktree).

The API is realized as a cache which allows us to lazily read
.gitmodules configurations by commit into a runtime cache which can then
be used to easily lookup values from it. Currently only the values for
path or name are stored but it can be extended for any value needed.

It is expected that .gitmodules files do not change often between
commits. Thats why we lookup the .gitmodules sha1 from a commit and then
either lookup an already parsed configuration or parse and cache an
unknown one for each sha1. The cache is lazily build on demand for each
requested commit.

This cache can be used for all purposes which need knowledge about
submodule configurations. Example use cases are:

* Recursive submodule checkout needs to lookup a submodule name from
its path when a submodule first appears. This needs be done before
this configuration exists in the worktree.

* The implementation of submodule support for 'git archive' needs to
lookup the submodule name to generate the archive when given a
revision that is not checked out.

* 'git fetch' when given the --recurse-submodules=on-demand option (or
configuration) needs to lookup submodule names by path from the
database rather than reading from the worktree. For new submodule it
needs to lookup the name from its path to allow cloning new
submodules into the .git folder so they can be checked out without
any network interaction when the user does a checkout of that
revision.

Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net>
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

am --skip/--abort: merge HEAD/ORIG_HEAD tree into indexPaul Tan Wed, 19 Aug 2015 08:22:22 +0000 (16:22 +0800)

am --skip/--abort: merge HEAD/ORIG_HEAD tree into index

After running "git am --abort", and then running "git reset --hard",
files that were not modified would still be re-checked out.

This is because clean_index() in builtin/am.c mistakenly called the
read_tree() function, which overwrites all entries in the index,
including the stat info.

"git am --skip" did not seem to have this issue because am_skip() called
am_run(), which called refresh_cache() to update the stat info. However,
there's still a performance penalty as the lack of stat info meant that
refresh_cache() would have to scan all files for changes.

Fix this by using unpack_trees() instead to merge the tree into the
index, so that the stat info from the index is kept.

Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Paul Tan <pyokagan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

untracked cache: fix entry invalidationNguyễn Thái Ngọc Duy Wed, 19 Aug 2015 13:01:26 +0000 (20:01 +0700)

untracked cache: fix entry invalidation

First, the current code in untracked_cache_invalidate_path() is wrong
because it can only handle paths "a" or "a/b", not "a/b/c" because
lookup_untracked() only looks for entries directly under the given
directory. In the last case, it will look for the entry "b/c" in
directory "a" instead. This means if you delete or add an entry in a
subdirectory, untracked cache may become out of date because it does not
invalidate properly. This is noticed by David Turner.

The second problem is about invalidation inside a fully untracked/excluded
directory. In this case we may have to invalidate back to root. See the
comment block for detail.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

untracked-cache: fix subdirectory handlingDavid Turner Wed, 19 Aug 2015 13:01:25 +0000 (20:01 +0700)

untracked-cache: fix subdirectory handling

Previously, some calls lookup_untracked would pass a full path. But
lookup_untracked assumes that the portion of the path up to and
including to the untracked_cache_dir has been removed. So
lookup_untracked would be looking in the untracked_cache for 'foo' for
'foo/bar' (instead of just looking for 'bar'). This would cause
untracked cache corruption.

Instead, treat_directory learns to track the base length of the parent
directory, so that only the last path component is passed to
lookup_untracked.

Helped-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: David Turner <dturner@twopensource.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>