gitweb.git
Merge branch 'js/nedmalloc-gcc6-warnings'Junio C Hamano Mon, 8 Aug 2016 21:48:42 +0000 (14:48 -0700)

Merge branch 'js/nedmalloc-gcc6-warnings'

Squelch compiler warnings for netmalloc (in compat/) library.

* js/nedmalloc-gcc6-warnings:
nedmalloc: work around overzealous GCC 6 warning
nedmalloc: fix misleading indentation

Merge branch 'nd/fbsd-lazy-mtime'Junio C Hamano Mon, 8 Aug 2016 21:48:42 +0000 (14:48 -0700)

Merge branch 'nd/fbsd-lazy-mtime'

FreeBSD can lie when asked mtime of a directory, which made the
untracked cache code to fall back to a slow-path, which in turn
caused tests in t7063 to fail because it wanted to verify the
behaviour of the fast-path.

* nd/fbsd-lazy-mtime:
t7063: work around FreeBSD's lazy mtime update feature

Merge branch 'nd/log-decorate-color-head-arrow'Junio C Hamano Mon, 8 Aug 2016 21:48:42 +0000 (14:48 -0700)

Merge branch 'nd/log-decorate-color-head-arrow'

An entry "git log --decorate" for the tip of the current branch is
shown as "HEAD -> name" (where "name" is the name of the branch);
paint the arrow in the same color as "HEAD", not in the color for
commits.

* nd/log-decorate-color-head-arrow:
log: decorate HEAD -> branch with the same color for arrow and HEAD

Merge branch 'rs/use-strbuf-addstr'Junio C Hamano Mon, 8 Aug 2016 21:48:41 +0000 (14:48 -0700)

Merge branch 'rs/use-strbuf-addstr'

* rs/use-strbuf-addstr:
use strbuf_addstr() instead of strbuf_addf() with "%s"
use strbuf_addstr() for adding constant strings to a strbuf

Merge branch 'rs/st-mult'Junio C Hamano Mon, 8 Aug 2016 21:48:41 +0000 (14:48 -0700)

Merge branch 'rs/st-mult'

Micro optimization of st_mult() facility used to check the integer
overflow coming from multiplication to compute size of memory
allocation.

* rs/st-mult:
pass constants as first argument to st_mult()

Merge branch 'ib/t3700-add-chmod-x-updates'Junio C Hamano Mon, 8 Aug 2016 21:48:40 +0000 (14:48 -0700)

Merge branch 'ib/t3700-add-chmod-x-updates'

The t3700 test about "add --chmod=-x" have been made a bit more
robust and generally cleaned up.

* ib/t3700-add-chmod-x-updates:
t3700: add a test_mode_in_index helper function
t3700: merge two tests into one
t3700: remove unwanted leftover files before running new tests

Merge branch 'ab/gitweb-link-html-escape'Junio C Hamano Mon, 8 Aug 2016 21:48:40 +0000 (14:48 -0700)

Merge branch 'ab/gitweb-link-html-escape'

The characters in the label shown for tags/refs for commits in
"gitweb" output are now properly escaped for proper HTML output.

* ab/gitweb-link-html-escape:
gitweb: escape link body in format_ref_marker

Merge branch 'jk/pack-objects-optim'Junio C Hamano Mon, 8 Aug 2016 21:48:39 +0000 (14:48 -0700)

Merge branch 'jk/pack-objects-optim'

"git pack-objects" has a few options that tell it not to pack
objects found in certain packfiles, which require it to scan .idx
files of all available packs. The codepaths involved in these
operations have been optimized for a common case of not having any
non-local pack and/or any .kept pack.

* jk/pack-objects-optim:
pack-objects: compute local/ignore_pack_keep early
pack-objects: break out of want_object loop early
find_pack_entry: replace last_found_pack with MRU cache
add generic most-recently-used list
sha1_file: drop free_pack_by_name
t/perf: add tests for many-pack scenarios

Merge branch 'jk/difftool-in-subdir'Junio C Hamano Mon, 8 Aug 2016 21:48:39 +0000 (14:48 -0700)

Merge branch 'jk/difftool-in-subdir'

"git difftool <paths>..." started in a subdirectory failed to
interpret the paths relative to that directory, which has been
fixed.

* jk/difftool-in-subdir:
difftool: use Git::* functions instead of passing around state
difftool: avoid $GIT_DIR and $GIT_WORK_TREE
difftool: fix argument handling in subdirs

Merge branch 'va/i18n'Junio C Hamano Mon, 8 Aug 2016 21:48:38 +0000 (14:48 -0700)

Merge branch 'va/i18n'

More i18n marking.

* va/i18n:
i18n: config: unfold error messages marked for translation
i18n: notes: mark comment for translation

Merge branch 'js/rebase-i-progress-tidy'Junio C Hamano Mon, 8 Aug 2016 21:48:38 +0000 (14:48 -0700)

Merge branch 'js/rebase-i-progress-tidy'

Regression fix for an i18n topic already in 'master'.

* js/rebase-i-progress-tidy:
rebase-interactive: trim leading whitespace from progress count

Merge branch 'jk/reflog-date'Junio C Hamano Mon, 8 Aug 2016 21:48:37 +0000 (14:48 -0700)

Merge branch 'jk/reflog-date'

The reflog output format is documented better, and a new format
--date=unix to report the seconds-since-epoch (without timezone)
has been added.

* jk/reflog-date:
date: clarify --date=raw description
date: add "unix" format
date: document and test "raw-local" mode
doc/pretty-formats: explain shortening of %gd
doc/pretty-formats: describe index/time formats for %gd
doc/rev-list-options: explain "-g" output formats
doc/rev-list-options: clarify "commit@{Nth}" for "-g" option

Merge branch 'cp/completion-clone-recurse-submodules'Junio C Hamano Mon, 8 Aug 2016 21:48:37 +0000 (14:48 -0700)

Merge branch 'cp/completion-clone-recurse-submodules'

* cp/completion-clone-recurse-submodules:
completion: add option '--recurse-submodules' to 'git clone'

Merge branch 'jk/t4205-cleanup'Junio C Hamano Mon, 8 Aug 2016 21:48:36 +0000 (14:48 -0700)

Merge branch 'jk/t4205-cleanup'

Test modernization.

* jk/t4205-cleanup:
t4205: indent here documents
t4205: drop top-level &&-chaining

Merge branch 'da/subtree-modernize'Junio C Hamano Mon, 8 Aug 2016 21:48:35 +0000 (14:48 -0700)

Merge branch 'da/subtree-modernize'

Style fixes for "git subtree" (in contrib/).

* da/subtree-modernize:
subtree: adjust function definitions to match CodingGuidelines
subtree: adjust style to match CodingGuidelines

Merge branch 'nd/fetch-ref-summary'Junio C Hamano Mon, 8 Aug 2016 21:48:34 +0000 (14:48 -0700)

Merge branch 'nd/fetch-ref-summary'

Hotfix of a test in a topic that has already been merged to 'master'.

* nd/fetch-ref-summary:
t5510: skip tests under GETTEXT_POISON build

Merge branch 'ew/git-svn-http-tests'Junio C Hamano Mon, 8 Aug 2016 21:48:34 +0000 (14:48 -0700)

Merge branch 'ew/git-svn-http-tests'

Tests for "git svn" have been taught to reuse the lib-httpd test
infrastructure when testing the subversion integration that
interacts with subversion repositories served over the http://
protocol.

* ew/git-svn-http-tests:
git svn: migrate tests to use lib-httpd
t/t91*: do not say how to avoid the tests

Merge branch 'js/t4130-rename-without-ino'Junio C Hamano Mon, 8 Aug 2016 21:48:33 +0000 (14:48 -0700)

Merge branch 'js/t4130-rename-without-ino'

Windows port was failing some tests in t4130, due to the lack of
inum in the returned values by its lstat(2) emulation.

* js/t4130-rename-without-ino:
t4130: work around Windows limitation

nedmalloc: work around overzealous GCC 6 warningRené Scharfe Thu, 4 Aug 2016 21:56:54 +0000 (23:56 +0200)

nedmalloc: work around overzealous GCC 6 warning

With GCC 6, the strdup() function is declared with the "nonnull"
attribute, stating that it is not allowed to pass a NULL value as
parameter.

In nedmalloc()'s reimplementation of strdup(), Postel's Law is heeded
and NULL parameters are handled gracefully. GCC 6 complains about that
now because it thinks that NULL cannot be passed to strdup() anyway.

Because the callers in this project of strdup() must be prepared to
call any implementation of strdup() supplied by the platform, so it
is pointless to pretend that it is OK to call it with NULL.

Remove the conditional based on NULL-ness of the input; this
squelches the warning. Check the return value of malloc() instead
to make sure we actually got the memory to write to.

See https://gcc.gnu.org/gcc-6/porting_to.html for details.

Diagnosed-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

use strbuf_addstr() instead of strbuf_addf() with "%s"René Scharfe Fri, 5 Aug 2016 20:37:11 +0000 (22:37 +0200)

use strbuf_addstr() instead of strbuf_addf() with "%s"

Call strbuf_addstr() for adding a simple string to a strbuf instead of
using the heavier strbuf_addf(). This is shorter and documents the
intent more clearly.

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

Tenth batch for 2.10Junio C Hamano Thu, 4 Aug 2016 21:40:34 +0000 (14:40 -0700)

Tenth batch for 2.10

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

Merge branch 'jc/grep-commandline-vs-configuration'Junio C Hamano Thu, 4 Aug 2016 21:39:18 +0000 (14:39 -0700)

Merge branch 'jc/grep-commandline-vs-configuration'

"git -c grep.patternType=extended log --basic-regexp" misbehaved
because the internal API to access the grep machinery was not
designed well.

* jc/grep-commandline-vs-configuration:
grep: further simplify setting the pattern type

Merge branch 'sb/submodule-clone-retry'Junio C Hamano Thu, 4 Aug 2016 21:39:17 +0000 (14:39 -0700)

Merge branch 'sb/submodule-clone-retry'

An earlier tweak to make "submodule update" retry a failing clone
of submodules was buggy and caused segfault, which has been fixed.

* sb/submodule-clone-retry:
submodule-helper: fix indexing in clone retry error reporting path
git-submodule: forward exit code of git-submodule--helper more faithfully

Merge branch 'sb/pack-protocol-doc-nak'Junio C Hamano Thu, 4 Aug 2016 21:39:16 +0000 (14:39 -0700)

Merge branch 'sb/pack-protocol-doc-nak'

A doc update.

* sb/pack-protocol-doc-nak:
Documentation: pack-protocol correct NAK response

nedmalloc: fix misleading indentationJohannes Schindelin Thu, 4 Aug 2016 16:07:03 +0000 (18:07 +0200)

nedmalloc: fix misleading indentation

Some code in nedmalloc is indented in a funny way that could be
misinterpreted as if a line after a for loop was included in the loop
body, when it is not.

GCC 6 complains about this in DEVELOPER=YepSure mode.

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

t7063: work around FreeBSD's lazy mtime update featureNguyễn Thái Ngọc Duy Wed, 3 Aug 2016 17:45:22 +0000 (19:45 +0200)

t7063: work around FreeBSD's lazy mtime update feature

Let's start with the commit message of [1] from freebsd.git [2]

Sync timestamp changes for inodes of special files to disk as late
as possible (when the inode is reclaimed). Temporarily only do
this if option UFS_LAZYMOD configured and softupdates aren't
enabled. UFS_LAZYMOD is intentionally left out of
/sys/conf/options.

This is mainly to avoid almost useless disk i/o on battery powered
machines. It's silly to write to disk (on the next sync or when
the inode becomes inactive) just because someone hit a key or
something wrote to the screen or /dev/null.

PR: 5577 [3]

The short version of that, in the context of t7063, is that when a
directory is updated, its mtime may be updated later, not
immediately. This can be shown with a simple command sequence

date; sleep 1; touch abc; rm abc; sleep 10; ls -lTd .

One would expect that the date shown in `ls` would be one second from
`date`, but it's 10 seconds later. If we put another `ls -lTd .` in
front of `sleep 10`, then the date of the last `ls` comes as
expected. The first `ls` somehow forces mtime to be updated.

t7063 is really sensitive to directory mtime. When mtime is too "new",
git code suspects racy timestamps and will not trigger the shortcut in
untracked cache, in t7063.24 and eventually be detected in t7063.27

We have two options thanks to this special FreeBSD feature:

1) Stop supporting untracked cache on FreeBSD. Skip t7063 entirely
when running on FreeBSD

2) Work around this problem (using the same 'ls' trick) and continue
to support untracked cache on FreeBSD

I initially wanted to go with 1) because I didn't know the exact
nature of this feature and feared that it would make untracked cache
work unreliably, using the cached version when it should not.

Since the behavior of this thing is clearer now. The picture is not
that bad. If this indeed happens often, untracked cache would assume
racy condition more often and _fall back_ to non-untracked cache code
paths. Which means it may be less effective, but it will not show
wrong things.

This patch goes with option 2.

PS. For those who want to look further in FreeBSD source code, this
flag is now called IN_LAZYMOD. I can see it's effective in ext2 and
ufs. zfs is not affected.

[1] 660e6408e6df99a20dacb070c5e7f9739efdf96d
[2] git://github.com/freebsd/freebsd.git
[3] https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=5577

Reported-by: Eric Wong <e@80x24.org>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ninth batch of topics for 2.10Junio C Hamano Wed, 3 Aug 2016 22:13:16 +0000 (15:13 -0700)

Ninth batch of topics for 2.10

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

Merge branch 'jk/diff-do-not-reuse-wtf-needs-cleaning'Junio C Hamano Wed, 3 Aug 2016 22:10:29 +0000 (15:10 -0700)

Merge branch 'jk/diff-do-not-reuse-wtf-needs-cleaning'

There is an optimization used in "git diff $treeA $treeB" to borrow
an already checked-out copy in the working tree when it is known to
be the same as the blob being compared, expecting that open/mmap of
such a file is faster than reading it from the object store, which
involves inflating and applying delta. This however kicked in even
when the checked-out copy needs to go through the convert-to-git
conversion (including the clean filter), which defeats the whole
point of the optimization. The optimization has been disabled when
the conversion is necessary.

* jk/diff-do-not-reuse-wtf-needs-cleaning:
diff: do not reuse worktree files that need "clean" conversion

Merge branch 'rs/submodule-config-code-cleanup'Junio C Hamano Wed, 3 Aug 2016 22:10:28 +0000 (15:10 -0700)

Merge branch 'rs/submodule-config-code-cleanup'

Code cleanup.

* rs/submodule-config-code-cleanup:
submodule-config: fix test binary crashing when no arguments given
submodule-config: combine early return code into one goto
submodule-config: passing name reference for .gitmodule blobs
submodule-config: use explicit empty string instead of strbuf in config_from()

Merge branch 'jk/push-progress'Junio C Hamano Wed, 3 Aug 2016 22:10:27 +0000 (15:10 -0700)

Merge branch 'jk/push-progress'

"git push" and "git clone" learned to give better progress meters
to the end user who is waiting on the terminal.

* jk/push-progress:
receive-pack: send keepalives during quiet periods
receive-pack: turn on connectivity progress
receive-pack: relay connectivity errors to sideband
receive-pack: turn on index-pack resolving progress
index-pack: add flag for showing delta-resolution progress
clone: use a real progress meter for connectivity check
check_connected: add progress flag
check_connected: relay errors to alternate descriptor
check_everything_connected: use a struct with named options
check_everything_connected: convert to argv_array
rev-list: add optional progress reporting
check_everything_connected: always pass --quiet to rev-list

Merge branch 'jt/fetch-large-handshake-window-on-http'Junio C Hamano Wed, 3 Aug 2016 22:10:27 +0000 (15:10 -0700)

Merge branch 'jt/fetch-large-handshake-window-on-http'

"git fetch" exchanges batched have/ack messages between the sender
and the receiver, initially doubling every time and then falling
back to enlarge the window size linearly. The "smart http"
transport, being an half-duplex protocol, outgrows the preset limit
too quickly and becomes inefficient when interacting with a large
repository. The internal mechanism learned to grow the window size
more aggressively when working with the "smart http" transport.

* jt/fetch-large-handshake-window-on-http:
fetch-pack: grow stateless RPC windows exponentially

Merge branch 'jk/git-jump'Junio C Hamano Wed, 3 Aug 2016 22:10:27 +0000 (15:10 -0700)

Merge branch 'jk/git-jump'

"git jump" script (in contrib/) has been updated a bit.

* jk/git-jump:
contrib/git-jump: fix typo in README
contrib/git-jump: add whitespace-checking mode
contrib/git-jump: fix greedy regex when matching hunks

Merge branch 'mm/status-suggest-merge-abort'Junio C Hamano Wed, 3 Aug 2016 22:10:26 +0000 (15:10 -0700)

Merge branch 'mm/status-suggest-merge-abort'

"git status" learned to suggest "merge --abort" during a conflicted
merge, just like it already suggests "rebase --abort" during a
conflicted rebase.

* mm/status-suggest-merge-abort:
status: suggest 'git merge --abort' when appropriate

Merge branch 'jk/parse-options-concat'Junio C Hamano Wed, 3 Aug 2016 22:10:25 +0000 (15:10 -0700)

Merge branch 'jk/parse-options-concat'

Users of the parse_options_concat() API function need to allocate
extra slots in advance and fill them with OPT_END() when they want
to decide the set of supported options dynamically, which makes the
code error-prone and hard to read. This has been corrected by tweaking
the API to allocate and return a new copy of "struct option" array.

* jk/parse-options-concat:
parse_options: allocate a new array when concatenating

Merge branch 'sb/push-options'Junio C Hamano Wed, 3 Aug 2016 22:10:24 +0000 (15:10 -0700)

Merge branch 'sb/push-options'

"git push" learned to accept and pass extra options to the
receiving end so that hooks can read and react to them.

* sb/push-options:
add a test for push options
push: accept push options
receive-pack: implement advertising and receiving push options
push options: {pre,post}-receive hook learns about push options

Merge branch 'ew/http-walker'Junio C Hamano Wed, 3 Aug 2016 22:10:24 +0000 (15:10 -0700)

Merge branch 'ew/http-walker'

Dumb http transport on the client side has been optimized.

* ew/http-walker:
list: avoid incompatibility with *BSD sys/queue.h
http-walker: reduce O(n) ops with doubly-linked list
http: avoid disconnecting on 404s for loose objects
http-walker: remove unused parameter from fetch_object

Merge branch 'pm/build-persistent-https-with-recent-go'Junio C Hamano Wed, 3 Aug 2016 22:10:23 +0000 (15:10 -0700)

Merge branch 'pm/build-persistent-https-with-recent-go'

The build procedure for "git persistent-https" helper (in contrib/)
has been updated so that it can be built with more recent versions
of Go.

* pm/build-persistent-https-with-recent-go:
contrib/persistent-https: use Git version for build label
contrib/persistent-https: update ldflags syntax for Go 1.7+

Merge branch 'da/subtree-2.9-regression'Junio C Hamano Wed, 3 Aug 2016 22:10:22 +0000 (15:10 -0700)

Merge branch 'da/subtree-2.9-regression'

"git merge" in Git v2.9 was taught to forbid merging an unrelated
lines of history by default, but that is exactly the kind of thing
the "--rejoin" mode of "git subtree" (in contrib/) wants to do.
"git subtree" has been taught to use the "--allow-unrelated-histories"
option to override the default.

* da/subtree-2.9-regression:
subtree: fix "git subtree split --rejoin"
t7900-subtree.sh: fix quoting and broken && chains

Merge branch 'os/no-verify-skips-commit-msg-too'Junio C Hamano Wed, 3 Aug 2016 22:10:22 +0000 (15:10 -0700)

Merge branch 'os/no-verify-skips-commit-msg-too'

"git commit --help" said "--no-verify" is only about skipping the
pre-commit hook, and failed to say that it also skipped the
commit-msg hook.

* os/no-verify-skips-commit-msg-too:
commit: describe that --no-verify skips the commit-msg hook in the help text

t4130: work around Windows limitationJohannes Sixt Wed, 3 Aug 2016 06:15:03 +0000 (08:15 +0200)

t4130: work around Windows limitation

On Windows, it is already pretty expensive to try to recreate the stat()
data that Git assumes is cheap to obtain. To make things halfway decent
in performance, we even have to skip emulating the inode and to
determine the number of hard links.

This is not a huge problem, usually, as either the size or the mtime or
the ctime are tell-tale enough to say when a file has changed, and even
if not, those changes are typically made after the index file was
written, triggering a rehashing of the files' contents.

The t4130-apply-criss-cross-rename test case, however, requires the
inode to determine that files of equal size were swapped, as renaming
files does not update their mtime. Every once in a while, t4130 fails
on Windows because of this missing piece.

Equal file sizes are not crucial for the test cases, however. Hence,
generate files with different sizes so that there is some property that
the swapped files can be discovered reliably even on Windows.

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

t3700: add a test_mode_in_index helper functionIngo Brückl Sat, 30 Jul 2016 20:13:54 +0000 (22:13 +0200)

t3700: add a test_mode_in_index helper function

The case statement to check the file mode of a staged file appears
a number of times.

Simplify the test by utilizing a test_mode_in_index helper function.

Signed-off-by: Ingo Brückl <ib@wupperonline.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t3700: merge two tests into oneIngo Brückl Sat, 30 Jul 2016 20:13:48 +0000 (22:13 +0200)

t3700: merge two tests into one

Depending on the underlying platform a chmod may be a noop. Although it
wouldn't harm the result of the '--chmod=-x' test, there is a more
robust way to make sure the --chmod option works both ways.

Merge the two separate tests for the --chmod option into one, checking
both permissions on the same file.

Signed-off-by: Ingo Brückl <ib@wupperonline.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t3700: remove unwanted leftover files before running... Ingo Brückl Sat, 30 Jul 2016 20:13:38 +0000 (22:13 +0200)

t3700: remove unwanted leftover files before running new tests

When an earlier test that has prerequisite is skipped, files
used by later tests may be left in the working tree in an
unexpected state. For example, a test runs this sequence:

echo foo >xfoo1 && chmod 755 xfoo1

to create an executable file xfoo1, expecting that xfoo1
does not exist before it runs in the test sequence.
However, the absence of this file depends on "git reset
--hard" done in an earlier test, that is skipped when SANITY
prerequisite is not met, and worse yet, xfoo1 originally is
created as a symbolic link, which means the chmod does not
affect the modes of xfoo1 as this test expects.

Fix this by starting the test with "rm -f xfoo1" to make
sure the file is created from scratch, and do the same to
other similar tests.

Signed-off-by: Ingo Brückl <ib@wupperonline.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

pass constants as first argument to st_mult()René Scharfe Sat, 30 Jul 2016 18:18:31 +0000 (20:18 +0200)

pass constants as first argument to st_mult()

The result of st_mult() is the same no matter the order of its
arguments. It invokes the macro unsigned_mult_overflows(), which
divides the second parameter by the first one. Pass constants
first to allow that division to be done already at compile time.

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

use strbuf_addstr() for adding constant strings to... René Scharfe Sat, 30 Jul 2016 17:36:23 +0000 (19:36 +0200)

use strbuf_addstr() for adding constant strings to a strbuf

Replace uses of strbuf_addf() for adding strings with more lightweight
strbuf_addstr() calls.

In http-push.c it becomes easier to see what's going on without having
to verfiy that the definition of PROPFIND_ALL_REQUEST doesn't contain
any format specifiers.

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

gitweb: escape link body in format_ref_markerAndreas Brauchli Fri, 29 Jul 2016 14:49:37 +0000 (16:49 +0200)

gitweb: escape link body in format_ref_marker

Fix a case where an html link can be generated from unescaped input
resulting in invalid strict xhtml or potentially injected code.

An overview of a repo with a tag "1.0.0&0.0.1" would previously result
in an unescaped ampersand in the link body.

Signed-off-by: Andreas Brauchli <a.brauchli@elementarea.net>
Acked-by: Jakub Narębski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

pack-objects: compute local/ignore_pack_keep earlyJeff King Fri, 29 Jul 2016 04:11:31 +0000 (00:11 -0400)

pack-objects: compute local/ignore_pack_keep early

In want_object_in_pack(), we can exit early from our loop if
neither "local" nor "ignore_pack_keep" are set. If they are,
however, we must examine each pack to see if it has the
object and is non-local or has a ".keep".

It's quite common for there to be no non-local or .keep
packs at all, in which case we know ahead of time that
looking further will be pointless. We can pre-compute this
by simply iterating over the list of packs ahead of time,
and dropping the flags if there are no packs that could
match.

Another similar strategy would be to modify the loop in
want_object_in_pack() to notice that we have already found
the object once, and that we are looping only to check for
"local" and "keep" attributes. If a pack has neither of
those, we can skip the call to find_pack_entry_one(), which
is the expensive part of the loop.

This has two advantages:

- it isn't all-or-nothing; we still get some improvement
when there's a small number of kept or non-local packs,
and a large number of non-kept local packs

- it eliminates any possible race where we add new
non-local or kept packs after our initial scan. In
practice, I don't think this race matters; we already
cache the packed_git information, so somebody who adds a
new pack or .keep file after we've started will not be
noticed at all, unless we happen to need to call
reprepare_packed_git() because a lookup fails.

In other words, we're already racy, and the race is not
a big deal (losing the race means we might include an
object in the pack that would not otherwise be, which is
an acceptable outcome).

However, it also has a disadvantage: we still loop over the
rest of the packs for each object to check their flags. This
is much less expensive than doing the object lookup, but
still not free. So if we wanted to implement that strategy
to cover the non-all-or-nothing cases, we could do so in
addition to this one (so you get the most speedup in the
all-or-nothing case, and the best we can do in the other
cases). But given that the all-or-nothing case is likely the
most common, it is probably not worth the trouble, and we
can revisit this later if evidence points otherwise.

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

pack-objects: break out of want_object loop earlyJeff King Fri, 29 Jul 2016 04:10:31 +0000 (00:10 -0400)

pack-objects: break out of want_object loop early

When pack-objects collects the list of objects to pack
(either from stdin, or via its internal rev-list), it
filters each one through want_object_in_pack().

This function loops through each existing packfile, looking
for the object. When we find it, we mark the pack/offset
combo for later use. However, we can't just return "yes, we
want it" at that point. If --honor-pack-keep is in effect,
we must keep looking to find it in _all_ packs, to make sure
none of them has a .keep. Likewise, if --local is in effect,
we must make sure it is not present in any non-local pack.

As a result, the sum effort of these calls is effectively
O(nr_objects * nr_packs). In an ordinary repository, we have
only a handful of packs, and this doesn't make a big
difference. But in pathological cases, it can slow the
counting phase to a crawl.

This patch notices the case that we have neither "--local"
nor "--honor-pack-keep" in effect and breaks out of the loop
early, after finding the first instance. Note that our worst
case is still "objects * packs" (i.e., we might find each
object in the last pack we look in), but in practice we will
often break out early. On an "average" repo, my git.git with
8 packs, this shows a modest 2% (a few dozen milliseconds)
improvement in the counting-objects phase of "git
pack-objects --all <foo" (hackily instrumented by sticking
exit(0) right after list_objects).

But in a much more pathological case, it makes a bigger
difference. I ran the same command on a real-world example
with ~9 million objects across 1300 packs. The counting time
dropped from 413s to 45s, an improvement of about 89%.

Note that this patch won't do anything by itself for a
normal "git gc", as it uses both --honor-pack-keep and
--local.

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

find_pack_entry: replace last_found_pack with MRU cacheJeff King Fri, 29 Jul 2016 04:09:46 +0000 (00:09 -0400)

find_pack_entry: replace last_found_pack with MRU cache

Each pack has an index for looking up entries in O(log n)
time, but if we have multiple packs, we have to scan through
them linearly. This can produce a measurable overhead for
some operations.

We dealt with this long ago in f7c22cc (always start looking
up objects in the last used pack first, 2007-05-30), which
keeps what is essentially a 1-element most-recently-used
cache. In theory, we should be able to do better by keeping
a similar but longer cache, that is the same length as the
pack-list itself.

Since we now have a convenient generic MRU structure, we can
plug it in and measure. Here are the numbers for running
p5303 against linux.git:

Test HEAD^ HEAD
------------------------------------------------------------------------
5303.3: rev-list (1) 31.56(31.28+0.27) 31.30(31.08+0.20) -0.8%
5303.4: repack (1) 40.62(39.35+2.36) 40.60(39.27+2.44) -0.0%
5303.6: rev-list (50) 31.31(31.06+0.23) 31.23(31.00+0.22) -0.3%
5303.7: repack (50) 58.65(69.12+1.94) 58.27(68.64+2.05) -0.6%
5303.9: rev-list (1000) 38.74(38.40+0.33) 31.87(31.62+0.24) -17.7%
5303.10: repack (1000) 367.20(441.80+4.62) 342.00(414.04+3.72) -6.9%

The main numbers of interest here are the rev-list ones
(since that is exercising the normal object lookup code
path). The single-pack case shouldn't improve at all; the
260ms speedup there is just part of the run-to-run noise
(but it's important to note that we didn't make anything
worse with the overhead of maintaining our cache). In the
50-pack case, we see similar results. There may be a slight
improvement, but it's mostly within the noise.

The 1000-pack case does show a big improvement, though. That
carries over to the repack case, as well. Even though we
haven't touched its pack-search loop yet, it does still do a
lot of normal object lookups (e.g., for the internal
revision walk), and so improves.

As a point of reference, I also ran the 1000-pack test
against a version of HEAD^ with the last_found_pack
optimization disabled. It takes ~60s, so that gives an
indication of how much even the single-element cache is
helping.

For comparison, here's a smaller repository, git.git:

Test HEAD^ HEAD
---------------------------------------------------------------------
5303.3: rev-list (1) 1.56(1.54+0.01) 1.54(1.51+0.02) -1.3%
5303.4: repack (1) 1.84(1.80+0.10) 1.82(1.80+0.09) -1.1%
5303.6: rev-list (50) 1.58(1.55+0.02) 1.59(1.57+0.01) +0.6%
5303.7: repack (50) 2.50(3.18+0.04) 2.50(3.14+0.04) +0.0%
5303.9: rev-list (1000) 2.76(2.71+0.04) 2.24(2.21+0.02) -18.8%
5303.10: repack (1000) 13.21(19.56+0.25) 11.66(18.01+0.21) -11.7%

You can see that the percentage improvement is similar.
That's because the lookup we are optimizing is roughly
O(nr_objects * nr_packs). Since the number of packs is
constant in both tests, we'd expect the improvement to be
linear in the number of objects. But the whole process is
also linear in the number of objects, so the improvement
is a constant factor.

The exact improvement does also depend on the contents of
the packs. In p5303, the extra packs all have 5 first-parent
commits in them, which is a reasonable simulation of a
pushed-to repository. But it also means that only 250
first-parent commits are in those packs (compared to almost
50,000 total in linux.git), and the rest are in the huge
"base" pack. So once we start looking at history in taht big
pack, that's where we'll find most everything, and even the
1-element cache gets close to 100% cache hits. You could
almost certainly show better numbers with a more
pathological case (e.g., distributing the objects more
evenly across the packs). But that's simply not that
realistic a scenario, so it makes more sense to focus on
these numbers.

The implementation itself is a straightforward application
of the MRU code. We provide an MRU-ordered list of packs
that shadows the packed_git list. This is easy to do because
we only create and revise the pack list in one place. The
"reprepare" code path actually drops the whole MRU and
replaces it for simplicity. It would be more efficient to
just add new entries, but there's not much point in
optimizing here; repreparing happens rarely, and only after
doing a lot of other expensive work. The key things to keep
optimized are traversal (which is just a normal linked list,
albeit with one extra level of indirection over the regular
packed_git list), and marking (which is a constant number of
pointer assignments, though slightly more than the old
last_found_pack was; it doesn't seem to create a measurable
slowdown, though).

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

add generic most-recently-used listJeff King Fri, 29 Jul 2016 04:06:59 +0000 (00:06 -0400)

add generic most-recently-used list

There are a few places in Git that would benefit from a fast
most-recently-used cache (e.g., the list of packs, which we
search linearly but would like to order based on locality).
This patch introduces a generic list that can be used to
store arbitrary pointers in most-recently-used order.

The implementation is just a doubly-linked list, where
"marking" an item as used moves it to the front of the list.
Insertion and marking are O(1), and iteration is O(n).

There's no lookup support provided; if you need fast
lookups, you are better off with a different data structure
in the first place.

There is also no deletion support. This would not be hard to
do, but it's not necessary for handling pack structs, which
are created and never removed.

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

sha1_file: drop free_pack_by_nameJeff King Fri, 29 Jul 2016 04:06:48 +0000 (00:06 -0400)

sha1_file: drop free_pack_by_name

The point of this function is to drop an entry from the
"packed_git" cache that points to a file we might be
overwriting, because our contents may not be the same (and
hence the only caller was pack-objects as it moved a
temporary packfile into place).

In older versions of git, this could happen because the
names of packfiles were derived from the set of objects they
contained, not the actual bits on disk. But since 1190a1a
(pack-objects: name pack files after trailer hash,
2013-12-05), the name reflects the actual bits on disk, and
any two packfiles with the same name can be used
interchangeably.

Dropping this function not only saves a few lines of code,
it makes the lifetime of "struct packed_git" much easier to
reason about: namely, we now do not ever free these structs.

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

t/perf: add tests for many-pack scenariosJeff King Fri, 29 Jul 2016 04:06:09 +0000 (00:06 -0400)

t/perf: add tests for many-pack scenarios

Git's pack storage does efficient (log n) lookups in a
single packfile's index, but if we have multiple packfiles,
we have to linearly search each for a given object. This
patch introduces some timing tests for cases where we have a
large number of packs, so that we can measure any
improvements we make in the following patches.

The main thing we want to time is object lookup. To do this,
we measure "git rev-list --objects --all", which does a
fairly large number of object lookups (essentially one per
object in the repository).

However, we also measure the time to do a full repack, which
is interesting for two reasons. One is that in addition to
the usual pack lookup, it has its own linear iteration over
the list of packs. And two is that because it it is the tool
one uses to go from an inefficient many-pack situation back
to a single pack, we care about its performance not only at
marginal numbers of packs, but at the extreme cases (e.g.,
if you somehow end up with 5,000 packs, it is the only way
to get back to 1 pack, so we need to make sure it performs
well).

We measure the performance of each command in three
scenarios: 1 pack, 50 packs, and 1,000 packs.

The 1-pack case is a baseline; any optimizations we do to
handle multiple packs cannot possibly perform better than
this.

The 50-pack case is as far as Git should generally allow
your repository to go, if you have auto-gc enabled with the
default settings. So this represents the maximum performance
improvement we would expect under normal circumstances.

The 1,000-pack case is hopefully rare, though I have seen it
in the wild where automatic maintenance was broken for some
time (and the repository continued to receive pushes). This
represents cases where we care less about general
performance, but want to make sure that a full repack
command does not take excessively long.

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

Sync with maintJunio C Hamano Thu, 28 Jul 2016 21:21:18 +0000 (14:21 -0700)

Sync with maint

* maint:
Some fixes for 2.9.3

Eighth batch of topics for 2.10Junio C Hamano Thu, 28 Jul 2016 20:14:53 +0000 (13:14 -0700)

Eighth batch of topics for 2.10

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

t9100: portability fixJunio C Hamano Thu, 28 Jul 2016 21:20:13 +0000 (14:20 -0700)

t9100: portability fix

Do not say "export VAR=VAL"; "VAR=VAL && export VAR" is always more
portable.

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

difftool: use Git::* functions instead of passing aroun... David Aguilar Tue, 19 Jul 2016 03:57:56 +0000 (20:57 -0700)

difftool: use Git::* functions instead of passing around state

Call Git::command() and friends directly wherever possible.
This makes it clear that these operations can be invoked directly
without needing to manage the current directory and related GIT_*
environment variables.

Eliminate find_repository() since we can now use wc_path() and
not worry about side-effects involving environment variables.

Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

difftool: avoid $GIT_DIR and $GIT_WORK_TREEDavid Aguilar Tue, 19 Jul 2016 03:57:55 +0000 (20:57 -0700)

difftool: avoid $GIT_DIR and $GIT_WORK_TREE

Environment variables are global and hard to reason about.
Use the `--git-dir` and `--work-tree` arguments when invoking `git`
instead of relying on the environment.

Add a test to ensure that difftool's dir-diff feature works when these
variables are present in the environment.

Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

rebase-interactive: trim leading whitespace from progre... Johannes Sixt Thu, 28 Jul 2016 17:47:23 +0000 (19:47 +0200)

rebase-interactive: trim leading whitespace from progress count

Interactive rebase uses 'wc -l' to write the current patch number
in a progress report. Some implementations of 'wc -l' produce spaces
before the number, leading to ugly output such as

Rebasing ( 3/8)

Remove the spaces using a trivial arithmetic evaluation.

Before 9588c52 (i18n: rebase-interactive: mark strings for
translation) this was not a problem because printf was used to
generate the text. Since that commit, the count is interpolated
directly from a shell variable into the text, where the spaces
remain. The total number of patches does not have this problem
even though it is interpolated from a shell variable in the same
manner, because the variable is set by an arithmetic evaluation.

Later in the script, there is a virtually identical case where
leading spaces are trimmed, but it uses a pattern substitution:

todocount=$(git stripspace --strip-comments <"$todo" | wc -l)
todocount=${todocount##* }

I did not choose this idiom because it adds a line of code, and
there is already an arithmetic evaluation in the vicinity of the
line that is changed here.

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

Merge branch 'master' of git://git.bogomips.org/git-svnJunio C Hamano Thu, 28 Jul 2016 20:13:53 +0000 (13:13 -0700)

Merge branch 'master' of git://git.bogomips.org/git-svn

* 'master' of git://git.bogomips.org/git-svn:
git-svn: allow --version to work anywhere
git-svn: document svn.authorsProg in config

submodule-config: fix test binary crashing when no... Heiko Voigt Thu, 28 Jul 2016 12:50:05 +0000 (14:50 +0200)

submodule-config: fix test binary crashing when no arguments given

Since arg[0] will be NULL without any argument here and starts_with()
does not like NULL-pointers.

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

submodule-config: combine early return code into one... Heiko Voigt Thu, 28 Jul 2016 12:49:47 +0000 (14:49 +0200)

submodule-config: combine early return code into one goto

So we have simpler return handling code and all the cleanup code in
almost one place.

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

submodule-config: passing name reference for .gitmodule... Heiko Voigt Thu, 28 Jul 2016 12:49:11 +0000 (14:49 +0200)

submodule-config: passing name reference for .gitmodule blobs

Commit 959b5455 (submodule: implement a config API for lookup of
.gitmodules values, 2015-08-18) implemented the initial version of the
submodule config cache. During development of that initial version we
extracted the function gitmodule_sha1_from_commit(). During that process
we missed that the strbuf rev was still used in config_from() and now is
left empty. Lets fix this by also returning this string.

This means that now when reading .gitmodules from revisions, the error
messages also contain a reference to the blob they are from.

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

Some fixes for 2.9.3Junio C Hamano Thu, 28 Jul 2016 18:28:32 +0000 (11:28 -0700)

Some fixes for 2.9.3

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

Merge branch 'ak/lazy-prereq-mktemp' into maintJunio C Hamano Thu, 28 Jul 2016 18:26:03 +0000 (11:26 -0700)

Merge branch 'ak/lazy-prereq-mktemp' into maint

A test that unconditionally used "mktemp" learned that the command
is not necessarily available everywhere.

* ak/lazy-prereq-mktemp:
t7610: test for mktemp before test execution

Merge branch 'nd/icase' into maintJunio C Hamano Thu, 28 Jul 2016 18:26:03 +0000 (11:26 -0700)

Merge branch 'nd/icase' into maint

"git grep -i" has been taught to fold case in non-ascii locales
correctly.

* nd/icase:
grep.c: reuse "icase" variable
diffcore-pickaxe: support case insensitive match on non-ascii
diffcore-pickaxe: Add regcomp_or_die()
grep/pcre: support utf-8
gettext: add is_utf8_locale()
grep/pcre: prepare locale-dependent tables for icase matching
grep: rewrite an if/else condition to avoid duplicate expression
grep/icase: avoid kwsset when -F is specified
grep/icase: avoid kwsset on literal non-ascii strings
test-regex: expose full regcomp() to the command line
test-regex: isolate the bug test code
grep: break down an "if" stmt in preparation for next changes

Merge branch 'sb/submodule-parallel-fetch' into maintJunio C Hamano Thu, 28 Jul 2016 18:26:02 +0000 (11:26 -0700)

Merge branch 'sb/submodule-parallel-fetch' into maint

Fix recently introduced codepaths that are involved in parallel
submodule operations, which gave up on reading too early, and
could have wasted CPU while attempting to write under a corner
case condition.

* sb/submodule-parallel-fetch:
hoist out handle_nonblock function for xread and xwrite
xwrite: poll on non-blocking FDs
xread: retry after poll on EAGAIN/EWOULDBLOCK

Merge branch 'dk/blame-move-no-reason-for-1-line-contex... Junio C Hamano Thu, 28 Jul 2016 18:26:01 +0000 (11:26 -0700)

Merge branch 'dk/blame-move-no-reason-for-1-line-context' into maint

"git blame -M" missed a single line that was moved within the file.

* dk/blame-move-no-reason-for-1-line-context:
blame: require 0 context lines while finding moved lines with -M

Merge branch 'jk/test-match-signal' into maintJunio C Hamano Thu, 28 Jul 2016 18:26:00 +0000 (11:26 -0700)

Merge branch 'jk/test-match-signal' into maint

The test framework learned a new helper test_match_signal to
check an exit code from getting killed by an expected signal.

* jk/test-match-signal:
t/lib-git-daemon: use test_match_signal
test_must_fail: use test_match_signal
t0005: use test_match_signal as appropriate
tests: factor portable signal check out of t0005

Merge branch 'js/am-call-theirs-theirs-in-fallback... Junio C Hamano Thu, 28 Jul 2016 18:25:59 +0000 (11:25 -0700)

Merge branch 'js/am-call-theirs-theirs-in-fallback-3way' into maint

One part of "git am" had an oddball helper function that called
stuff from outside "his" as opposed to calling what we have "ours",
which was not gender-neutral and also inconsistent with the rest of
the system where outside stuff is usuall called "theirs" in
contrast to "ours".

* js/am-call-theirs-theirs-in-fallback-3way:
am: counteract gender bias

Merge branch 'js/t3404-grammo-fix' into maintJunio C Hamano Thu, 28 Jul 2016 18:25:58 +0000 (11:25 -0700)

Merge branch 'js/t3404-grammo-fix' into maint

Grammofix.

* js/t3404-grammo-fix:
t3404: fix a grammo (commands are ran -> commands are run)

Merge branch 'nd/doc-new-command' into maintJunio C Hamano Thu, 28 Jul 2016 18:25:57 +0000 (11:25 -0700)

Merge branch 'nd/doc-new-command' into maint

Typofix in a doc.

* nd/doc-new-command:
new-command.txt: correct the command description file

Merge branch 'ew/gc-auto-pack-limit-fix' into maintJunio C Hamano Thu, 28 Jul 2016 18:25:56 +0000 (11:25 -0700)

Merge branch 'ew/gc-auto-pack-limit-fix' into maint

"gc.autoPackLimit" when set to 1 should not trigger a repacking
when there is only one pack, but the code counted poorly and did
so.

* ew/gc-auto-pack-limit-fix:
gc: fix off-by-one error with gc.autoPackLimit

Merge branch 'js/color-on-windows-comment' into maintJunio C Hamano Thu, 28 Jul 2016 18:25:55 +0000 (11:25 -0700)

Merge branch 'js/color-on-windows-comment' into maint

For a long time, we carried an in-code comment that said our
colored output would work only when we use fprintf/fputs on
Windows, which no longer is the case for the past few years.

* js/color-on-windows-comment:
color.h: remove obsolete comment about limitations on Windows

Merge branch 'mm/doc-tt' into maintJunio C Hamano Thu, 28 Jul 2016 18:25:54 +0000 (11:25 -0700)

Merge branch 'mm/doc-tt' into maint

More mark-up updates to typeset strings that are expected to
literally typed by the end user in fixed-width font.

* mm/doc-tt:
doc: typeset HEAD and variants as literal
CodingGuidelines: formatting HEAD in documentation
doc: typeset long options with argument as literal
doc: typeset '--' as literal
doc: typeset long command-line options as literal
doc: typeset short command-line options as literal
Documentation/git-mv.txt: fix whitespace indentation

Merge branch 'js/sign-empty-commit-fix' into maintJunio C Hamano Thu, 28 Jul 2016 18:25:53 +0000 (11:25 -0700)

Merge branch 'js/sign-empty-commit-fix' into maint

"git commit --amend --allow-empty-message -S" for a commit without
any message body could have misidentified where the header of the
commit object ends.

* js/sign-empty-commit-fix:
commit -S: avoid invalid pointer with empty message

Merge branch 'ps/rebase-i-auto-unstash-upon-abort'... Junio C Hamano Thu, 28 Jul 2016 18:25:52 +0000 (11:25 -0700)

Merge branch 'ps/rebase-i-auto-unstash-upon-abort' into maint

"git rebase -i --autostash" did not restore the auto-stashed change
when the operation was aborted.

* ps/rebase-i-auto-unstash-upon-abort:
rebase -i: restore autostash on abort

Merge branch 'nd/ita-cleanup' into maintJunio C Hamano Thu, 28 Jul 2016 18:25:51 +0000 (11:25 -0700)

Merge branch 'nd/ita-cleanup' into maint

Git does not know what the contents in the index should be for a
path added with "git add -N" yet, so "git grep --cached" should not
show hits (or show lack of hits, with -L) in such a path, but that
logic does not apply to "git grep", i.e. searching in the working
tree files. But we did so by mistake, which has been corrected.

* nd/ita-cleanup:
grep: fix grepping for "intent to add" files
t7810-grep.sh: fix a whitespace inconsistency
t7810-grep.sh: fix duplicated test name

Merge branch 'js/find-commit-subject-ignore-leading... Junio C Hamano Thu, 28 Jul 2016 18:25:50 +0000 (11:25 -0700)

Merge branch 'js/find-commit-subject-ignore-leading-blanks' into maint

A helper function that takes the contents of a commit object and
finds its subject line did not ignore leading blank lines, as is
commonly done by other codepaths. Make it ignore leading blank
lines to match.

* js/find-commit-subject-ignore-leading-blanks:
reset --hard: skip blank lines when reporting the commit subject
sequencer: use skip_blank_lines() to find the commit subject
commit -C: skip blank lines at the beginning of the message
commit.c: make find_commit_subject() more robust
pretty: make the skip_blank_lines() function public

Merge branch 'dg/subtree-rebase-test' into maintJunio C Hamano Thu, 28 Jul 2016 18:25:49 +0000 (11:25 -0700)

Merge branch 'dg/subtree-rebase-test' into maint

Add a test to specify the desired behaviour that currently is not
available in "git rebase -Xsubtree=...".

* dg/subtree-rebase-test:
contrib/subtree: Add a test for subtree rebase that loses commits

Merge branch 'sb/submodule-deinit-all'Junio C Hamano Thu, 28 Jul 2016 17:34:45 +0000 (10:34 -0700)

Merge branch 'sb/submodule-deinit-all'

A comment update for a topic that was merged to Git v2.8.

* sb/submodule-deinit-all:
submodule deinit: remove outdated comment

Merge branch 'ew/find-perl-on-freebsd-in-local'Junio C Hamano Thu, 28 Jul 2016 17:34:44 +0000 (10:34 -0700)

Merge branch 'ew/find-perl-on-freebsd-in-local'

Recent FreeBSD stopped making perl available at /usr/bin/perl;
switch the default the built-in path to /usr/local/bin/perl on not
too ancient FreeBSD releases.

* ew/find-perl-on-freebsd-in-local:
config.mak.uname: correct perl path on FreeBSD

Merge branch 'ew/daemon-socket-keepalive'Junio C Hamano Thu, 28 Jul 2016 17:34:43 +0000 (10:34 -0700)

Merge branch 'ew/daemon-socket-keepalive'

Recent update to "git daemon" tries to enable the socket-level
KEEPALIVE, but when it is spawned via inetd, the standard input
file descriptor may not necessarily be connected to a socket.
Suppress an ENOTSOCK error from setsockopt().

* ew/daemon-socket-keepalive:
Windows: add missing definition of ENOTSOCK
daemon: ignore ENOTSOCK from setsockopt

Merge branch 'nd/pack-ofs-4gb-limit'Junio C Hamano Thu, 28 Jul 2016 17:34:42 +0000 (10:34 -0700)

Merge branch 'nd/pack-ofs-4gb-limit'

"git pack-objects" and "git index-pack" mostly operate with off_t
when talking about the offset of objects in a packfile, but there
were a handful of places that used "unsigned long" to hold that
value, leading to an unintended truncation.

* nd/pack-ofs-4gb-limit:
fsck: use streaming interface for large blobs in pack
pack-objects: do not truncate result in-pack object size on 32-bit systems
index-pack: correct "offset" type in unpack_entry_data()
index-pack: report correct bad object offsets even if they are large
index-pack: correct "len" type in unpack_data()
sha1_file.c: use type off_t* for object_info->disk_sizep
pack-objects: pass length to check_pack_crc() without truncation

Merge branch 'nd/worktree-lock'Junio C Hamano Thu, 28 Jul 2016 17:34:41 +0000 (10:34 -0700)

Merge branch 'nd/worktree-lock'

"git worktree prune" protected worktrees that are marked as
"locked" by creating a file in a known location. "git worktree"
command learned a dedicated command pair to create and remove such
a file, so that the users do not have to do this with editor.

* nd/worktree-lock:
worktree.c: find_worktree() search by path suffix
worktree: add "unlock" command
worktree: add "lock" command
worktree.c: add is_worktree_locked()
worktree.c: add is_main_worktree()
worktree.c: add find_worktree()

Merge branch 'rs/notes-merge-no-toctou'Junio C Hamano Thu, 28 Jul 2016 17:34:41 +0000 (10:34 -0700)

Merge branch 'rs/notes-merge-no-toctou'

"git notes merge" had a code to see if a path exists (and fails if
it does) and then open the path for writing (when it doesn't).
Replace it with open with O_EXCL.

* rs/notes-merge-no-toctou:
notes-merge: use O_EXCL to avoid overwriting existing files

Merge branch 'js/rebase-i-tests'Junio C Hamano Thu, 28 Jul 2016 17:34:40 +0000 (10:34 -0700)

Merge branch 'js/rebase-i-tests'

A few tests that specifically target "git rebase -i" have been
added.

* js/rebase-i-tests:
rebase -i: we allow extra spaces after fixup!/squash!
rebase -i: demonstrate a bug with --autosquash
t3404: add a test for the --gpg-sign option

i18n: config: unfold error messages marked for translationVasco Almeida Thu, 28 Jul 2016 13:14:03 +0000 (13:14 +0000)

i18n: config: unfold error messages marked for translation

Introduced in 473166b ("config: add 'origin_type' to config_source
struct", 2016-02-19), Git can inform the user about the origin of a
config error, but the implementation does not allow translators to
translate the keywords 'file', 'blob, 'standard input', and
'submodule-blob'. Moreover, for the second message, a reason for the
error is appended to the message, not allowing translators to translate
that reason either.

Unfold the message into several templates for each known origin_type.
That would result in better translation at the expense of code
verbosity.

Add enum config_oringin_type to ease management of the various
configuration origin types (blob, file, etc). Previously origin type
was considered from command line if cf->origin_type == NULL, i.e.,
uninitialized. Now we set origin_type to CONFIG_ORIGIN_CMDLINE in
git_config_from_parameters() and configset_add_value().

For error message in git_parse_source(), use xstrfmt() function to
prepare the message string, instead of doing something like it's done
for die_bad_number(), because intelligibility and code conciseness are
improved for that instance.

Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

i18n: notes: mark comment for translationVasco Almeida Thu, 28 Jul 2016 11:26:15 +0000 (11:26 +0000)

i18n: notes: mark comment for translation

Mark comment displayed when editing a note for translation.

Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

subtree: adjust function definitions to match CodingGui... David Aguilar Thu, 28 Jul 2016 00:16:50 +0000 (17:16 -0700)

subtree: adjust function definitions to match CodingGuidelines

We prefer a space between the function name and the parentheses, and no
space inside the parentheses.

The opening "{" should also be on the same line.

Suggested-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

subtree: adjust style to match CodingGuidelinesDavid Aguilar Thu, 28 Jul 2016 00:16:49 +0000 (17:16 -0700)

subtree: adjust style to match CodingGuidelines

Prefer "test" over "[ ... ]", use double-quotes around variables, break
long lines, and properly indent "case" statements.

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

date: clarify --date=raw descriptionJunio C Hamano Wed, 27 Jul 2016 20:07:29 +0000 (13:07 -0700)

date: clarify --date=raw description

"... in the internal raw Git format `%s %z` format." was clunky in
repeating "format" twice, and would not have helped those who do not
immediately get that these are strftime(3) conversion specifiers.

Explain them with words, and demote the mention of `%s %z` to a
hint to help those who know them.

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

date: add "unix" formatJeff King Fri, 22 Jul 2016 19:51:49 +0000 (15:51 -0400)

date: add "unix" format

We already have "--date=raw", which is a Unix epoch
timestamp plus a contextual timezone (either the author's or
the local). But one may not care about the timezone and just
want the epoch timestamp by itself. It's not hard to parse
the two apart, but if you are using a pretty-print format,
you may want git to show the "finished" form that the user
will see.

We can accomodate this by adding a new date format, "unix",
which is basically "raw" without the timezone.

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

date: document and test "raw-local" modeJeff King Wed, 27 Jul 2016 13:44:41 +0000 (09:44 -0400)

date: document and test "raw-local" mode

The "raw" format shows a Unix epoch timestamp, but with a
timezone tacked on. The timestamp is not _in_ that zone, but
it is extra information about the time (by default, the zone
the author was in).

The documentation claims that "raw-local" does not work. It
does, but the end result is rather subtle. Let's describe it
in better detail, and test to make sure it works (namely,
the epoch time doesn't change, but the zone does).

While we are rewording the documentation in this area, let's
not use the phrase "does not work" for the remaining option,
"--date=relative". It's vague; do we accept it or not? We do
accept it, but it has no effect (which is a reasonable
outcome). We should also refer to the option not as
"--relative" (which is the historical synonym, and does not
take "-local" at all), but as "--date=relative".

Helped-by: Jakub Narębski <jnareb@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t4205: indent here documentsJeff King Wed, 27 Jul 2016 18:55:23 +0000 (14:55 -0400)

t4205: indent here documents

Our usual style in the test scripts is to indent here
documents with tabs, and use "<<-" to strip the tabs. The
result is easier to read.

This old test script did not do so in its inception, and
further tests added onto it followed the local style. Let's
bring it in line with our usual style.

Some of the tests actually care quite a bit about
whitespace, but none of them do so at the beginning of the
line (because they use things like qz_to_tab_space to avoid
depending on the literal whitespace), so we can do a fairly
mechanical conversion.

Most of the here-docs also use interpolation, so they have
been left as "<<-EOF". In a few cases, though, where
interpolation was not in use, I've converted them to
"<<-\EOF" to match our usual "don't interpolate unless you
need to" style.

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

t4205: drop top-level &&-chainingJeff King Wed, 27 Jul 2016 18:55:02 +0000 (14:55 -0400)

t4205: drop top-level &&-chaining

The test currently does something like:

do_one() &&
do_two() &&
test_expect_success ...

We generally avoid performing actions at the top-level of
the script (outside of a test_expect block) for two reasons:

1. The test harness is not checking and reporting if they
fail.

2. Their output is not handled correctly (not hidden by
default, nor shown with "-v").

Using &&-chains seems like it should help with (1), but it
doesn't. If either of the commands fails, we simply skip
running the follow-on test entirely, and the test harness
has no idea.

We can fix this by pushing that setup into its own block.
It _could_ go into the following test block, but since the
result in this case is used by multiple tests, it's more
clear to mark it explicitly as a distinct setup step.

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

completion: add option '--recurse-submodules' to 'git... Chris Packham Wed, 27 Jul 2016 08:34:06 +0000 (20:34 +1200)

completion: add option '--recurse-submodules' to 'git clone'

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

subtree: fix "git subtree split --rejoin"David Aguilar Tue, 26 Jul 2016 04:14:15 +0000 (21:14 -0700)

subtree: fix "git subtree split --rejoin"

"git merge" in v2.9 prevents merging unrelated histories.

"git subtree split --rejoin" creates unrelated histories when
creating a split repo from a raw sub-directory that did not
originate from an invocation of "git subtree add".

Restore the original behavior by passing --allow-unrelated-histories
when merging subtrees. This ensures that the synthetic history
created by "git subtree split" can be merged.

Add a test to ensure that this feature works as advertised.

Reported-by: Brett Cundal <brett.cundal@iugome.com>
Helped-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t7900-subtree.sh: fix quoting and broken && chainsDavid Aguilar Tue, 26 Jul 2016 04:14:14 +0000 (21:14 -0700)

t7900-subtree.sh: fix quoting and broken && chains

Allow whitespace in arguments to subtree_test_create_repo.
Add missing && chains.

Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

submodule deinit: remove outdated commentStefan Beller Tue, 26 Jul 2016 00:35:38 +0000 (17:35 -0700)

submodule deinit: remove outdated comment

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

commit: describe that --no-verify skips the commit... Orgad Shaneh Tue, 26 Jul 2016 14:00:15 +0000 (17:00 +0300)

commit: describe that --no-verify skips the commit-msg hook in the help text

This brings the short help in line with the documentation.

Signed-off-by: Orgad Shaneh <orgads@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>