gitweb.git
git-remote-mediawiki: use no-private-update capability... Matthieu Moy Mon, 2 Sep 2013 07:19:47 +0000 (09:19 +0200)

git-remote-mediawiki: use no-private-update capability on dumb push

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

transport-helper: add no-private-update capabilityMatthieu Moy Tue, 3 Sep 2013 15:45:14 +0000 (17:45 +0200)

transport-helper: add no-private-update capability

Since 664059fb (transport-helper: update remote helper namespace,
2013-04-17), a 'push' operation on a remote helper updates the
private ref by default. This is often a good thing, but it can also
be desirable to disable this update to force the next 'pull' to
re-import the pushed revisions.

Allow remote-helpers to disable the automatic update by introducing a new
capability.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

add: trivial style cleanupFelipe Contreras Fri, 30 Aug 2013 21:56:49 +0000 (16:56 -0500)

add: trivial style cleanup

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

reset: trivial style cleanupFelipe Contreras Fri, 30 Aug 2013 21:56:48 +0000 (16:56 -0500)

reset: trivial style cleanup

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

branch: trivial style fixFelipe Contreras Fri, 30 Aug 2013 21:56:46 +0000 (16:56 -0500)

branch: trivial style fix

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

reset: trivial refactoringFelipe Contreras Fri, 30 Aug 2013 21:56:45 +0000 (16:56 -0500)

reset: trivial refactoring

After commit 3fde386 (reset [--mixed]: use diff-based reset whether or
not pathspec was given), some code can be moved to the 'reset_type ==
MIXED' check.

Let's move the code that is specific to MIXED.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

gitweb: Fix the author initials in blame for non-ASCII... Ævar Arnfjörð Bjarmason Fri, 30 Aug 2013 08:37:01 +0000 (08:37 +0000)

gitweb: Fix the author initials in blame for non-ASCII names

Change the @author_initials feature Jakub added in
v1.6.4-rc2-14-ga36817b to match non-ASCII author initials as intended.

The regexp Jakub added was intended to match
non-ASCII (/\b([[:upper:]])\B/g). But in Perl this doesn't actually
match non-ASCII upper-case characters unless the string being matched
against has the UTF8 flag.

So when we open a pipe to "git blame" we need to mark the file
descriptor we're opening as utf8 explicitly.

So as a result it abbreviates me to "AB" not "ÆAB", entirely because "Æ"
isn't /[[:upper:]]/ unless the string being matched against has the UTF8
flag.

Here's something that demonstrates the issue:

#!/usr/bin/env perl
use strict;
use warnings;

binmode STDOUT, ':utf8' if $ENV{UTF8};
open my $fd, "-|", "git", "blame", "--incremental", "--", "Makefile" or die "Can't open: $!";
binmode $fd, ":utf8" if $ENV{UTF8};
while (my $line = <$fd>) {
next unless my ($author) = $line =~ /^author (.*)/;
my @author_initials = ($author =~ /\b([[:upper:]])\B/g);
printf "%s (%s)\n", join("", @author_initials), $author;
}

When that's run with and without UTF8 being true in the environment it
gives, on git.git:

$ UTF8=0 perl author-initials.pl | sort | uniq -c |
sort -nr | head -n 5
99 JH (Junio C Hamano)
35 JN (Jonathan Nieder)
35 JK (Jeff King)
20 JS (Johannes Schindelin)
16 AB (Ævar Arnfjörð Bjarmason)
$ UTF8=1 perl author-initials.pl | sort | uniq -c |
sort -nr | head -n 5
99 JH (Junio C Hamano)
35 JN (Jonathan Nieder)
35 JK (Jeff King)
20 JS (Johannes Schindelin)
16 ÆAB (Ævar Arnfjörð Bjarmason)

Acked-by: Jakub Narębski <jnareb@gmail.com>
Tested-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Tested-by: Simon Ruderich <simon@ruderich.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

has_sha1_file: re-check pack directory before giving upJeff King Fri, 30 Aug 2013 19:14:13 +0000 (15:14 -0400)

has_sha1_file: re-check pack directory before giving up

When we read a sha1 file, we first look for a packed
version, then a loose version, and then re-check the pack
directory again before concluding that we cannot find it.
This lets us handle a process that is writing to the
repository simultaneously (e.g., receive-pack writing a new
pack followed by a ref update, or git-repack packing
existing loose objects into a new pack).

However, we do not do the same trick with has_sha1_file; we
only check the packed objects once, followed by loose
objects. This means that we might incorrectly report that we
do not have an object, even though we could find it if we
simply re-checked the pack directory.

By itself, this is usually not a big deal. The other process
is running simultaneously, so we may run has_sha1_file
before it writes, anyway. It is a race whether we see the
object or not. However, we may also see other things
the writing process has done (like updating refs); and in
that case, we must be able to also see the new objects.

For example, imagine we are doing a for_each_ref iteration,
and somebody simultaneously pushes. Receive-pack may write
the pack and update a ref after we have examined the
objects/pack directory, but before the iteration gets to the
updated ref. When we do finally see the updated ref,
for_each_ref will call has_sha1_file to check whether the
ref is broken. If has_sha1_file returns the wrong answer, we
erroneously will think that the ref is broken.

For a normal iteration without DO_FOR_EACH_INCLUDE_BROKEN,
this means that the caller does not see the ref at all
(neither the old nor the new value). So not only will we
fail to see the new value of the ref (which is acceptable,
since we are running simultaneously with the writer, and we
might well read the ref before the writer commits its
write), but we will not see the old value either. For
programs that act on reachability like pack-objects or
prune, this can cause data loss, as we may see the objects
referenced by the original ref value as dangling (and either
omit them from the pack, or delete them via prune).

There's no test included here, because the success case is
two processes running simultaneously forever. But you can
replicate the issue with:

# base.sh
# run this in one terminal; it creates and pushes
# repeatedly to a repository
git init parent &&
(cd parent &&

# create a base commit that will trigger us looking at
# the objects/pack directory before we hit the updated ref
echo content >file &&
git add file &&
git commit -m base &&

# set the unpack limit abnormally low, which
# lets us simulate full-size pushes using tiny ones
git config receive.unpackLimit 1
) &&
git clone parent child &&
cd child &&
n=0 &&
while true; do
echo $n >file && git add file && git commit -m $n &&
git push origin HEAD:refs/remotes/child/master &&
n=$(($n + 1))
done

# fsck.sh
# now run this simultaneously in another terminal; it
# repeatedly fscks, looking for us to consider the
# newly-pushed ref broken. We cannot use for-each-ref
# here, as it uses DO_FOR_EACH_INCLUDE_BROKEN, which
# skips the has_sha1_file check (and if it wants
# more information on the object, it will actually read
# the object, which does the proper two-step lookup)
cd parent &&
while true; do
broken=`git fsck 2>&1 | grep remotes/child`
if test -n "$broken"; then
echo $broken
exit 1
fi
done

Without this patch, the fsck loop fails within a few seconds
(and almost instantly if the test repository actually has a
large number of refs). With it, the two can run
indefinitely.

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

Start the post-1.8.4 cycleJunio C Hamano Fri, 30 Aug 2013 17:16:16 +0000 (10:16 -0700)

Start the post-1.8.4 cycle

It is tentatively called 1.8.5, but it should be an easy matter of
renaming the release-notes file and RelNotes symlink to later call
it 1.9 near the end of the cycle if we wanted to.

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

Merge branch 'bc/completion-for-bash-3.0'Junio C Hamano Fri, 30 Aug 2013 17:10:55 +0000 (10:10 -0700)

Merge branch 'bc/completion-for-bash-3.0'

Some people still use rather old versions of bash, which cannot
grok some constructs like 'printf -v varname' the prompt and
completion code started to use recently.

* bc/completion-for-bash-3.0:
contrib/git-prompt.sh: handle missing 'printf -v' more gracefully
t9902-completion.sh: old Bash still does not support array+=('') notation
git-completion.bash: use correct Bash/Zsh array length syntax

Merge branch 'sp/doc-smart-http'Junio C Hamano Fri, 30 Aug 2013 17:10:51 +0000 (10:10 -0700)

Merge branch 'sp/doc-smart-http'

* sp/doc-smart-http:
Document the HTTP transport protocols

Merge branch 'mm/war-on-whatchanged'Junio C Hamano Fri, 30 Aug 2013 17:08:26 +0000 (10:08 -0700)

Merge branch 'mm/war-on-whatchanged'

* mm/war-on-whatchanged:
whatchanged: document its historical nature
core-tutorial: trim the section on Inspecting Changes

Merge branch 'rt/doc-merge-file-diff3'Junio C Hamano Fri, 30 Aug 2013 17:08:23 +0000 (10:08 -0700)

Merge branch 'rt/doc-merge-file-diff3'

* rt/doc-merge-file-diff3:
Documentation/git-merge-file: document option "--diff3"

Merge branch 'mb/docs-favor-en-us'Junio C Hamano Fri, 30 Aug 2013 17:08:19 +0000 (10:08 -0700)

Merge branch 'mb/docs-favor-en-us'

Declare that the official grammar & spelling of the source of this
project is en_US, but strongly discourage patches only to "fix"
existing en_UK strings to avoid unnecessary churns.

* mb/docs-favor-en-us:
Provide some linguistic guidance for the documentation.

Merge branch 'rj/doc-rev-parse'Junio C Hamano Fri, 30 Aug 2013 17:08:12 +0000 (10:08 -0700)

Merge branch 'rj/doc-rev-parse'

* rj/doc-rev-parse:
rev-parse(1): logically group options
rev-parse: remove restrictions on some options

Merge branch 'hv/config-from-blob'Junio C Hamano Fri, 30 Aug 2013 17:06:52 +0000 (10:06 -0700)

Merge branch 'hv/config-from-blob'

Portability fix.

* hv/config-from-blob:
config: do not use C function names as struct members

Merge branch 'nd/fetch-pack-shallow-fix'Junio C Hamano Fri, 30 Aug 2013 17:05:55 +0000 (10:05 -0700)

Merge branch 'nd/fetch-pack-shallow-fix'

The recent "short-cut clone connectivity check" topic broke a
shallow repository when a fetch operation tries to auto-follow tags.

* nd/fetch-pack-shallow-fix:
fetch-pack: do not remove .git/shallow file when --depth is not specified

fix shell syntax error in templateThorsten Glaser Fri, 30 Aug 2013 10:40:30 +0000 (12:40 +0200)

fix shell syntax error in template

An if clause must not be empty; add a "colon" command.

Signed-off-by: Thorsten Glaser <t.glaser@tarent.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

l10n: fr.po: hotfix for commit 6b388fcSebastien Helleu Sun, 25 Aug 2013 09:45:13 +0000 (11:45 +0200)

l10n: fr.po: hotfix for commit 6b388fc

Fix many typos and add some new translations (1277/2080 messages
translated).

Closes git-l10n/git-po/pull/63.

Signed-off-by: Sebastien Helleu <flashcode@flashtux.org>
Signed-off-by: Jean-Noel Avila <jn.avila@free.fr>
Signed-off-by: Jiang Xin <worldhello.net@gmail.com>

git-remote-mediawiki: add test and check Makefile targetsMatthieu Moy Thu, 29 Aug 2013 18:58:21 +0000 (20:58 +0200)

git-remote-mediawiki: add test and check Makefile targets

There are a few level 4 and 2 perlcritic issues in the current code. We
make level 5 fatal, and keep level 2 as warnings.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

config: rewrite core.pager documentationJunio C Hamano Wed, 28 Aug 2013 20:26:12 +0000 (13:26 -0700)

config: rewrite core.pager documentation

The text mentions core.pager and GIT_PAGER without giving the
overall picture of precedences. Borrow a better description from
the git-var(1) documentation.

The use of the mechanism to allow system-wide, global and
per-repository configuration files is not limited to this particular
variable. Remove it to clarify the paragraph.

Rewrite the part that explains how the environment variable LESS is
set to Git's default value, and how to selectively customize it.

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

write_index: optionally allow broken null sha1sJeff King Tue, 27 Aug 2013 20:41:12 +0000 (16:41 -0400)

write_index: optionally allow broken null sha1s

Commit 4337b58 (do not write null sha1s to on-disk index,
2012-07-28) added a safety check preventing git from writing
null sha1s into the index. The intent was to catch errors in
other parts of the code that might let such an entry slip
into the index (or worse, a tree).

Some existing repositories may have invalid trees that
contain null sha1s already, though. Until 4337b58, a common
way to clean this up would be to use git-filter-branch's
index-filter to repair such broken entries. That now fails
when filter-branch tries to write out the index.

Introduce a GIT_ALLOW_NULL_SHA1 environment variable to
relax this check and make it easier to recover from such a
history.

It is tempting to not involve filter-branch in this commit
at all, and instead require the user to manually invoke

GIT_ALLOW_NULL_SHA1=1 git filter-branch ...

to perform an index-filter on a history with trees with null
sha1s. That would be slightly safer, but requires some
specialized knowledge from the user. So let's set the
GIT_ALLOW_NULL_SHA1 variable automatically when checking out
the to-be-filtered trees. Advice on using filter-branch to
remove such entries already exists on places like
stackoverflow, and this patch makes it Just Work again on
recent versions of git.

Further commands that touch the index will still notice and
fail, unless they actually remove the broken entries. A
filter-branch whose filters do not touch the index at all
will not error out (since we complain of the null sha1 only
on writing, not when making a tree out of the index), but
this is acceptable, as we still print a loud warning, so the
problem is unlikely to go unnoticed.

Signed-off-by: Jeff King <peff@peff.net>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

builtin/fetch.c: Fix a sparse warningRamsay Jones Wed, 28 Aug 2013 18:56:17 +0000 (19:56 +0100)

builtin/fetch.c: Fix a sparse warning

Sparse issues an "'prepare_transport' was not declared. Should it
be static?" warning. In order to suppress the warning, since this
symbol only requires file scope, we simply add the static modifier
to it's declaration.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

diff --no-index: describe in a separate paragraphJunio C Hamano Wed, 28 Aug 2013 22:17:18 +0000 (15:17 -0700)

diff --no-index: describe in a separate paragraph

The documentation for "diff-files" mode of "git diff" primarily
talks about how changes in the files in the working tree are shown
relative to the contents previously added to that index, and tucks
explanation on how "--no-index" mode, which works in a quite
different way, may be implicitly used instead. Instead, add a
separate paragraph to explain what "--no-index" mode does, and also
mention when "--no-index" can be omitted from the command line
(essentially, when it is obvious from the context).

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

documentation: clarify notes for clean.requireForceJiang Xin Wed, 28 Aug 2013 01:28:32 +0000 (09:28 +0800)

documentation: clarify notes for clean.requireForce

Add "-i" (interactive clean option) to clarify the documentation for
"clean.requireForce" config variable.

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

mailmap: handle mailmap blobs without trailing newlinesJeff King Wed, 28 Aug 2013 01:41:39 +0000 (21:41 -0400)

mailmap: handle mailmap blobs without trailing newlines

The read_mailmap_buf function reads each line of the mailmap
using strchrnul, like:

const char *end = strchrnul(buf, '\n');
unsigned long linelen = end - buf + 1;

But that's off-by-one when we actually hit the NUL byte; our
line does not have a terminator, and so is only "end - buf"
bytes long. As a result, when we subtract the linelen from
the total len, we end up with (unsigned long)-1 bytes left
in the buffer, and we start reading random junk from memory.

We could fix it with:

unsigned long linelen = end - buf + !!*end;

but let's take a step back for a moment. It's questionable
in the first place for a function that takes a buffer and
length to be using strchrnul. But it works because we only
have one caller (and are only likely to ever have this one),
which is handing us data from read_sha1_file. Which means
that it's always NUL-terminated.

Instead of tightening the assumptions to make the
buffer/length pair work for a caller that doesn't actually
exist, let's let loosen the assumptions to what the real
caller has: a modifiable, NUL-terminated string.

This makes the code simpler and shorter (because we don't
have to correlate strchrnul with the length calculation),
correct (because the code with the off-by-one just goes
away), and more efficient (we can drop the extra allocation
we needed to create NUL-terminated strings for each line,
and just terminate in place).

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

"git prune" is safeThomas Ackermann Tue, 27 Aug 2013 18:05:50 +0000 (20:05 +0200)

"git prune" is safe

"git prune" is safe in case of concurrent accesses to a repository
but using it in such a case is not recommended.

Signed-off-by: Thomas Ackermann <th.acker@arcor.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Remove irrelevant reference from "Tying it all together"Thomas Ackermann Tue, 27 Aug 2013 18:04:58 +0000 (20:04 +0200)

Remove irrelevant reference from "Tying it all together"

Sorry Jon, but this might not be of any help to new Git users ;)

Acked-by: Jon Loeliger <jdl@jdl.com>
Signed-off-by: Thomas Ackermann <th.acker@arcor.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Remove unnecessary historical note from "Object storage... Thomas Ackermann Tue, 27 Aug 2013 18:04:08 +0000 (20:04 +0200)

Remove unnecessary historical note from "Object storage format"

Signed-off-by: Thomas Ackermann <th.acker@arcor.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Improve section "Merging multiple trees"Thomas Ackermann Tue, 27 Aug 2013 18:03:09 +0000 (20:03 +0200)

Improve section "Merging multiple trees"

Remove unnecessary quoting.
Simplify description of three-way merge.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Thomas Ackermann <th.acker@arcor.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Improve section "Manipulating branches"Thomas Ackermann Tue, 27 Aug 2013 18:02:08 +0000 (20:02 +0200)

Improve section "Manipulating branches"

Add some missing punctuation.
Simplify description of "git branch -d/-D".

Signed-off-by: Thomas Ackermann <th.acker@arcor.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Simplify "How to make a commit"Thomas Ackermann Tue, 27 Aug 2013 18:01:17 +0000 (20:01 +0200)

Simplify "How to make a commit"

Combine the two cases for "git add" into one.
Add verb "use" to "git rm" case.

Signed-off-by: Thomas Ackermann <th.acker@arcor.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Fix some typos and improve wordingThomas Ackermann Tue, 27 Aug 2013 17:59:21 +0000 (19:59 +0200)

Fix some typos and improve wording

Signed-off-by: Thomas Ackermann <th.acker@arcor.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Use "git merge" instead of "git pull ."Thomas Ackermann Tue, 27 Aug 2013 17:58:18 +0000 (19:58 +0200)

Use "git merge" instead of "git pull ."

"git pull ." works, but "git merge" is the recommended
way for new users to do things. (The old description
also should have read "The former is actually *not* very
commonly used".)

Signed-off-by: Thomas Ackermann <th.acker@arcor.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Use current output for "git repack"Thomas Ackermann Tue, 27 Aug 2013 17:56:50 +0000 (19:56 +0200)

Use current output for "git repack"

Signed-off-by: Thomas Ackermann <th.acker@arcor.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Use current "detached HEAD" messageThomas Ackermann Tue, 27 Aug 2013 17:56:04 +0000 (19:56 +0200)

Use current "detached HEAD" message

Signed-off-by: Thomas Ackermann <th.acker@arcor.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Call it "Git User Manual" and remove reference to very... Thomas Ackermann Tue, 27 Aug 2013 17:55:15 +0000 (19:55 +0200)

Call it "Git User Manual" and remove reference to very old Git version

Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Thomas Ackermann <th.acker@arcor.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Set core.precomposeunicode to true on e.g. HFS+Torsten Bögershausen Tue, 27 Aug 2013 13:50:40 +0000 (15:50 +0200)

Set core.precomposeunicode to true on e.g. HFS+

When core.precomposeunicode was introduced in 76759c7d,
it was set to false on a unicode decomposing file system like HFS+
to be compatible with older versions of Git.

The Mac OS users need to find out that this configuration exist
and change it manually from false to true.

A smoother workflow can be achieved,
so set core.precomposeunicode to true on a decomposing file system.

Signed-off-by: Torsten Bögershausen <tboegi@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

config: do not use C function names as struct membersJeff King Mon, 26 Aug 2013 21:57:18 +0000 (17:57 -0400)

config: do not use C function names as struct members

According to C99, section 7.1.4:

Any function declared in a header may be additionally
implemented as a function-like macro defined in the
header.

Therefore calling our struct member function pointer "fgetc"
may run afoul of unwanted macro expansion when we call:

char c = cf->fgetc(cf);

This turned out to be a problem on uclibc, which defines
fgetc as a macro and causes compilation failure.

The standard suggests fixing this in a few ways:

1. Using extra parentheses to inhibit the function-like
macro expansion. E.g., "(cf->fgetc)(cf)". This is
undesirable as it's ugly, and each call site needs to
remember to use it (and on systems without the macro,
forgetting will compile just fine).

2. Using #undef (because a conforming implementation must
also be providing fgetc as a function). This is
undesirable because presumably the implementation was
using the macro for a performance benefit, and we are
dropping that optimization.

Instead, we can simply use non-colliding names.

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

Documentation/remote-helpers: document common use-case... Matthieu Moy Mon, 26 Aug 2013 09:21:39 +0000 (11:21 +0200)

Documentation/remote-helpers: document common use-case for private ref

The current documentation mentions the private ref namespace, but does
not really explain why it can be useful.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

rebase -i: fix short SHA-1 collisionJunio C Hamano Sat, 24 Aug 2013 00:10:42 +0000 (20:10 -0400)

rebase -i: fix short SHA-1 collision

The 'todo' sheet for interactive rebase shows abbreviated SHA-1's and
then performs its operations upon those shortened values. This can lead
to an abort if the SHA-1 of a reworded or edited commit is no longer
unique within the abbreviated SHA-1 space and a subsequent SHA-1 in the
todo list has the same abbreviated value.

For example:

edit f00dfad first
pick badbeef second

If, after editing, the new SHA-1 of "first" also has prefix badbeef,
then the subsequent 'pick badbeef second' will fail since badbeef is no
longer a unique SHA-1 abbreviation:

error: short SHA1 badbeef is ambiguous.
fatal: Needed a single revision
Invalid commit name: badbeef

Fix this problem by expanding the SHA-1's in the todo list before
performing the operations.

[es: also collapse & expand SHA-1's for --edit-todo; respect
core.commentchar in transform_todo_ids(); compose commit message]

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

t3404: rebase -i: demonstrate short SHA-1 collisionEric Sunshine Sat, 24 Aug 2013 00:10:41 +0000 (20:10 -0400)

t3404: rebase -i: demonstrate short SHA-1 collision

The 'todo' sheet for interactive rebase shows abbreviated SHA-1's and
then performs its operations upon those shortened values. This can lead
to an abort if the SHA-1 of a reworded or edited commit is no longer
unique within the abbreviated SHA-1 space and a subsequent SHA-1 in the
todo list has the same abbreviated value.

For example:

edit f00dfad first
pick badbeef second

If, after editing, the new SHA-1 of "first" also has prefix badbeef,
then the subsequent 'pick badbeef second' will fail since badbeef is no
longer a unique SHA-1 abbreviation:

error: short SHA1 badbeef is ambiguous.
fatal: Needed a single revision
Invalid commit name: badbeef

Demonstrate this problem with a couple of specially crafted commits
which initially have distinct abbreviated SHA-1's, but for which the
abbreviated SHA-1's collide after a simple rewording of the first
commit's message.

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

t3404: make tests more self-containedEric Sunshine Sat, 24 Aug 2013 00:10:40 +0000 (20:10 -0400)

t3404: make tests more self-contained

As its very first action, t3404 installs (via set_fake_editor) a
specialized $EDITOR which simplifies automated 'rebase -i' testing. Many
tests rely upon this setting, thus tests which need a different editor
must take extra care upon completion to restore $EDITOR in order to
avoid breaking following tests. This places extra burden upon such tests
and requires that they undesirably have extra knowledge about
surrounding tests. Ease this burden by having each test install the
$EDITOR it requires, rather than relying upon a global setting.

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

fetch-pack: do not remove .git/shallow file when -... Nguyễn Thái Ngọc Duy Mon, 26 Aug 2013 02:17:26 +0000 (09:17 +0700)

fetch-pack: do not remove .git/shallow file when --depth is not specified

fetch_pack() can remove .git/shallow file when a shallow repository
becomes a full one again. This behavior is triggered incorrectly when
tags are also fetched because fetch_pack() will be called twice. At
the first fetch_pack() call:

- shallow_lock is set up
- alternate_shallow_file points to shallow_lock.filename, which is
"shallow.lock"
- commit_lock_file is called, which sets shallow_lock.filename to "".
alternate_shallow_file also becomes "" because it points to the
same memory.

At the second call, setup_alternate_shallow() is not called and
alternate_shallow_file remains "". It's mistaken as unshallow case and
.git/shallow is removed. The end result is a broken repository.

Fix this by always initializing alternate_shallow_file when
fetch_pack() is called. As an extra measure, check if args->depth > 0
before commit/rollback shallow file.

Reported-by: Kacper Kornet <kornet@camk.edu.pl>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Documentation/fast-import: clarify summary for `feature... Matthieu Moy Fri, 23 Aug 2013 08:29:20 +0000 (10:29 +0200)

Documentation/fast-import: clarify summary for `feature` command

In most cases, "feature <foo>" does not just require that the feature
exists, but also changes the behavior by enabling it.

Cases where the feature is only requested like cat-blob, notes or ls are
clearly documented below.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

reset test: modernize styleJonathan Nieder Sat, 24 Aug 2013 20:34:14 +0000 (13:34 -0700)

reset test: modernize style

Avoid command substitution and pipes to ensure that the exit status
from each git command is tested (and in particular that any segfaults
are caught).

Maintain the test setup (no commits, one file named "a", another named
"b") even after the last test, to make it easier to rearrange tests or
add new tests after the last in the future.

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

t/t7106-reset-unborn-branch.sh: Add PERL prerequisiteKacper Kornet Sat, 24 Aug 2013 04:01:46 +0000 (06:01 +0200)

t/t7106-reset-unborn-branch.sh: Add PERL prerequisite

The test 'reset -p' uses git-reset -p, so it depends on the perl code.

Signed-off-by: Kacper Kornet <draenog@pld-linux.org>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

add -i test: use skip_all instead of repeated PERL... Jonathan Nieder Sat, 24 Aug 2013 20:13:32 +0000 (13:13 -0700)

add -i test: use skip_all instead of repeated PERL prerequisite

It is too easy to forget to add the PERL prerequisite for new
"add -i" tests, especially given that many people do not test with
NO_PERL so the missing prereq is not always noticed quickly.

The test had used the skip_all mechanism since 1b19ccd2 (2009-04-03)
but switched to explicit PERL prereqs in f0459319 (2010-10-13) in hope
of helping people see how many tests were skipped, perhaps to motivate
them to tweak their platform or tests to improve test coverage. That
didn't pan out much in practice, so let's move back to the simpler
skip_all method.

Reported-by: Kacper Kornet <draenog@pld-linux.org>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Make test "using invalid commit with -C" more strictKacper Kornet Sat, 24 Aug 2013 04:01:44 +0000 (06:01 +0200)

Make test "using invalid commit with -C" more strict

In the test 'using invalid commit with -C' git-commit would have failed
even if the -C option had been given the correct commit, as there was
nothing to commit. Pass --allow-empty to make sure it would make a commit,
were there no issues with the argument given to the -C option.

Signed-off-by: Kacper Kornet <draenog@pld-linux.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

commit: search author pattern against mailmapAntoine Pelisse Fri, 23 Aug 2013 13:48:31 +0000 (15:48 +0200)

commit: search author pattern against mailmap

"git commit --author=$name" sets the author to one whose name
matches the given string from existing commits, when $name is not in
the "Name <e-mail>" format. However, it does not honor the mailmap
to use the canonical name for the author found this way.

Fix it by telling the logic to find a matching existing author to
honor the mailmap, and use the name and email after applying the
mailmap.

Signed-off-by: Antoine Pelisse <apelisse@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

dir.c::test_one_path(): work around directory_exists_in... Eric Sunshine Fri, 23 Aug 2013 23:26:59 +0000 (16:26 -0700)

dir.c::test_one_path(): work around directory_exists_in_index_icase() breakage

directory_exists_in_index() takes pathname and its length, but its
helper function directory_exists_in_index_icase() reads one byte
beyond the end of the pathname and expects there to be a '/'.

This needs to be fixed, as that one-byte-beyond-the-end location may
not even be readable, possibly by not registering directories to
name hashes with trailing slashes. In the meantime, update the new
caller added recently to treat_one_path() to make sure that the path
buffer it gives the function is one byte longer than the path it is
asking the function about by appending a slash to it.

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

remove dead pastebin link from pack-heuristics documentMichal Nazarewicz Fri, 23 Aug 2013 14:25:02 +0000 (16:25 +0200)

remove dead pastebin link from pack-heuristics document

Signed-off-by: Michal Nazarewicz <mina86@mina86.com>
Acked-by: Jon Loeliger <jdl@freescale.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Git 1.8.4 v1.8.4Junio C Hamano Fri, 23 Aug 2013 18:49:46 +0000 (11:49 -0700)

Git 1.8.4

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

diff --no-index: clarify operation when not inside... Dale R. Worley Thu, 22 Aug 2013 20:31:21 +0000 (16:31 -0400)

diff --no-index: clarify operation when not inside a repository

Clarify documentation for "diff --no-index". State that when not
inside a repository, --no-index is implied and two arguments are
mandatory.

Clarify error message from diff-no-index to inform user that CWD is
not inside a repository and thus two arguments are mandatory.

Signed-off-by: Dale Worley <worley@ariadne.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

contrib/git-prompt.sh: handle missing 'printf -v' more... Brandon Casey Thu, 22 Aug 2013 01:39:03 +0000 (18:39 -0700)

contrib/git-prompt.sh: handle missing 'printf -v' more gracefully

Old Bash (3.0) which is distributed with RHEL 4.X and other ancient
platforms that are still in wide use, do not have a printf that
supports -v. Neither does Zsh (which is already handled in the code).

As suggested by Junio, let's test whether printf supports the -v
option and store the result. Then later, we can use it to
determine whether 'printf -v' can be used, or whether printf
must be called in a subshell.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t9902-completion.sh: old Bash still does not support... Brandon Casey Wed, 21 Aug 2013 20:49:32 +0000 (13:49 -0700)

t9902-completion.sh: old Bash still does not support array+=('') notation

Old Bash (3.0) which is distributed with RHEL 4.X and other ancient
platforms that are still in wide use, does not understand the
array+=() notation. Let's use an explicit assignment to the new array
element which works everywhere, like:

array[${#array[@]}+1]=''

The right-hand side '' is not strictly necessary, but in this case
I think it is more clear.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-completion.bash: use correct Bash/Zsh array length... Brandon Casey Wed, 21 Aug 2013 20:49:31 +0000 (13:49 -0700)

git-completion.bash: use correct Bash/Zsh array length syntax

The syntax for retrieving the number of elements in an array is:

${#name[@]}

Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

rebase --preserve-merges: ignore "merge.log" configRalf Thielow Wed, 21 Aug 2013 18:48:57 +0000 (20:48 +0200)

rebase --preserve-merges: ignore "merge.log" config

When "merge.log" config is set, "rebase --preserve-merges" will add
the log lines to the message of the rebased merge commit. A rebase
should not modify a commit message automatically.

Teach "git-rebase" to ignore that configuration by passing
"--no-log" to the git-merge call.

Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Typofix draft release notes to 1.8.4Junio C Hamano Wed, 21 Aug 2013 22:30:04 +0000 (15:30 -0700)

Typofix draft release notes to 1.8.4

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

Document the HTTP transport protocolsShawn O. Pearce Wed, 21 Aug 2013 13:45:13 +0000 (20:45 +0700)

Document the HTTP transport protocols

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Revised-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

gitweb: make search help link less uglyTony Finch Tue, 20 Aug 2013 16:59:54 +0000 (17:59 +0100)

gitweb: make search help link less ugly

The search help link was a superscript question mark right next to
a drop-down menu, which looks misaligned and is a cramped and
awkward click target. Remove the superscript tags and add some
spacing to fix these nits. Add a title attribute to provide an
explanatory mouseover.

Signed-off-by: Tony Finch <dot@dotat.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

gitweb: omit the repository owner when it is unsetTony Finch Tue, 20 Aug 2013 16:59:44 +0000 (17:59 +0100)

gitweb: omit the repository owner when it is unset

On the repository summary page, leave the owner line out if the
repo does not have an owner, rather than displaying a labelled empty
field. This does not affect the owner column in the projects list
page, which is present unless $omit_owner is true.

Signed-off-by: Tony Finch <dot@dotat.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

gitweb: vertically centre contents of page footerTony Finch Tue, 20 Aug 2013 16:59:03 +0000 (17:59 +0100)

gitweb: vertically centre contents of page footer

Signed-off-by: Tony Finch <dot@dotat.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

gitweb: ensure OPML text fits inside its boxTony Finch Tue, 20 Aug 2013 16:59:02 +0000 (17:59 +0100)

gitweb: ensure OPML text fits inside its box

The rss_logo CSS style has a fixed width which is too narrow for
the string "OPML". Replace the fixed width with horizontal padding
so the text fits with nice margins.

Signed-off-by: Tony Finch <dot@dotat.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

read-cache: use fixed width integer typesThomas Gummerer Sun, 18 Aug 2013 19:41:51 +0000 (21:41 +0200)

read-cache: use fixed width integer types

Use the fixed width integer types uint16_t and uint32_t for on-disk
structures; unsigned short and unsigned int do not have a guaranteed
size.

Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

stream_to_pack: xread does not guarantee to read all... Johannes Sixt Tue, 20 Aug 2013 09:15:26 +0000 (11:15 +0200)

stream_to_pack: xread does not guarantee to read all requested bytes

The deflate loop in bulk-checkin::stream_to_pack expects to get all bytes
from a file that it requests to read in a single function call. But it
used xread(), which does not give that guarantee. Replace it by
read_in_full().

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Revert "compat/clipped-write.c: large write(2) fails... Steffen Prohaska Tue, 20 Aug 2013 06:43:55 +0000 (08:43 +0200)

Revert "compat/clipped-write.c: large write(2) fails on Mac OS X/XNU"

This reverts commit 6c642a878688adf46b226903858b53e2d31ac5c3.

The previous commit introduced a size limit on IO chunks on all
platforms. The compat clipped_write() is not needed anymore.

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

xread, xwrite: limit size of IO to 8MBSteffen Prohaska Tue, 20 Aug 2013 06:43:54 +0000 (08:43 +0200)

xread, xwrite: limit size of IO to 8MB

Checking out 2GB or more through an external filter (see test) fails
on Mac OS X 10.8.4 (12E55) for a 64-bit executable with:

error: read from external filter cat failed
error: cannot feed the input to external filter cat
error: cat died of signal 13
error: external filter cat failed 141
error: external filter cat failed

The reason is that read() immediately returns with EINVAL when asked
to read more than 2GB. According to POSIX [1], if the value of
nbyte passed to read() is greater than SSIZE_MAX, the result is
implementation-defined. The write function has the same restriction
[2]. Since OS X still supports running 32-bit executables, the
32-bit limit (SSIZE_MAX = INT_MAX = 2GB - 1) seems to be also
imposed on 64-bit executables under certain conditions. For write,
the problem has been addressed earlier [6c642a].

Address the problem for read() and write() differently, by limiting
size of IO chunks unconditionally on all platforms in xread() and
xwrite(). Large chunks only cause problems, like causing latencies
when killing the process, even if OS X was not buggy. Doing IO in
reasonably sized smaller chunks should have no negative impact on
performance.

The compat wrapper clipped_write() introduced earlier [6c642a] is
not needed anymore. It will be reverted in a separate commit. The
new test catches read and write problems.

Note that 'git add' exits with 0 even if it prints filtering errors
to stderr. The test, therefore, checks stderr. 'git add' should
probably be changed (sometime in another commit) to exit with
nonzero if filtering fails. The test could then be changed to use
test_must_fail.

Thanks to the following people for suggestions and testing:

Johannes Sixt <j6t@kdbg.org>
John Keeping <john@keeping.me.uk>
Jonathan Nieder <jrnieder@gmail.com>
Kyle J. McKay <mackyle@gmail.com>
Linus Torvalds <torvalds@linux-foundation.org>
Torsten Bögershausen <tboegi@web.de>

[1] http://pubs.opengroup.org/onlinepubs/009695399/functions/read.html
[2] http://pubs.opengroup.org/onlinepubs/009695399/functions/write.html

[6c642a] commit 6c642a878688adf46b226903858b53e2d31ac5c3
compate/clipped-write.c: large write(2) fails on Mac OS X/XNU

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

mailmap: remove redundant check for freeing memoryStefan Beller Tue, 20 Aug 2013 14:18:00 +0000 (16:18 +0200)

mailmap: remove redundant check for freeing memory

The condition as it is written in that line has already been checked
in the beginning of the function, which was introduced in
8503ee4 (2007-05-01, Fix read_mailmap to handle a caller uninterested
in repo abbreviation)

Helped-by: Jeff King <peff@peff.net>
Helped-by: Thomas Rast <trast@inf.ethz.ch>
Signed-off-by: Stefan Beller <stefanbeller@googlemail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

avoid segfault on submodule.*.path set to an empty... Jharrod LaFon Mon, 19 Aug 2013 16:26:56 +0000 (09:26 -0700)

avoid segfault on submodule.*.path set to an empty "true"

Git fails due to a segmentation fault if a submodule path is empty.
Here is an example .gitmodules that will cause a segmentation fault:

[submodule "foo-module"]
path
url = http://host/repo.git
$ git status
Segmentation fault (core dumped)

This is because the parsing of "submodule.*.path" is not prepared to
see a value-less "true" and assumes that the value is always
non-NULL (parsing of "ignore" has the same problem).

Fix it by checking the NULL-ness of value and complain with
config_error_nonbool().

Signed-off-by: Jharrod LaFon <jlafon@eyesopen.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Git 1.8.4-rc4 v1.8.4-rc4Junio C Hamano Mon, 19 Aug 2013 17:34:14 +0000 (10:34 -0700)

Git 1.8.4-rc4

As we had to revert two topics at the last minute, let's have
another (hopefully short) round of rc to make sure the final release
will be sound.

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

bash prompt: test the prompt with newline in repository... SZEDER Gábor Sat, 17 Aug 2013 09:01:58 +0000 (11:01 +0200)

bash prompt: test the prompt with newline in repository path

Newlines in the path to a git repository were not an issue for the
git-specific bash prompt before commit efaa0c1532 (bash prompt:
combine 'git rev-parse' executions in the main code path, 2013-06-17),
because the path returned by 'git rev-parse --git-dir' was directly
stored in a variable, and this variable was later always accessed
inside double quotes.

Newlines are not an issue after commit efaa0c1532 either, but it's
more subtle. Since efaa0c1532 we use the following single 'git
rev-parse' execution to query various info about the repository:

git rev-parse --git-dir --is-inside-git-dir \
--is-bare-repository --is-inside-work-tree

The results to these queries are separated by a newline character in
the output, e.g.:

/home/szeder/src/git/.git
false
false
true

A newline in the path to the git repository could potentially break
the parsing of these results and ultimately the bash prompt, unless
the parsing is done right. Commit efaa0c1532 got it right, as I
consciously started parsing 'git rev-parse's output from the end,
where each record is a single line containing either 'true' or 'false'
or, after e3e0b9378b (bash prompt: combine 'git rev-parse' for
detached head, 2013-06-24), the abbreviated commit object name, and
all what remains at the beginning is the path to the git repository,
no matter how many lines it is.

This subtlety really warrants its own test, especially since I didn't
explain it in the log message or in an in-code comment back then, so
add a test to excercise the prompt with newline characters in the path
to the repository. Guard this test with the FUNNYNAMES prerequisite,
because not all filesystems support newlines in filenames. Note that
'git rev-parse --git-dir' prints '.git' or '.' when at the top of the
worktree or the repository, respectively, and only prints the full
path to the repository when in a subdirectory, hence the need for
changing into a subdir in the test.

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

rebase -i: fix cases ignoring core.commentcharEric Sunshine Fri, 16 Aug 2013 21:44:07 +0000 (17:44 -0400)

rebase -i: fix cases ignoring core.commentchar

180bad3d (rebase -i: respect core.commentchar, 2013-02-11) updated
"rebase -i" to honor core.commentchar but missed one instance of
hard-coded '#' comment character in skip_unnecessary_picks().

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

create_delta_index: simplify condition always evaluatin... Stefan Beller Fri, 16 Aug 2013 21:22:37 +0000 (23:22 +0200)

create_delta_index: simplify condition always evaluating to true

The code sequence ' (1u << i) < hsize && i < 31 ' is a multi step
process, whose first step requires that 'i' is already less that 31,
otherwise the result (1u << i) is undefined (and 'undef_val < hsize'
can therefore be assumed to be 'false'), and so the later test i < 31
can always be optimized away as dead code ('i' is already less than 31,
or the short circuit 'and' applies).

So we need to get rid of that code. One way would be to exchange the
order of the conditions, so the expression 'i < 31 && (1u << i) < hsize'
would remove that optimized unstable code already.

However when checking the previous lines in that function, we can deduce
that 'hsize' must always be smaller than (1u<<31), since 506049c7df2c6
(fix >4GiB source delta assertion failure), because 'entries' is
capped at an upper bound of 0xfffffffeU, so 'hsize' contains a maximum
value of 0x3fffffff, which is smaller than (1u<<31), so the value of
'i' will never be larger than 31 and we can remove that condition
entirely.

Signed-off-by: Stefan Beller <stefanbeller@googlemail.com>
Acked-by: Nicolas Pitre <nico@fluxnic.net>
Acked-by: Philip Oakley <philipoakley@iee.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t3010: update to demonstrate "ls-files -k" optimization... Junio C Hamano Thu, 15 Aug 2013 20:51:09 +0000 (13:51 -0700)

t3010: update to demonstrate "ls-files -k" optimization pitfalls

An earlier draft of the previous step used cache_name_exists() to
check the directory we were looking at, which missed the second case
described in its log message. Demonstrate why it is not sufficient.

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

ls-files -k: a directory only can be killed if the... Junio C Hamano Thu, 15 Aug 2013 19:13:46 +0000 (12:13 -0700)

ls-files -k: a directory only can be killed if the index has a non-directory

"ls-files -o" and "ls-files -k" both traverse the working tree down
to find either all untracked paths or those that will be "killed"
(removed from the working tree to make room) when the paths recorded
in the index are checked out. It is necessary to traverse the
working tree fully when enumerating all the "other" paths, but when
we are only interested in "killed" paths, we can take advantage of
the fact that paths that do not overlap with entries in the index
can never be killed.

The treat_one_path() helper function, which is called during the
recursive traversal, is the ideal place to implement an
optimization.

When we are looking at a directory P in the working tree, there are
three cases:

(1) P exists in the index. Everything inside the directory P in
the working tree needs to go when P is checked out from the
index.

(2) P does not exist in the index, but there is P/Q in the index.
We know P will stay a directory when we check out the contents
of the index, but we do not know yet if there is a directory
P/Q in the working tree to be killed, so we need to recurse.

(3) P does not exist in the index, and there is no P/Q in the index
to require P to be a directory, either. Only in this case, we
know that everything inside P will not be killed without
recursing.

Note that this helper is called by treat_leading_path() that decides
if we need to traverse only subdirectories of a single common
leading directory, which is essential for this optimization to be
correct. This caller checks each level of the leading path
component from shallower directory to deeper ones, and that is what
allows us to only check if the path appears in the index. If the
call to treat_one_path() weren't there, given a path P/Q/R, the real
traversal may start from directory P/Q/R, even when the index
records P as a regular file, and we would end up having to check if
any leading subpath in P/Q/R, e.g. P, appears in the index.

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

dir.c: use the cache_* macro to access the current... Junio C Hamano Thu, 15 Aug 2013 19:08:45 +0000 (12:08 -0700)

dir.c: use the cache_* macro to access the current index

These codepaths always start from the_index and use index_*
functions, but there is no reason to do so. Use the compatibility
cache_* macro to access the current in-core index like everybody
else.

While at it, fix typo in the comment for a function to check if a
path within a directory appears in the index.

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

Revert "Add new @ shortcut for HEAD"Junio C Hamano Wed, 14 Aug 2013 17:57:24 +0000 (10:57 -0700)

Revert "Add new @ shortcut for HEAD"

This reverts commit cdfd94837b27c220f70f032b596ea993d195488f, as it
does not just apply to "@" (and forms with modifiers like @{u}
applied to it), but also affects e.g. "refs/heads/@/foo", which it
shouldn't.

The basic idea of giving a short-hand might be good, and the topic
can be retried later, but let's revert to avoid affecting existing
use cases for now for the upcoming release.

Revert "git stash: avoid data loss when "git stash... Junio C Hamano Wed, 14 Aug 2013 16:53:43 +0000 (09:53 -0700)

Revert "git stash: avoid data loss when "git stash save" kills a directory"

This reverts commit a73653130edd6a8977106d45a8092c09040f9132, as it
has been reported that "ls-files --killed" is too time-consuming in
a deep directory with too many untracked crufts (e.g. $HOME/.git
tracking only a few files).

We'd need to revisit it later but "ls-files --killed" needs to be
optimized before it happens.

unpack-trees: plug a memory leakFelipe Contreras Tue, 13 Aug 2013 18:27:58 +0000 (20:27 +0200)

unpack-trees: plug a memory leak

Before overwriting the destination index, first let's discard its
contents.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Tested-by: Лежанкин Иван <abyss.7@gmail.com> wrote:
Reviewed-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Git 1.8.4-rc3 v1.8.4-rc3Junio C Hamano Tue, 13 Aug 2013 18:10:18 +0000 (11:10 -0700)

Git 1.8.4-rc3

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

Merge git://github.com/git-l10n/git-poJunio C Hamano Tue, 13 Aug 2013 17:50:01 +0000 (10:50 -0700)

Merge git://github.com/git-l10n/git-po

* git://github.com/git-l10n/git-po:
l10n: Add reference for french translation team
l10n: fr.po: 821/2112 messages translated

Merge branch 'sb/mailmap-updates'Junio C Hamano Tue, 13 Aug 2013 17:49:33 +0000 (10:49 -0700)

Merge branch 'sb/mailmap-updates'

* sb/mailmap-updates:
.mailmap: Combine more (name, email) to individual persons
.mailmap: update long-lost friends with multiple defunct addresses

.mailmap: Combine more (name, email) to individual... Stefan Beller Mon, 12 Aug 2013 08:12:09 +0000 (10:12 +0200)

.mailmap: Combine more (name, email) to individual persons

Signed-off-by: Stefan Beller <stefanbeller@googlemail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

.mailmap: update long-lost friends with multiple defunc... Junio C Hamano Mon, 12 Aug 2013 07:58:11 +0000 (00:58 -0700)

.mailmap: update long-lost friends with multiple defunct addresses

A handful of past contributors are recorded with multiple e-mail
addresses, all of which are undeliverable. With a lot of help from
Jonathan, we located all of them except for one person, and a pair
of addresses we suspect belong to a single person but we are not
certain.

Update the found ones with their currently preferred address, and
use the last known address to consolidate contributions by the lost
one.

Helped-by: Stefan Beller <stefanbeller@googlemail.com>
Helped-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

push: respect --no-thinNguyễn Thái Ngọc Duy Mon, 12 Aug 2013 13:55:55 +0000 (20:55 +0700)

push: respect --no-thin

- From the beginning of push.c in 755225d, 2006-04-29, "thin" option
was enabled by default but could be turned off with --no-thin.

- Then Shawn changed the default to 0 in favor of saving server
resources in a4503a1, 2007-09-09. --no-thin worked great.

- One day later, in 9b28851 Daniel extracted some code from push.c to
create transport.c. He (probably accidentally) flipped the default
value from 0 to 1 in transport_get().

From then on --no-thin is effectively no-op because git-push still
expects the default value to be false and only calls
transport_set_option() when "thin" variable in push.c is true (which
is unnecessary). Correct the code to respect --no-thin by calling
transport_set_option() in both cases.

receive-pack learns about --reject-thin-pack-for-testing option,
which only is for testing purposes, hence no document update.

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

git-remote-mediawiki: ignore generated git-mwMatthieu Moy Tue, 13 Aug 2013 13:32:19 +0000 (15:32 +0200)

git-remote-mediawiki: ignore generated git-mw

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

contacts: reduce git-blame invocationsEric Sunshine Fri, 9 Aug 2013 21:39:56 +0000 (17:39 -0400)

contacts: reduce git-blame invocations

git-contacts invokes git-blame once for each patch hunk it encounters.
No attempt is made to consolidate invocations for multiple hunks
referencing the same file at the same revision. This can become
expensive quickly.

Reduce the number of git-blame invocations by taking advantage of the
ability to specify multiple -L ranges for a single invocation.

Without this patch, on a randomly chosen range of commits:

% time git-contacts 25fba78d36be6297^..23c339c0f262aad2 >/dev/null
real 0m6.142s
user 0m5.429s
sys 0m0.356s

With this patch:

% time git-contacts 25fba78d36be6297^..23c339c0f262aad2 >/dev/null
real 0m2.285s
user 0m2.093s
sys 0m0.165s

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

contacts: gather all blame sources prior to invoking... Eric Sunshine Fri, 9 Aug 2013 21:39:55 +0000 (17:39 -0400)

contacts: gather all blame sources prior to invoking git-blame

git-contacts invokes git-blame immediately upon encountering a patch
hunk. No attempt is made to consolidate invocations for multiple hunks
referencing the same file at the same revision. This can become
expensive quickly.

Any effort to reduce the number of times git-blame is run will need to
to know in advance which line ranges to blame per file per revision.
Make this information available by collecting all sources as a distinct
step from invoking git-blame. A subsequent patch will utilize the
information to optimize git-blame invocations.

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

contacts: validate hunk length earlierEric Sunshine Fri, 9 Aug 2013 21:39:54 +0000 (17:39 -0400)

contacts: validate hunk length earlier

Rather than calling get_blame() with a zero-length hunk only to have it
rejected immediately, perform hunk-length validation earlier in order to
avoid calling get_blame() unnecessarily.

This is a preparatory step to simplify later patches which reduce the
number of git-blame invocations by collecting together all lines to
blame within a single file at a particular revision. By validating the
blame range early, the subsequent patch can more easily avoid adding
empty ranges at collection time.

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

whatchanged: document its historical natureJunio C Hamano Fri, 9 Aug 2013 20:01:48 +0000 (13:01 -0700)

whatchanged: document its historical nature

Encourage new users to use 'log' instead. These days, these
commands are unified and just have different defaults.

'git log' only allowed you to view the log messages and no diffs
when it was added in early June 2005. It was only in early April
2006 that the command learned to take diff options. Because of
this, power users tended to use 'whatchanged' that already existed
since mid May 2005 and supported diff options.

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

core-tutorial: trim the section on Inspecting ChangesJunio C Hamano Fri, 9 Aug 2013 17:28:53 +0000 (10:28 -0700)

core-tutorial: trim the section on Inspecting Changes

Back when the core tutorial was written, `log` and `whatchanged`
were scripted Porcelains. In the "Inspecting Changes" section that
talks about the plumbing commands in the diff family, it made sense
to use `log` and `whatchanged` as good examples of the use of these
plumbing commands, and because even these scripted Porcelains were
novelty (there wasn't the new end-user tutorial written), it made
some sense to illustrate uses of the `git log` (and `git
whatchanged`) scripted Porcelain commands.

But we no longer have scripted `log` and `whatchanged` to serve as
examples, and this document is not where the end users learn what
`git log` command is about. Stop at briefly mentioning the
possibility of combining rev-list with diff-tree to build your own
log, and leave the end-user documentation of `log` to the new
tutorial and the user manual.

Also resurrect the last version of `git-log`, `git-whatchanged`, and
`git-show` to serve as examples to contrib/examples/ directory.

While at it, remove 'whatchanged' from a list of sample commands
that are affected by GIT_FLUSH environment variable. This is not
meant to be an exhaustive list but as a list of typical ones, and an
old command that is kept primarily for backward compatibility does
not belong to it.

Helped-by: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-p4: Fix occasional truncation of symlink contents.Alexandru Juncu Thu, 8 Aug 2013 13:17:38 +0000 (16:17 +0300)

git-p4: Fix occasional truncation of symlink contents.

Symlink contents in p4 print sometimes have a trailing
new line character, but sometimes it doesn't. git-p4
should only remove the last character if that character
is '\n'.

Signed-off-by: Alex Juncu <ajuncu@ixiacom.com>
Signed-off-by: Alex Badea <abadea@ixiacom.com>
Acked-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

remote-hg: add shared repo upgradeFelipe Contreras Fri, 9 Aug 2013 22:38:04 +0000 (17:38 -0500)

remote-hg: add shared repo upgrade

If we have an old organization (v1.8.3), and want to upgrade to a newer
one (v1.8.4), the user would have to fetch the whole repository, instead
we can just move the repository, so the user would not notice any
difference.

Also, remove other clones, so in time they get set up as shared.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Reviewed-by: Antoine Pelisse <apelisse@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

remote-hg: ensure shared repo is initializedFelipe Contreras Fri, 9 Aug 2013 22:38:03 +0000 (17:38 -0500)

remote-hg: ensure shared repo is initialized

6796d49 (remote-hg: use a shared repository store) introduced a bug by
making the shared repository '.git/hg', which is already used before
that patch, so clones that happened before that patch, fail after that
patch, because there's no shared Mercurial repo.

So, instead of simply checking if the directory exists, let's always try
to create an empty shared repository to ensure it's there. This works
because we don't need the initial clone, if the repository is shared,
pulling from the child updates the parent's storage; it's exactly the
same as cloning, so we can simplify the shared repo setup this way while
at the same time fixing the problem.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Reviewed-by: Antoine Pelisse <apelisse@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

l10n: Add reference for french translation teamJean-Noel Avila Fri, 9 Aug 2013 22:30:55 +0000 (00:30 +0200)

l10n: Add reference for french translation team

Signed-off-by: Jean-Noel Avila <jn.avila@free.fr>

l10n: fr.po: 821/2112 messages translatedJean-Noel Avila Mon, 1 Jul 2013 20:19:04 +0000 (22:19 +0200)

l10n: fr.po: 821/2112 messages translated

Trying to focus on most useful phrases.

Signed-off-by: Jean-Noel Avila <jn.avila@free.fr>

Merge branch 'maint'Junio C Hamano Fri, 9 Aug 2013 22:49:55 +0000 (15:49 -0700)

Merge branch 'maint'

* maint:
parse-options: fix clang opterror() -Wunused-value warning

remote-hg: fix path when cloning with tilde expansionAntoine Pelisse Fri, 9 Aug 2013 17:13:07 +0000 (19:13 +0200)

remote-hg: fix path when cloning with tilde expansion

The current code fixes the path to make it absolute when cloning, but
doesn't consider tilde expansion, so that scenario fails throwing an
exception because /home/myuser/~/my/repository doesn't exists:

$ git clone hg::~/my/repository && cd repository && git fetch

Expand the tilde when checking if the path is absolute, so that we don't
fix a path that doesn't need to be.

Signed-off-by: Antoine Pelisse <apelisse@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'master' of git://github.com/git-l10n... Junio C Hamano Fri, 9 Aug 2013 21:31:28 +0000 (14:31 -0700)

Merge branch 'master' of git://github.com/git-l10n/git-po

* 'master' of git://github.com/git-l10n/git-po:
l10n: de.po: translate 5 messages
l10n: de.po: translate 99 new messages
l10n: de.po: switch from pure German to German+English
l10n: de.po: Fix a typo
l10n: Update Swedish translation (2135t0f0u)
l10n: zh_CN.po: translate 5 messages (2135t0f0u)
l10n: vi.po(2135t): v1.8.4 round 2
l10n: git.pot: v1.8.4 round 2 (5 new, 3 removed)