gitweb.git
compat: move strdup(3) replacement to its own fileRené Scharfe Sat, 3 Sep 2016 15:59:15 +0000 (17:59 +0200)

compat: move strdup(3) replacement to its own file

Move our implementation of strdup(3) out of compat/nedmalloc/ and
allow it to be used independently from USE_NED_ALLOCATOR. The
original nedmalloc doesn't come with strdup() and doesn't need it.
Only _users_ of nedmalloc need it, which was added when we imported
it to our compat/ hierarchy.

This reduces the difference of our copy of nedmalloc from the
original, making it easier to update, and allows for easier testing
and reusing of our version of strdup().

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

Merge branch 'sy/i18n' of git-guiJunio C Hamano Wed, 7 Sep 2016 17:23:51 +0000 (10:23 -0700)

Merge branch 'sy/i18n' of git-gui

* 'sy/i18n' of git-gui:
git-gui: update Japanese information
git-gui: update Japanese translation
git-gui: add Japanese language code
git-gui: apply po template to Japanese translation
git-gui: consistently use the same word for "blame" in Japanese
git-gui: consistently use the same word for "remote" in Japanese

git-gui: update Japanese informationSatoshi Yasushima Tue, 6 Sep 2016 16:02:21 +0000 (01:02 +0900)

git-gui: update Japanese information

Signed-off-by: Satoshi Yasushima <s.yasushima@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-gui: update Japanese translationSatoshi Yasushima Tue, 6 Sep 2016 16:02:20 +0000 (01:02 +0900)

git-gui: update Japanese translation

Signed-off-by: Satoshi Yasushima <s.yasushima@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-gui: add Japanese language codeSatoshi Yasushima Tue, 6 Sep 2016 16:02:19 +0000 (01:02 +0900)

git-gui: add Japanese language code

Signed-off-by: Satoshi Yasushima <s.yasushima@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-gui: apply po template to Japanese translationSatoshi Yasushima Tue, 6 Sep 2016 16:02:18 +0000 (01:02 +0900)

git-gui: apply po template to Japanese translation

Signed-off-by: Satoshi Yasushima <s.yasushima@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-gui: consistently use the same word for "blame... Satoshi Yasushima Tue, 6 Sep 2016 16:02:17 +0000 (01:02 +0900)

git-gui: consistently use the same word for "blame" in Japanese

Signed-off-by: Satoshi Yasushima <s.yasushima@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-gui: consistently use the same word for "remote... Satoshi Yasushima Tue, 6 Sep 2016 16:02:16 +0000 (01:02 +0900)

git-gui: consistently use the same word for "remote" in Japanese

Signed-off-by: Satoshi Yasushima <s.yasushima@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

xdiff: remove unneeded declarationsStefan Beller Sat, 3 Sep 2016 03:16:48 +0000 (20:16 -0700)

xdiff: remove unneeded declarations

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

l10n: pt_PT: update Portuguese repository infoVasco Almeida Sat, 3 Sep 2016 12:10:32 +0000 (12:10 +0000)

l10n: pt_PT: update Portuguese repository info

Change Portuguese l10n leadership to Vasco Almeida.

Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>

l10n: pt_PT: update Portuguese translationVasco Almeida Sat, 3 Sep 2016 12:02:22 +0000 (12:02 +0000)

l10n: pt_PT: update Portuguese translation

Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>

Git 2.10 v2.10.0Junio C Hamano Fri, 2 Sep 2016 16:05:47 +0000 (09:05 -0700)

Git 2.10

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

symbolic-ref -d: do not allow removal of HEADJunio C Hamano Thu, 1 Sep 2016 22:38:02 +0000 (15:38 -0700)

symbolic-ref -d: do not allow removal of HEAD

If you delete the symbolic-ref HEAD from a repository, Git no longer
considers the repository valid, and even "git symbolic-ref HEAD
refs/heads/master" would not be able to recover from that state
(although "git init" can, but that is a sure sign that you are
talking about a "broken" repository).

In the spirit similar to afe5d3d5 ("symbolic ref: refuse non-ref
targets in HEAD", 2009-01-29), forbid removal of HEAD to avoid
corrupting a repository.

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

Merge tag 'l10n-2.10.0-rnd2.2' of git://github.com... Junio C Hamano Fri, 2 Sep 2016 15:48:14 +0000 (08:48 -0700)

Merge tag 'l10n-2.10.0-rnd2.2' of git://github.com/git-l10n/git-po

l10n-2.10.0-rnd2.2

* tag 'l10n-2.10.0-rnd2.2' of git://github.com/git-l10n/git-po:
l10n: Updated Vietnamese translation for v2.10.0-rc2 (2757t)

Merge branch 'master' of https://github.com/vnwildman/gitJiang Xin Fri, 2 Sep 2016 13:29:48 +0000 (21:29 +0800)

Merge branch 'master' of https://github.com/vnwildman/git

* 'master' of https://github.com/vnwildman/git:
l10n: Updated Vietnamese translation for v2.10.0-rc2 (2757t)

submodule: avoid auto-discovery in prepare_submodule_re... Junio C Hamano Thu, 1 Sep 2016 20:51:48 +0000 (13:51 -0700)

submodule: avoid auto-discovery in prepare_submodule_repo_env()

The function is used to set up the environment variable used in a
subprocess we spawn in a submodule directory. The callers set up a
child_process structure, find the working tree path of one submodule
and set .dir field to it, and then use start_command() API to spawn
the subprocess like "status", "fetch", etc.

When this happens, we expect that the ".git" (either a directory or
a gitfile that points at the real location) in the current working
directory of the subprocess MUST be the repository for the submodule.

If this ".git" thing is a corrupt repository, however, because
prepare_submodule_repo_env() unsets GIT_DIR and GIT_WORK_TREE, the
subprocess will see ".git", thinks it is not a repository, and
attempt to find one by going up, likely to end up in finding the
repository of the superproject. In some codepaths, this will cause
a command run with the "--recurse-submodules" option to recurse
forever.

By exporting GIT_DIR=.git, disable the auto-discovery logic in the
subprocess, which would instead stop it and report an error.

The test illustrates existing problems in a few callsites of this
function. Without this fix, "git fetch --recurse-submodules", "git
status" and "git diff" keep recursing forever.

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

diff: teach diff to display submodule difference with... Jacob Keller Wed, 31 Aug 2016 23:27:25 +0000 (16:27 -0700)

diff: teach diff to display submodule difference with an inline diff

Teach git-diff and friends a new format for displaying the difference
of a submodule. The new format is an inline diff of the contents of the
submodule between the commit range of the update. This allows the user
to see the actual code change caused by a submodule update.

Add tests for the new format and option.

Signed-off-by: Jacob Keller <jacob.keller@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

submodule: refactor show_submodule_summary with helper... Jacob Keller Wed, 31 Aug 2016 23:27:24 +0000 (16:27 -0700)

submodule: refactor show_submodule_summary with helper function

A future patch is going to add a new submodule diff format which
displays an inline diff of the submodule changes. To make this easier,
and to ensure that both submodule diff formats use the same initial
header, factor out show_submodule_header() function which will print the
current submodule header line, and then leave the show_submodule_summary
function to lookup and print the submodule log format.

This does create one format change in that "(revision walker failed)"
will now be displayed on its own line rather than as part of the message
because we no longer perform this step directly in the header display
flow. However, this is a rare case as most causes of the failure will be
due to a missing commit which we already check for and avoid previously.
flow. However, this is a rare case and shouldn't impact much.

Signed-off-by: Jacob Keller <jacob.keller@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

submodule: convert show_submodule_summary to use struct... Jacob Keller Wed, 31 Aug 2016 23:27:23 +0000 (16:27 -0700)

submodule: convert show_submodule_summary to use struct object_id *

Since we're going to be changing this function in a future patch, lets
go ahead and convert this to use object_id now.

Signed-off-by: Jacob Keller <jacob.keller@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

allow do_submodule_path to work even if submodule isn... Jacob Keller Wed, 31 Aug 2016 23:27:22 +0000 (16:27 -0700)

allow do_submodule_path to work even if submodule isn't checked out

Currently, do_submodule_path will attempt locating the .git directory by
using read_gitfile on <path>/.git. If this fails it just assumes the
<path>/.git is actually a git directory.

This is good because it allows for handling submodules which were cloned
in a regular manner first before being added to the superproject.

Unfortunately this fails if the <path> is not actually checked out any
longer, such as by removing the directory.

Fix this by checking if the directory we found is actually a gitdir. In
the case it is not, attempt to lookup the submodule configuration and
find the name of where it is stored in the .git/modules/ directory of
the superproject.

If we can't locate the submodule configuration, this might occur because
for example a submodule gitlink was added but the corresponding
.gitmodules file was not properly updated. A die() here would not be
pleasant to the users of submodule diff formats, so instead, modify
do_submodule_path() to return an error code:

- git_pathdup_submodule() returns NULL when we fail to find a path.
- strbuf_git_path_submodule() propagates the error code to the caller.

Modify the callers of these functions to check the error code and fail
properly. This ensures we don't attempt to use a bad path that doesn't
match the corresponding submodule.

Because this change fixes add_submodule_odb() to work even if the
submodule is not checked out, update the wording of the submodule log
diff format to correctly display that the submodule is "not initialized"
instead of "not checked out"

Add tests to ensure this change works as expected.

Signed-off-by: Jacob Keller <jacob.keller@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

diff: prepare for additional submodule formatsJacob Keller Wed, 31 Aug 2016 23:27:21 +0000 (16:27 -0700)

diff: prepare for additional submodule formats

A future patch will add a new format for displaying the difference of
a submodule. Make it easier by changing how we store the current
selected format. Replace the DIFF_OPT flag with an enumeration, as each
format will be mutually exclusive.

Signed-off-by: Jacob Keller <jacob.keller@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

graph: add support for --line-prefix on all graph-aware... Jacob Keller Wed, 31 Aug 2016 23:27:20 +0000 (16:27 -0700)

graph: add support for --line-prefix on all graph-aware output

Add an extension to git-diff and git-log (and any other graph-aware
displayable output) such that "--line-prefix=<string>" will print the
additional line-prefix on every line of output.

To make this work, we have to fix a few bugs in the graph API that force
graph_show_commit_msg to be used only when you have a valid graph.
Additionally, we extend the default_diff_output_prefix handler to work
even when no graph is enabled.

This is somewhat of a hack on top of the graph API, but I think it
should be acceptable here.

This will be used by a future extension of submodule display which
displays the submodule diff as the actual diff between the pre and post
commit in the submodule project.

Add some tests for both git-log and git-diff to ensure that the prefix
is honored correctly.

Signed-off-by: Jacob Keller <jacob.keller@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

diff.c: remove output_prefix_length fieldJunio C Hamano Wed, 31 Aug 2016 23:27:19 +0000 (16:27 -0700)

diff.c: remove output_prefix_length field

"diff/log --stat" has a logic that determines the display columns
available for the diffstat part of the output and apportions it for
pathnames and diffstat graph automatically.

5e71a84a (Add output_prefix_length to diff_options, 2012-04-16)
added the output_prefix_length field to diff_options structure to
allow this logic to subtract the display columns used for the
history graph part from the total "terminal width"; this matters
when the "git log --graph -p" option is in use.

The field must be set to the number of display columns needed to
show the output from the output_prefix() callback, which is error
prone. As there is only one user of the field, and the user has the
actual value of the prefix string, let's get rid of the field and
have the user count the display width itself.

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

cache: add empty_tree_oid object and helper functionJacob Keller Wed, 31 Aug 2016 23:27:18 +0000 (16:27 -0700)

cache: add empty_tree_oid object and helper function

Similar to is_null_oid(), and is_empty_blob_sha1() add an
empty_tree_oid along with helper function is_empty_tree_oid(). For
completeness, also add an "is_empty_tree_sha1()",
"is_empty_blob_sha1()", "is_empty_tree_oid()" and "is_empty_blob_oid()"
helpers.

To ensure we only get one singleton, implement EMPTY_BLOB_SHA1_BIN as
simply getting the hash of empty_blob_oid structure.

Signed-off-by: Jacob Keller <jacob.keller@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

color_parse_mem: initialize "struct color" temporaryJeff King Wed, 31 Aug 2016 03:43:07 +0000 (23:43 -0400)

color_parse_mem: initialize "struct color" temporary

Compiling color.c with gcc 6.2.0 using -O3 produces some
-Wmaybe-uninitialized false positives:

color.c: In function ‘color_parse_mem’:
color.c:189:10: warning: ‘bg.blue’ may be used uninitialized in this function [-Wmaybe-uninitialized]
out += xsnprintf(out, len, "%c8;2;%d;%d;%d", type,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
c->red, c->green, c->blue);
~~~~~~~~~~~~~~~~~~~~~~~~~~
color.c:208:15: note: ‘bg.blue’ was declared here
struct color bg = { COLOR_UNSPECIFIED };
^~
[ditto for bg.green, bg.red, fg.blue, etc]

This is doubly confusing, because the declaration shows it
being initialized! Even though we do not explicitly
initialize the color components, an incomplete initializer
sets the unmentioned members to zero.

What the warning doesn't show is that we later do this:

struct color c;
if (!parse_color(&c, ...)) {
if (fg.type == COLOR_UNSPECIFIED)
fg = c;
...
}

gcc is clever enough to realize that a struct assignment
from an uninitialized variable taints the destination. But
unfortunately it's _not_ clever enough to realize that we
only look at those members when type is set to COLOR_RGB, in
which case they are always initialized.

With -O2, gcc does not look into parse_color() and must
assume that "c" emerges fully initialized. With -O3, it
inlines parse_color(), and learns just enough to get
confused.

We can silence the false positive by initializing the
temporary "c". This also future-proofs us against
violating the type assumptions (the result would probably
still be buggy, but in a deterministic way).

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

error_errno: use constant return similar to error()Jeff King Wed, 31 Aug 2016 03:41:22 +0000 (23:41 -0400)

error_errno: use constant return similar to error()

Commit e208f9c (make error()'s constant return value more
visible, 2012-12-15) introduced some macro trickery to make
the constant return from error() more visible to callers,
which in turn can help gcc produce better warnings (and
possibly even better code).

Later, fd1d672 (usage.c: add warning_errno() and
error_errno(), 2016-05-08) introduced another variant, and
subsequent commits converted some uses of error() to
error_errno(), losing the magic from e208f9c for those
sites.

As a result, compiling vcs-svn/svndiff.c with "gcc -O3"
produces -Wmaybe-uninitialized false positives (at least
with gcc 6.2.0). Let's give error_errno() the same
treatment, which silences these warnings.

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

A few more fixes before the final 2.10Junio C Hamano Wed, 31 Aug 2016 17:21:05 +0000 (10:21 -0700)

A few more fixes before the final 2.10

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

Merge tag 'l10n-2.10.0-rnd2' of git://github.com/git... Junio C Hamano Wed, 31 Aug 2016 17:04:14 +0000 (10:04 -0700)

Merge tag 'l10n-2.10.0-rnd2' of git://github.com/git-l10n/git-po

l10n-2.10.0-rnd2

* tag 'l10n-2.10.0-rnd2' of git://github.com/git-l10n/git-po:
l10n: zh_CN: for git v2.10.0 l10n round 2
l10n: ca.po: update translation
l10n: fr.po v2.10.0-rc2
l10n: sv.po: Update Swedish translation (2757t0f0u)
l10n: git.pot: v2.10.0 round 2 (12 new, 44 removed)
l10n: Updated Vietnamese translation for v2.10.0 (2789t)
l10n: pt_PT: update Portuguese translation
l10n: pt_PT: merge git.pot
l10n: ko.po: Update Korean translation
l10n: git.pot: v2.10.0 round 1 (248 new, 56 removed)

Merge branch 'ls/packet-line-protocol-doc-fix'Junio C Hamano Wed, 31 Aug 2016 17:03:51 +0000 (10:03 -0700)

Merge branch 'ls/packet-line-protocol-doc-fix'

Correct an age-old calco (is that a typo-like word for calc)
in the documentation.

* ls/packet-line-protocol-doc-fix:
pack-protocol: fix maximum pkt-line size

Merge branch 'mh/blame-worktree'Junio C Hamano Wed, 31 Aug 2016 17:03:50 +0000 (10:03 -0700)

Merge branch 'mh/blame-worktree'

* mh/blame-worktree:
blame: fix segfault on untracked files

Merge branch 'kw/patch-ids-optim'Junio C Hamano Wed, 31 Aug 2016 17:03:49 +0000 (10:03 -0700)

Merge branch 'kw/patch-ids-optim'

* kw/patch-ids-optim:
p3400: make test script executable

diff-highlight: avoid highlighting combined diffsJeff King Wed, 31 Aug 2016 05:05:38 +0000 (01:05 -0400)

diff-highlight: avoid highlighting combined diffs

The algorithm in diff-highlight only understands how to look
at two sides of a diff; it cannot correctly handle combined
diffs with multiple preimages. Often highlighting does not
trigger at all for these diffs because the line counts do
not match up. E.g., if we see:

- ours
-theirs
++resolved

we would not bother highlighting; it naively looks like a
single line went away, and then a separate hunk added
another single line.

But of course there are exceptions. E.g., if the other side
deleted the line, we might see:

- ours
++resolved

which looks like we dropped " ours" and added "+resolved".
This is only a small highlighting glitch (we highlight the
space and the "+" along with the content), but it's also the
tip of the iceberg. Even if we learned to find the true
content here (by noticing we are in a 3-way combined diff
and marking _two_ characters from the front of the line as
uninteresting), there are other more complicated cases where
we really do need to handle a 3-way hunk.

Let's just punt for now; we can recognize combined diffs by
the presence of extra "@" symbols in the hunk header, and
treat them as non-diff content.

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

diff-highlight: add multi-byte testsJeff King Wed, 31 Aug 2016 05:03:10 +0000 (01:03 -0400)

diff-highlight: add multi-byte tests

Now that we have a test suite for diff highlight, we can
show off the improvements from 8d00662 (diff-highlight: do
not split multibyte characters, 2015-04-03).

While we're at it, we can also add another case that
_doesn't_ work: combining code points are treated as their
own unit, which means that we may stick colors between them
and the character they are modifying (with the result that
the color is not shown in an xterm, though it's possible
that other terminals err the other way, and show the color
but not the accent). There's no fix here, but let's
document it as a failure.

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

diff-highlight: ignore test cruftJeff King Wed, 31 Aug 2016 05:02:53 +0000 (01:02 -0400)

diff-highlight: ignore test cruft

These are the same as in the normal t/.gitignore, with the
exception of ".prove", as our Makefile does not support it.

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

help: make option --help open man pages only for Git... Ralf Thielow Fri, 26 Aug 2016 17:58:36 +0000 (19:58 +0200)

help: make option --help open man pages only for Git commands

If option --help is passed to a Git command, we try to open
the man page of that command. However, we do it for both commands
and concepts. Make sure it is an actual command.

This makes "git <concept> --help" not working anymore, while
"git help <concept>" still works.

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

help: introduce option --exclude-guidesRalf Thielow Fri, 26 Aug 2016 17:58:35 +0000 (19:58 +0200)

help: introduce option --exclude-guides

Introduce option --exclude-guides to the help command. With this option
being passed, "git help" will open man pages only for actual commands.

Since we know it is a command, we can use function help_unknown_command
to give the user advice on typos.

Helped-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

am: refactor read_author_script()Junio C Hamano Tue, 30 Aug 2016 19:36:42 +0000 (12:36 -0700)

am: refactor read_author_script()

By splitting the part that reads from a file and the part that
parses the variable definitions from the contents, make the latter
can be more reusable in the future.

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

test-lib: drop PID from test-results/*.countJeff King Tue, 30 Aug 2016 08:43:57 +0000 (04:43 -0400)

test-lib: drop PID from test-results/*.count

Each test run generates a "count" file in t/test-results
that stores the number of successful, failed, etc tests.
If you run "t1234-foo.sh", that file is named as
"t/test-results/t1234-foo-$$.count"

The addition of the PID there is serving no purpose, and
makes analysis of the count files harder.

The presence of the PID dates back to 2d84e9f (Modify
test-lib.sh to output stats to t/test-results/*,
2008-06-08), but no reasoning is given there. Looking at the
current code, we can see that other files we write to
test-results (like *.exit and *.out) do _not_ have the PID
included. So the presence of the PID does not meaningfully
allow one to store the results from multiple runs anyway.

Moreover, anybody wishing to read the *.count files to
aggregate results has to deal with the presence of multiple
files for a given test (and figure out which one is the most
recent based on their timestamps!). The only consumer of
these files is the aggregate.sh script, which arguably gets
this wrong. If a test is run multiple times, its counts will
appear multiple times in the total (I say arguably only
because the desired semantics aren't documented anywhere,
but I have trouble seeing how this behavior could be
useful).

So let's just drop the PID, which fixes aggregate.sh, and
will make new features based around the count files easier
to write.

Note that since the count-file may already exist (when
re-running a test), we also switch the "cat" from appending
to truncating. The use of append here was pointless in the
first place, as we expected to always write to a unique file.

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

pack-protocol: fix maximum pkt-line sizeLars Schneider Mon, 29 Aug 2016 17:55:09 +0000 (19:55 +0200)

pack-protocol: fix maximum pkt-line size

According to LARGE_PACKET_MAX in pkt-line.h the maximal length of a
pkt-line packet is 65520 bytes. The pkt-line header takes 4 bytes and
therefore the pkt-line data component must not exceed 65516 bytes.

Signed-off-by: Lars Schneider <larsxschneider@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

l10n: zh_CN: for git v2.10.0 l10n round 2Jiang Xin Sun, 28 Aug 2016 02:18:12 +0000 (10:18 +0800)

l10n: zh_CN: for git v2.10.0 l10n round 2

Update 215 translations (2757t0f0u) for git v2.10.0-rc2.

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>

sequencer: do not die() in do_pick_commit()Johannes Schindelin Fri, 26 Aug 2016 13:47:14 +0000 (15:47 +0200)

sequencer: do not die() in do_pick_commit()

Instead of dying there, let the caller high up in the callchain
notice the error and handle it (by dying, still).

The eventual caller of do_pick_commit() is sequencer_pick_revisions(),
which already relays a reported error from its helper functions
(including this one), and both of its two callers know how to react to
a negative return correctly.

So this makes do_pick_commit() callable from new callers that want it
not to die, without changing the external behaviour of anything
existing.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

sequencer: lib'ify sequencer_pick_revisions()Johannes Schindelin Fri, 26 Aug 2016 13:47:10 +0000 (15:47 +0200)

sequencer: lib'ify sequencer_pick_revisions()

Instead of dying there, let the caller high up in the callchain notice
the error and handle it (by dying, still).

The function sequencer_pick_revisions() has only two callers,
cmd_revert() and cmd_cherry_pick(), both of which check the return
value and react appropriately upon errors.

So this is a safe conversion to make sequencer_pick_revisions()
callable from new callers that want it not to die, without changing
the external behaviour of anything existing.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

p3400: make test script executableRené Scharfe Sun, 28 Aug 2016 12:39:27 +0000 (14:39 +0200)

p3400: make test script executable

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

diff-highlight: add support for --graph outputBrian Henderson Mon, 29 Aug 2016 17:33:47 +0000 (10:33 -0700)

diff-highlight: add support for --graph output

Signed-off-by: Brian Henderson <henderson.bj@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

diff-highlight: add failing test for handling --graph... Brian Henderson Mon, 29 Aug 2016 17:33:46 +0000 (10:33 -0700)

diff-highlight: add failing test for handling --graph output

Signed-off-by: Brian Henderson <henderson.bj@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

diff-highlight: add some testsBrian Henderson Mon, 29 Aug 2016 17:33:45 +0000 (10:33 -0700)

diff-highlight: add some tests

Signed-off-by: Brian Henderson <henderson.bj@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

blame: fix segfault on untracked filesThomas Gummerer Sat, 27 Aug 2016 20:01:50 +0000 (21:01 +0100)

blame: fix segfault on untracked files

Since 3b75ee9 ("blame: allow to blame paths freshly added to the index",
2016-07-16) git blame also looks at the index to determine if there is a
file that was freshly added to the index.

cache_name_pos returns -pos - 1 in case there is no match is found, or
if the name matches, but the entry has a stage other than 0. As git
blame should work for unmerged files, it uses strcmp to determine
whether the name of the returned position matches, in which case the
file exists, but is merely unmerged, or if the file actually doesn't
exist in the index.

If the repository is empty, or if the file would lexicographically be
sorted as the last file in the repository, -cache_name_pos - 1 is
outside of the length of the active_cache array, causing git blame to
segfault. Guard against that, and die() normally to restore the old
behaviour.

Reported-by: Simon Ruderich <simon@ruderich.org>
Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

l10n: ca.po: update translationAlex Henrie Sun, 28 Aug 2016 16:32:56 +0000 (10:32 -0600)

l10n: ca.po: update translation

Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>

l10n: fr.po v2.10.0-rc2Jean-Noel Avila Sat, 20 Aug 2016 14:20:17 +0000 (16:20 +0200)

l10n: fr.po v2.10.0-rc2

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

l10n: Updated Vietnamese translation for v2.10.0-rc2... Tran Ngoc Quan Sun, 28 Aug 2016 00:23:30 +0000 (07:23 +0700)

l10n: Updated Vietnamese translation for v2.10.0-rc2 (2757t)

Signed-off-by: Tran Ngoc Quan <vnwildman@gmail.com>

l10n: sv.po: Update Swedish translation (2757t0f0u)Peter Krefting Fri, 26 Aug 2016 13:27:24 +0000 (14:27 +0100)

l10n: sv.po: Update Swedish translation (2757t0f0u)

Signed-off-by: Peter Krefting <peter@softwolves.pp.se>

Merge branch 'master' of https://github.com/vnwildman/gitJiang Xin Sat, 27 Aug 2016 15:36:16 +0000 (23:36 +0800)

Merge branch 'master' of https://github.com/vnwildman/git

* 'master' of https://github.com/vnwildman/git:
l10n: Updated Vietnamese translation for v2.10.0 (2789t)

l10n: git.pot: v2.10.0 round 2 (12 new, 44 removed)Jiang Xin Sat, 27 Aug 2016 15:23:26 +0000 (23:23 +0800)

l10n: git.pot: v2.10.0 round 2 (12 new, 44 removed)

Generate po/git.pot from v2.10.0-rc2 for git v2.10.0 l10n round 2.

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>

Merge branch 'master' of git://github.com/git-l10n... Jiang Xin Sat, 27 Aug 2016 15:14:27 +0000 (23:14 +0800)

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

* 'master' of git://github.com/git-l10n/git-po:
l10n: pt_PT: update Portuguese translation
l10n: pt_PT: merge git.pot
l10n: ko.po: Update Korean translation
l10n: git.pot: v2.10.0 round 1 (248 new, 56 removed)

l10n: Updated Vietnamese translation for v2.10.0 (2789t)Tran Ngoc Quan Sat, 27 Aug 2016 02:15:28 +0000 (09:15 +0700)

l10n: Updated Vietnamese translation for v2.10.0 (2789t)

Signed-off-by: Tran Ngoc Quan <vnwildman@gmail.com>

SubmittingPatches: use gitk's "Copy commit summary... Beat Bolli Fri, 26 Aug 2016 16:59:01 +0000 (18:59 +0200)

SubmittingPatches: use gitk's "Copy commit summary" format

Update the suggestion in 175d38ca ("SubmittingPatches: document how
to reference previous commits", 2016-07-28) on the format to refer
to a commit to match what gitk has been giving since last year with
its "Copy commit summary" command; also mention this as one of the
ways to obtain a commit reference in this format.

Signed-off-by: Beat Bolli <dev+git@drbeat.li>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Git 2.10-rc2 v2.10.0-rc2Junio C Hamano Fri, 26 Aug 2016 20:59:20 +0000 (13:59 -0700)

Git 2.10-rc2

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

gitattributes: Document the unified "auto" handlingTorsten Bögershausen Fri, 26 Aug 2016 20:18:48 +0000 (22:18 +0200)

gitattributes: Document the unified "auto" handling

Update the documentation about text=auto:
text=auto now follows the core.autocrlf handling when files are not
normalized in the repository.

For a cross platform project recommend the usage of attributes for
line-ending conversions.

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

Merge branch 'js/no-html-bypass-on-windows' into rt... Junio C Hamano Fri, 26 Aug 2016 18:29:07 +0000 (11:29 -0700)

Merge branch 'js/no-html-bypass-on-windows' into rt/help-unknown

* js/no-html-bypass-on-windows:
Revert "display HTML in default browser using Windows' shell API"

Prepare for 2.10.0-rc2Junio C Hamano Thu, 25 Aug 2016 20:56:51 +0000 (13:56 -0700)

Prepare for 2.10.0-rc2

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

Merge branch 'ja/i18n'Junio C Hamano Thu, 25 Aug 2016 20:55:07 +0000 (13:55 -0700)

Merge branch 'ja/i18n'

The recent i18n patch we added during this cycle did a bit too much
refactoring of the messages to avoid word-legos; the repetition has
been reduced to help translators.

* ja/i18n:
i18n: simplify numeric error reporting
i18n: fix git rebase interactive commit messages
i18n: fix typos for translation

Merge branch 'bw/mingw-avoid-inheriting-fd-to-lockfile'Junio C Hamano Thu, 25 Aug 2016 20:55:07 +0000 (13:55 -0700)

Merge branch 'bw/mingw-avoid-inheriting-fd-to-lockfile'

The tempfile (hence its user lockfile) API lets the caller to open
a file descriptor to a temporary file, write into it and then
finalize it by first closing the filehandle and then either
removing or renaming the temporary file. When the process spawns a
subprocess after obtaining the file descriptor, and if the
subprocess has not exited when the attempt to remove or rename is
made, the last step fails on Windows, because the subprocess has
the file descriptor still open. Open tempfile with O_CLOEXEC flag
to avoid this (on Windows, this is mapped to O_NOINHERIT).

* bw/mingw-avoid-inheriting-fd-to-lockfile:
mingw: ensure temporary file handles are not inherited by child processes
t6026-merge-attr: child processes must not inherit index.lock handles

Merge branch 'dg/document-git-c-in-git-config-doc'Junio C Hamano Thu, 25 Aug 2016 20:55:07 +0000 (13:55 -0700)

Merge branch 'dg/document-git-c-in-git-config-doc'

The "git -c var[=val] cmd" facility to append a configuration
variable definition at the end of the search order was described in
git(1) manual page, but not in git-config(1), which was more likely
place for people to look for when they ask "can I make a one-shot
override, and if so how?"

* dg/document-git-c-in-git-config-doc:
doc: mention `git -c` in git-config(1)

Merge branch 'js/no-html-bypass-on-windows'Junio C Hamano Thu, 25 Aug 2016 20:55:06 +0000 (13:55 -0700)

Merge branch 'js/no-html-bypass-on-windows'

On Windows, help.browser configuration variable used to be ignored,
which has been corrected.

* js/no-html-bypass-on-windows:
Revert "display HTML in default browser using Windows' shell API"

Merge branch 'hv/doc-commit-reference-style'Junio C Hamano Thu, 25 Aug 2016 20:55:05 +0000 (13:55 -0700)

Merge branch 'hv/doc-commit-reference-style'

A small doc update.

* hv/doc-commit-reference-style:
SubmittingPatches: document how to reference previous commits

git ls-files: text=auto eol=lf is supported in Git... Torsten Bögershausen Thu, 25 Aug 2016 15:52:57 +0000 (17:52 +0200)

git ls-files: text=auto eol=lf is supported in Git 2.10

The man page for `git ls-files --eol` mentions the combination
of text attributes "text=auto eol=lf" or "text=auto eol=crlf" as not
supported yet, but may be in the future.

Now they are supported.

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

l10n: pt_PT: update Portuguese translationVasco Almeida Mon, 22 Aug 2016 16:29:35 +0000 (16:29 +0000)

l10n: pt_PT: update Portuguese translation

Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>

l10n: pt_PT: merge git.potVasco Almeida Tue, 16 Aug 2016 12:06:44 +0000 (12:06 +0000)

l10n: pt_PT: merge git.pot

Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>

receive-pack: allow a maximum input size to be specifiedJeff King Wed, 24 Aug 2016 18:41:57 +0000 (20:41 +0200)

receive-pack: allow a maximum input size to be specified

Receive-pack feeds its input to either index-pack or
unpack-objects, which will happily accept as many bytes as
a sender is willing to provide. Let's allow an arbitrary
cutoff point where we will stop writing bytes to disk.

Cleaning up what has already been written to disk is a
related problem that is not addressed by this patch.

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

unpack-objects: add --max-input-size=<size> optionChristian Couder Wed, 24 Aug 2016 18:41:56 +0000 (20:41 +0200)

unpack-objects: add --max-input-size=<size> option

When receiving a pack-file, it can be useful to abort the
`git unpack-objects`, if the pack-file is too big.

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

index-pack: add --max-input-size=<size> optionJeff King Wed, 24 Aug 2016 18:41:55 +0000 (20:41 +0200)

index-pack: add --max-input-size=<size> option

When receiving a pack-file, it can be useful to abort the
`git index-pack`, if the pack-file is too big.

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

i18n: simplify numeric error reportingJean-Noel Avila Sun, 21 Aug 2016 14:50:39 +0000 (16:50 +0200)

i18n: simplify numeric error reporting

Signed-off-by: Jean-Noel Avila <jn.avila@free.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

i18n: fix git rebase interactive commit messagesJean-Noel Avila Sun, 21 Aug 2016 14:50:38 +0000 (16:50 +0200)

i18n: fix git rebase interactive commit messages

For proper i18n, the logic cannot embed english specific processing.

Signed-off-by: Jean-Noel Avila <jn.avila@free.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

i18n: fix typos for translationJean-Noel Avila Sun, 21 Aug 2016 14:50:37 +0000 (16:50 +0200)

i18n: fix typos for translation

Signed-off-by: Jean-Noel Avila <jn.avila@free.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

format-patch: show 0/1 and 1/1 for singleton patch... Jacob Keller Tue, 23 Aug 2016 22:45:50 +0000 (15:45 -0700)

format-patch: show 0/1 and 1/1 for singleton patch with cover letter

Change the default behavior of git-format-patch to generate numbered
sequence of 0/1 and 1/1 when generating both a cover-letter and a single
patch. This standardizes the cover letter to have 0/N which helps
distinguish the cover letter from the patch itself. Since the behavior
is easily changed via configuration as well as the use of -n and -N this
should be acceptable default behavior.

Add tests for the new default behavior.

Signed-off-by: Jacob Keller <jacob.keller@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t/perf: add basic perf tests for delta base cacheJeff King Mon, 22 Aug 2016 22:01:10 +0000 (18:01 -0400)

t/perf: add basic perf tests for delta base cache

This just shows off the improvements done by the last few
patches, and gives us a baseline for noticing regressions in
the future. Here are the results with linux.git as the perf
"large repo":

Test origin HEAD
-------------------------------------------------------------------
0003.1: log --raw 43.41(40.36+2.69) 33.86(30.96+2.41) -22.0%
0003.2: log -S 313.61(309.74+3.78) 298.75(295.58+3.00) -4.7%

(for a large repo, the "log -S" improvements are greater if
you bump the delta base cache limit, but I think it makes
sense to test the "stock" behavior, since that is what most
people will see).

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

delta_base_cache: use hashmap.hJeff King Mon, 22 Aug 2016 22:00:07 +0000 (18:00 -0400)

delta_base_cache: use hashmap.h

The fundamental data structure of the delta base cache is a
hash table mapping pairs of "(packfile, offset)" into
structs containing the actual object data. The hash table
implementation dates back to e5e0161 (Implement a simple
delta_base cache, 2007-03-17), and uses a fixed-size table.
The current size is a hard-coded 256 entries.

Because we need to be able to remove objects from the hash
table, entry lookup does not do any kind of probing to
handle collisions. Colliding items simply replace whatever
is in their slot. As a result, we have fewer usable slots
than even the 256 we allocate. At half full, each new item
has a 50% chance of displacing another one. Or another way
to think about it: every item has a 1/256 chance of being
ejected due to hash collision, without regard to our LRU
strategy.

So it would be interesting to see the effect of increasing
the cache size on the runtime for some common operations. As
with the previous patch, we'll measure "git log --raw" for
tree-only operations, and "git log -Sfoo --raw" for
operations that touch trees and blobs. All times are
wall-clock best-of-3, done against fully packed repos with
--depth=50, and the default core.deltaBaseCacheLimit of
96MB.

Here are timings for various values of MAX_DELTA_CACHE
against git.git (the asterisk marks the minimum time for
each operation):

MAX_DELTA_CACHE log-raw log-S
--------------- --------- ---------
256 0m02.227s 0m12.821s
512 0m02.143s 0m10.602s
1024 0m02.127s 0m08.642s
2048 0m02.148s 0m07.123s
4096 0m02.194s 0m06.448s*
8192 0m02.239s 0m06.504s
16384 0m02.144s* 0m06.502s
32768 0m02.202s 0m06.622s
65536 0m02.230s 0m06.677s

The log-raw case isn't changed much at all here (probably
because our trees just aren't that big in the first place,
or possibly because we have so _few_ trees in git.git that
the 256-entry cache is enough). But once we start putting
blobs in the cache, too, we see a big improvement (almost
50%). The curve levels off around 4096, which means that we
can hold about that many entries before hitting the 96MB
memory limit (or possibly that the workload is small enough
that there is simply no more work to be optimized out by
caching more).

(As a side note, I initially timed my existing git.git pack,
which was a base of --aggressive combined with some pulls on
top. So it had quite a few deeper delta chains. The
256-cache case was more like 15s, and it still dropped to
~6.5s in the same way).

Here are the timings for linux.git:

MAX_DELTA_CACHE log-raw log-S
--------------- --------- ---------
256 0m41.661s 5m12.410s
512 0m39.547s 5m07.920s
1024 0m37.054s 4m54.666s
2048 0m35.871s 4m41.194s*
4096 0m34.646s 4m51.648s
8192 0m33.881s 4m55.342s
16384 0m35.190s 5m00.122s
32768 0m35.060s 4m58.851s
65536 0m33.311s* 4m51.420s

As we grow we see a nice 20% speedup in the tree traversal,
and more modest 10% in the log-S. This is probably an
indication that we are bound less by the number of entries,
and more by the memory limit (more on that below). What is
interesting is that the numbers bounce around a bit;
increasing the number of entries isn't always a strict
improvement.

Partially this is due to noise in the measurement. But it
may also be an indication that our LRU ejection scheme is
not optimal. The smaller cache sizes introduce some
randomness into the ejection (due to collisions), which may
sometimes work in our favor (and sometimes not!).

So what is the optimal setting of MAX_DELTA_CACHE? The
"bouncing" in the linux.git log-S numbers notwithstanding,
it mostly seems like bigger is better. And even if we were
to try to find a "sweet spot", these are just two
repositories, that are not necessarily representative. The
shape of history, the size of trees and blobs, the memory
limit configuration, etc, all will affect the outcome.

Rather than trying to find the "right" number, another
strategy is to just switch to a hash table that can actually
store collisions: namely our hashmap.h implementation.

Here are numbers for that compared to the "best" we saw from
adjusting MAX_DELTA_CACHE:

| log-raw | log-S
| best hashmap | best hashmap
| --------- --------- | --------- ---------
git | 0m02.144s 0m02.144s | 0m06.448s 0m06.688s
linux | 0m33.311s 0m33.092s | 4m41.194s 4m57.172s

We can see the results are similar in most cases, which is
what we'd expect. We're not ejecting due to collisions at
all, so this is purely representing the LRU. So really, we'd
expect this to model most closely the larger values of the
static MAX_DELTA_CACHE limit. And that does seem to be
what's happening, including the "bounce" in the linux log-S
case.

So while the value for that case _isn't_ as good as the
optimal one measured above (which was 2048 entries), given
the bouncing I'm hesitant to suggest that 2048 is any kind
of optimum (not even for linux.git, let alone as a general
rule). The generic hashmap has the appeal that it drops the
number of tweakable numbers by one, which means we can focus
on tuning other elements, like the LRU strategy or the
core.deltaBaseCacheLimit setting.

And indeed, if we bump the cache limit to 1G (which is
probably silly for general use, but maybe something people
with big workstations would want to do), the linux.git log-S
time drops to 3m32s. That's something you really _can't_ do
easily with the static hash table, because the number of
entries needs to grow in proportion to the memory limit (so
2048 is almost certainly not going to be the right value
there).

This patch takes that direction, and drops the static hash
table entirely in favor of using the hashmap.h API.

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

delta_base_cache: drop special treatment of blobsJeff King Mon, 22 Aug 2016 21:59:56 +0000 (17:59 -0400)

delta_base_cache: drop special treatment of blobs

When the delta base cache runs out of allowed memory, it has
to drop entries. It does so by walking an LRU list, dropping
objects until we are under the memory limit. But we actually
walk the list twice: once to drop blobs, and then again to
drop other objects (which are generally trees). This comes
from 18bdec1 (Limit the size of the new delta_base_cache,
2007-03-19).

This performs poorly as the number of entries grows, because
any time dropping blobs does not satisfy the limit, we have
to walk the _entire_ list, trees included, looking for blobs
to drop, before starting to drop any trees.

It's not generally a problem now, as the cache is limited to
only 256 entries. But as we could benefit from increasing
that in a future patch, it's worth looking at how it
performs as the cache size grows. And the answer is "not
well".

The table below shows times for various operations with
different values of MAX_DELTA_CACHE (which is not a run-time
knob; I recompiled with -DMAX_DELTA_CACHE=$n for each).

I chose "git log --raw" ("log-raw" in the table) because it
will access all of the trees, but no blobs at all (so in a
sense it is a worst case for this problem, because we will
always walk over the entire list of trees once before
realizing there are no blobs to drop). This is also
representative of other tree-only operations like "rev-list
--objects" and "git log -- <path>".

I also timed "git log -Sfoo --raw" ("log-S" in the table).
It similarly accesses all of the trees, but also the blobs
for each commit. It's representative of "git log -p", though
it emphasizes the cost of blob access more, as "-S" is
cheaper than computing an actual blob diff.

All timings are best-of-3 wall-clock times (though they all
were CPU bound, so the user CPU times are similar). The
repositories were fully packed with --depth=50, and the
default core.deltaBaseCacheLimit of 96M was in effect. The
current value of MAX_DELTA_CACHE is 256, so I started there
and worked up by factors of 2.

First, here are values for git.git (the asterisk signals the
fastest run for each operation):

MAX_DELTA_CACHE log-raw log-S
--------------- --------- ---------
256 0m02.212s 0m12.634s
512 0m02.136s* 0m10.614s
1024 0m02.156s 0m08.614s
2048 0m02.208s 0m07.062s
4096 0m02.190s 0m06.484s*
8192 0m02.176s 0m07.635s
16384 0m02.913s 0m19.845s
32768 0m03.617s 1m05.507s
65536 0m04.031s 1m18.488s

You can see that for the tree-only log-raw case, we don't
actually benefit that much as the cache grows (all the
differences up through 8192 are basically just noise; this
is probably because we don't actually have that many
distinct trees in git.git). But for log-S, we get a definite
speed improvement as the cache grows, but the improvements
are lost as cache size grows and the linear LRU management
starts to dominate.

Here's the same thing run against linux.git:

MAX_DELTA_CACHE log-raw log-S
--------------- --------- ----------
256 0m40.987s 5m13.216s
512 0m37.949s 5m03.243s
1024 0m35.977s 4m50.580s
2048 0m33.855s 4m39.818s
4096 0m32.913s 4m47.299s*
8192 0m32.176s* 5m14.650s
16384 0m32.185s 6m31.625s
32768 0m38.056s 9m31.136s
65536 1m30.518s 17m38.549s

The pattern is similar, though the effect in log-raw is more
pronounced here. The times dip down in the middle, and then
go back up as we keep growing.

So we know there's a problem. What's the solution?

The obvious one is to improve the data structure to avoid
walking over tree entries during the looking-for-blobs
traversal. We can do this by keeping _two_ LRU lists: one
for blobs, and one for other objects. We drop items from the
blob LRU first, and then from the tree LRU (if necessary).

Here's git.git using that strategy:

MAX_DELTA_CACHE log-raw log-S
--------------- --------- ----------
256 0m02.264s 0m12.830s
512 0m02.201s 0m10.771s
1024 0m02.181s 0m08.593s
2048 0m02.205s 0m07.116s
4096 0m02.158s 0m06.537s*
8192 0m02.213s 0m07.246s
16384 0m02.155s* 0m10.975s
32768 0m02.159s 0m16.047s
65536 0m02.181s 0m16.992s

The upswing on log-raw is gone completely. But log-S still
has it (albeit much better than without this strategy).
Let's see what linux.git shows:

MAX_DELTA_CACHE log-raw log-S
--------------- --------- ---------
256 0m42.519s 5m14.654s
512 0m39.106s 5m04.708s
1024 0m36.802s 4m51.454s
2048 0m34.685s 4m39.378s*
4096 0m33.663s 4m44.047s
8192 0m33.157s 4m50.644s
16384 0m33.090s* 4m49.648s
32768 0m33.458s 4m53.371s
65536 0m33.563s 5m04.580s

The results are similar. The tree-only case again performs
well (not surprising; we're literally just dropping the one
useless walk, and not otherwise changing the cache eviction
strategy at all). But the log-S case again does a bit worse
as the cache grows (though possibly that's within the noise,
which is much larger for this case).

Perhaps this is an indication that the "remove blobs first"
strategy is not actually optimal. The intent of it is to
avoid blowing out the tree cache when we see large blobs,
but it also means we'll throw away useful, recent blobs in
favor of older trees.

Let's run the same numbers without caring about object type
at all (i.e., one LRU list, and always evicting whatever is
at the head, regardless of type).

Here's git.git:

MAX_DELTA_CACHE log-raw log-S
--------------- --------- ---------
256 0m02.227s 0m12.821s
512 0m02.143s 0m10.602s
1024 0m02.127s 0m08.642s
2048 0m02.148s 0m07.123s
4096 0m02.194s 0m06.448s*
8192 0m02.239s 0m06.504s
16384 0m02.144s* 0m06.502s
32768 0m02.202s 0m06.622s
65536 0m02.230s 0m06.677s

Much smoother; there's no dramatic upswing as we increase
the cache size (some remains, though it's small enough that
it's mostly run-to-run noise. E.g., in the log-raw case,
note how 8192 is 50-100ms higher than its neighbors). Note
also that we stop getting any real benefit for log-S after
about 4096 entries; that number will depend on the size of
the repository, the size of the blob entries, and the memory
limit of the cache.

Let's see what linux.git shows for the same strategy:

MAX_DELTA_CACHE log-raw log-S
--------------- --------- ---------
256 0m41.661s 5m12.410s
512 0m39.547s 5m07.920s
1024 0m37.054s 4m54.666s
2048 0m35.871s 4m41.194s*
4096 0m34.646s 4m51.648s
8192 0m33.881s 4m55.342s
16384 0m35.190s 5m00.122s
32768 0m35.060s 4m58.851s
65536 0m33.311s* 4m51.420s

It's similarly good. As with the "separate blob LRU"
strategy, there's a lot of noise on the log-S run here. But
it's certainly not any worse, is possibly a bit better, and
the improvement over "separate blob LRU" on the git.git case
is dramatic.

So it seems like a clear winner, and that's what this patch
implements.

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

delta_base_cache: use list.h for LRUJeff King Mon, 22 Aug 2016 21:59:42 +0000 (17:59 -0400)

delta_base_cache: use list.h for LRU

We keep an LRU list of entries for when we need to drop
something from an over-full cache. The list is implemented
as a circular doubly-linked list, which is exactly what
list.h provides. We can save a few lines by using the list.h
macros and functions. More importantly, this makes the code
easier to follow, as the reader sees explicit concepts like
"list_add_tail()" instead of pointer manipulation.

As a bonus, the list_entry() macro lets us place the lru
pointers anywhere inside the delta_base_cache_entry struct
(as opposed to just casting the pointer, which requires it
at the front of the struct). This will be useful in later
patches when we need to place other items at the front of
the struct (e.g., our hashmap implementation requires this).

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

release_delta_base_cache: reuse existing detach functionJeff King Mon, 22 Aug 2016 21:57:58 +0000 (17:57 -0400)

release_delta_base_cache: reuse existing detach function

This function drops an entry entirely from the cache,
meaning that aside from the freeing of the buffer, it is
exactly equivalent to detach_delta_base_cache_entry(). Let's
build on top of the detach function, which shortens the code
and will make it simpler when we change out the underlying
storage in future patches.

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

clear_delta_base_cache_entry: use a more descriptive... Jeff King Mon, 22 Aug 2016 21:57:53 +0000 (17:57 -0400)

clear_delta_base_cache_entry: use a more descriptive name

The delta base cache entries are stored in a fixed-length
hash table. So the way to remove an entry is to "clear" the
slot in the table, and that is what this function does.

However, the name is a leaky abstraction. If we were to
change the hash table implementation, it would no longer be
about "clearing". We should name it after _what_ it does,
not _how_ it does it. I.e., something like "remove" instead
of "clear".

But that does not tell the whole story, either. The subtle
thing about this function is that it removes the entry, but
does not free the entry data. So a more descriptive name is
"detach"; we give ownership of the data buffer to the
caller, and remove any other resources.

This patch uses the name detach_delta_base_cache_entry().
We could further model this after functions like
strbuf_detach(), which pass back all of the detached
information. However, since there are so many bits of
information in the struct (the data, the size, the type),
and so few callers (only one), it's not worth that
awkwardness. The name change and a comment can make the
intent clear.

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

cache_or_unpack_entry: drop keep_cache parameterJeff King Mon, 22 Aug 2016 21:57:45 +0000 (17:57 -0400)

cache_or_unpack_entry: drop keep_cache parameter

There is only one caller of cache_or_unpack_entry() and it
always passes 1 for the keep_cache parameter. We can
simplify it by dropping the "!keep_cache" case.

Another call, which did pass 0, was dropped in abe601b
(sha1_file: remove recursion in unpack_entry, 2013-03-27),
as unpack_entry() now does more complicated things than a
simple unpack when there is a cache miss.

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

doc: mention `git -c` in git-config(1)David Glasser Tue, 23 Aug 2016 17:33:21 +0000 (10:33 -0700)

doc: mention `git -c` in git-config(1)

Signed-off-by: David Glasser <glasser@davidglasser.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

mingw: ensure temporary file handles are not inherited... Ben Wijen Mon, 22 Aug 2016 12:47:55 +0000 (14:47 +0200)

mingw: ensure temporary file handles are not inherited by child processes

When the index is locked and child processes inherit the handle to
said lock and the parent process wants to remove the lock before the
child process exits, on Windows there is a problem: it won't work
because files cannot be deleted if a process holds a handle on them.
The symptom:

Rename from 'xxx/.git/index.lock' to 'xxx/.git/index' failed.
Should I try again? (y/n)

Spawning child processes with bInheritHandles==FALSE would not work
because no file handles would be inherited, not even the hStdXxx
handles in STARTUPINFO (stdin/stdout/stderr).

Opening every file with O_NOINHERIT does not work, either, as e.g.
git-upload-pack expects inherited file handles.

This leaves us with the only way out: creating temp files with the
O_NOINHERIT flag. This flag is Windows-specific, however. For our
purposes, it is equivalent to O_CLOEXEC (which does not exist on
Windows), so let's just open temporary files with the O_CLOEXEC flag and
map that flag to O_NOINHERIT on Windows.

As Eric Wong pointed out, we need to be careful to handle the case where
the Linux headers used to compile Git support O_CLOEXEC but the Linux
kernel used to run Git does not: it returns an EINVAL.

This fixes the test that we just introduced to demonstrate the problem.

Signed-off-by: Ben Wijen <ben@wijen.net>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

l10n: ko.po: Update Korean translationChangwoo Ryu Sun, 21 Aug 2016 13:44:00 +0000 (22:44 +0900)

l10n: ko.po: Update Korean translation

Signed-off-by: Changwoo Ryu <cwryu@debian.org>

Git 2.10-rc1 v2.10.0-rc1Junio C Hamano Fri, 19 Aug 2016 22:39:33 +0000 (15:39 -0700)

Git 2.10-rc1

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

Merge branch 'lt/gpg-show-long-key-in-signature-verific... Junio C Hamano Fri, 19 Aug 2016 22:34:16 +0000 (15:34 -0700)

Merge branch 'lt/gpg-show-long-key-in-signature-verification'

"git log --show-signature" and other commands that display the
verification status of PGP signature now shows the longer key-id,
as 32-bit key-id is so last century.

* lt/gpg-show-long-key-in-signature-verification:
gpg-interface: prefer "long" key format output when verifying pgp signatures

Merge branch 'ab/hooks'Junio C Hamano Fri, 19 Aug 2016 22:34:16 +0000 (15:34 -0700)

Merge branch 'ab/hooks'

"git rev-parse --git-path hooks/<hook>" learned to take
core.hooksPath configuration variable (introduced during 2.9 cycle)
into account.

* ab/hooks:
rev-parse: respect core.hooksPath in --git-path

Merge branch 'jk/difftool-command-not-found'Junio C Hamano Fri, 19 Aug 2016 22:34:15 +0000 (15:34 -0700)

Merge branch 'jk/difftool-command-not-found'

"git difftool" by default ignores the error exit from the backend
commands it spawns, because often they signal that they found
differences by exiting with a non-zero status code just like "diff"
does; the exit status codes 126 and above however are special in
that they are used to signal that the command is not executable,
does not exist, or killed by a signal. "git difftool" has been
taught to notice these exit status codes.

* jk/difftool-command-not-found:
difftool: always honor fatal error exit codes

Merge branch 'sb/checkout-explit-detach-no-advice'Junio C Hamano Fri, 19 Aug 2016 22:34:15 +0000 (15:34 -0700)

Merge branch 'sb/checkout-explit-detach-no-advice'

"git checkout --detach <branch>" used to give the same advice
message as that is issued when "git checkout <tag>" (or anything
that is not a branch name) is given, but asking with "--detach" is
an explicit enough sign that the user knows what is going on. The
advice message has been squelched in this case.

* sb/checkout-explit-detach-no-advice:
checkout: do not mention detach advice for explicit --detach option

Merge branch 'tb/t0027-raciness-fix'Junio C Hamano Fri, 19 Aug 2016 22:34:14 +0000 (15:34 -0700)

Merge branch 'tb/t0027-raciness-fix'

The t0027 test for CRLF conversion was timing dependent and flaky.

* tb/t0027-raciness-fix:
convert: Correct NNO tests and missing `LF will be replaced by CRLF`

Merge branch 'rs/pull-signed-tag'Junio C Hamano Fri, 19 Aug 2016 22:34:13 +0000 (15:34 -0700)

Merge branch 'rs/pull-signed-tag'

When "git merge-recursive" works on history with many criss-cross
merges in "verbose" mode, the names the command assigns to the
virtual merge bases could have overwritten each other by unintended
reuse of the same piece of memory.

* rs/pull-signed-tag:
commit: use FLEX_ARRAY in struct merge_remote_desc
merge-recursive: fix verbose output for multiple base trees
commit: factor out set_merge_remote_desc()
commit: use xstrdup() in get_merge_parent()

Revert "display HTML in default browser using Windows... Johannes Schindelin Fri, 19 Aug 2016 08:39:38 +0000 (10:39 +0200)

Revert "display HTML in default browser using Windows' shell API"

Since 4804aab (help (Windows): Display HTML in default browser using
Windows' shell API, 2008-07-13), Git for Windows used to call
`ShellExecute()` to launch the default Windows handler for `.html`
files.

The idea was to avoid going through a shell script, for performance
reasons.

However, this change ignores the `help.browser` config setting. Together
with browsing help not being a performance-critical operation, let's
just revert that patch.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t6026-merge-attr: child processes must not inherit... Ben Wijen Thu, 18 Aug 2016 14:51:12 +0000 (16:51 +0200)

t6026-merge-attr: child processes must not inherit index.lock handles

On Windows, a file cannot be removed unless all file handles to it have
been released. Hence it is particularly important to close handles when
spawning children (which would probably not even know that they hold on
to those handles).

The example chosen for this test is a custom merge driver that indeed
has no idea that it blocks the deletion of index.lock. The full use case
is a daemon that lives on after the merge, with subsequent invocations
handing off to the daemon, thereby avoiding hefty start-up costs. We
simulate this behavior by simply sleeping one second.

Note that the test only fails on Windows, due to the file locking issue.
Since we have no way to say "expect failure with MINGW, success
otherwise", we simply skip this test on Windows for now.

Signed-off-by: Ben Wijen <ben@wijen.net>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

clone: recursive and reference option triggers submodul... Stefan Beller Wed, 17 Aug 2016 22:45:35 +0000 (15:45 -0700)

clone: recursive and reference option triggers submodule alternates

When `--recursive` and `--reference` is given, it is reasonable to
expect that the submodules are created with references to the submodules
of the given alternate for the superproject.

An initial attempt to do this was presented to the mailing list, which
used flags that are passed around ("--super-reference") that instructed
the submodule clone to look for a reference in the submodules of the
referenced superproject. This is not well thought out, as any further
`submodule update` should also respect the initial setup.

When a new submodule is added to the superproject and the alternate
of the superproject does not know about that submodule yet, we rather
error out informing the user instead of being unclear if we did or did
not use a submodules alternate.

To solve this problem introduce new options that store the configuration
for what the user wanted originally.

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

RelNotes: final batch of topics before -rc1Junio C Hamano Wed, 17 Aug 2016 21:09:17 +0000 (14:09 -0700)

RelNotes: final batch of topics before -rc1

Merge branch 'js/test-lint-pathname'Junio C Hamano Wed, 17 Aug 2016 21:07:48 +0000 (14:07 -0700)

Merge branch 'js/test-lint-pathname'

The "t/" hierarchy is prone to get an unusual pathname; "make test"
has been taught to make sure they do not contain paths that cannot
be checked out on Windows (and the mechanism can be reusable to
catch pathnames that are not portable to other platforms as need
arises).

* js/test-lint-pathname:
t/Makefile: ensure that paths are valid on platforms we care

Merge branch 'sg/reflog-past-root'Junio C Hamano Wed, 17 Aug 2016 21:07:48 +0000 (14:07 -0700)

Merge branch 'sg/reflog-past-root'

A small test clean-up for a topic introduced in v2.9.1 and later.

* sg/reflog-past-root:
t1410: remove superfluous 'git reflog' from the 'walk past root' test

Merge branch 'rs/mailinfo-lib'Junio C Hamano Wed, 17 Aug 2016 21:07:47 +0000 (14:07 -0700)

Merge branch 'rs/mailinfo-lib'

Small code clean-up.

* rs/mailinfo-lib:
mailinfo: recycle strbuf in check_header()

Merge branch 'jk/tighten-alloc'Junio C Hamano Wed, 17 Aug 2016 21:07:46 +0000 (14:07 -0700)

Merge branch 'jk/tighten-alloc'

Small code and comment clean-up.

* jk/tighten-alloc:
receive-pack: use FLEX_ALLOC_MEM in queue_command()
correct FLEXPTR_* example in comment