gitweb.git
verify_packfile: check pack validity before accessing... Jeff King Thu, 22 Sep 2016 03:49:05 +0000 (23:49 -0400)

verify_packfile: check pack validity before accessing data

The verify_packfile() does not explicitly open the packfile;
instead, it starts with a sha1 checksum over the whole pack,
and relies on use_pack() to open the packfile as a side
effect.

If the pack cannot be opened for whatever reason (either
because its header information is corrupted, or perhaps
because a simultaneous repack deleted it), then use_pack()
will die(), as it has no way to return an error. This is not
ideal, as verify_packfile() otherwise tries to gently return
an error (this lets programs like git-fsck go on to check
other packs).

Instead, let's check is_pack_valid() up front, and return an
error if it fails. This will open the pack as a side effect,
and then use_pack() will later rely on our cached
descriptor, and avoid calling die().

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

travis-ci: ask homebrew for its path instead of hardcod... Lars Schneider Wed, 21 Sep 2016 08:45:18 +0000 (10:45 +0200)

travis-ci: ask homebrew for its path instead of hardcoding it

The TravisCI macOS build is broken because homebrew (a macOS dependency
manager) changed its internal directory structure [1]. This is a problem
because we modify the Perforce dependencies in the homebrew repository
before installing them.

Fix it by asking homebrew for its path instead of hardcoding it.

[1] https://github.com/Homebrew/brew/commit/0a09ae30f8b6117ad699b4a0439010738989c547

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

t3700-add: do not check working tree file mode without... Johannes Sixt Tue, 20 Sep 2016 06:18:25 +0000 (08:18 +0200)

t3700-add: do not check working tree file mode without POSIXPERM

A recently introduced test checks the result of 'git status' after
setting the executable bit on a file. This check does not yield the
expected result when the filesystem does not support the executable
bit.

What we care about is that a file added with "--chmod=+x" has
executable bit in the index and that "--chmod=+x" (or any other
options for that matter) does not muck with working tree files.
The former is tested by other existing tests, so let's check the
latter more explicitly and only under POSIXPERM prerequisite.

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

regex: use regexec_buf()Johannes Schindelin Wed, 21 Sep 2016 18:24:14 +0000 (20:24 +0200)

regex: use regexec_buf()

The new regexec_buf() function operates on buffers with an explicitly
specified length, rather than NUL-terminated strings.

We need to use this function whenever the buffer we want to pass to
regexec(3) may have been mmap(2)ed (and is hence not NUL-terminated).

Note: the original motivation for this patch was to fix a bug where
`git diff -G <regex>` would crash. This patch converts more callers,
though, some of which allocated to construct NUL-terminated strings,
or worse, modified buffers to temporarily insert NULs while calling
regexec(3). By converting them to use regexec_buf(), the code has
become much cleaner.

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

regex: add regexec_buf() that can work on a non NUL... Johannes Schindelin Wed, 21 Sep 2016 18:24:04 +0000 (20:24 +0200)

regex: add regexec_buf() that can work on a non NUL-terminated string

We just introduced a test that demonstrates that our sloppy use of
regexec() on a mmap()ed area can result in incorrect results or even
hard crashes.

So what we need to fix this is a function that calls regexec() on a
length-delimited, rather than a NUL-terminated, string.

Happily, there is an extension to regexec() introduced by the NetBSD
project and present in all major regex implementation including
Linux', MacOSX' and the one Git includes in compat/regex/: by using
the (non-POSIX) REG_STARTEND flag, it is possible to tell the
regexec() function that it should only look at the offsets between
pmatch[0].rm_so and pmatch[0].rm_eo.

That is exactly what we need.

Since support for REG_STARTEND is so widespread by now, let's just
introduce a helper function that always uses it, and tell people
on a platform whose regex library does not support it to use the
one from our compat/regex/ directory.

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

regex: -G<pattern> feeds a non NUL-terminated string... Johannes Schindelin Wed, 21 Sep 2016 18:23:22 +0000 (20:23 +0200)

regex: -G<pattern> feeds a non NUL-terminated string to regexec() and fails

When our pickaxe code feeds file contents to regexec(), it implicitly
assumes that the file contents are read into implicitly NUL-terminated
buffers (i.e. that we overallocate by 1, appending a single '\0').

This is not so.

In particular when the file contents are simply mmap()ed, we can be
virtually certain that the buffer is preceding uninitialized bytes, or
invalid pages.

Note that the test we add here is known to be flakey: we simply cannot
know whether the byte following the mmap()ed ones is a NUL or not.

Typically, on Linux the test passes. On Windows, it fails virtually
every time due to an access violation (that's a segmentation fault for
you Unix-y people out there). And Windows would be correct: the
regexec() call wants to operate on a regular, NUL-terminated string,
there is no NUL in the mmap()ed memory range, and it is undefined
whether the next byte is even legal to access.

When run with --valgrind it demonstrates quite clearly the breakage, of
course.

Being marked with `test_expect_failure`, this test will sometimes be
declare "TODO fixed", even if it only passes by mistake.

This test case represents a Minimal, Complete and Verifiable Example of
a breakage reported by Chris Sidi.

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

git-check-ref-format.txt: fixup documentationElia Pinto Tue, 20 Sep 2016 07:33:14 +0000 (07:33 +0000)

git-check-ref-format.txt: fixup documentation

die is not a standard shell function. Use
a different shell code for the example.

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t3700-add: create subdirectory gentlyJohannes Sixt Tue, 20 Sep 2016 06:16:11 +0000 (08:16 +0200)

t3700-add: create subdirectory gently

The subdirectory 'sub' is created early in the test file. Later, a test
case removes it during its clean-up actions. However, this test case is
protected by POSIXPERM. Consequently, 'sub' remains when the POSIXPERM
prerequisite is not satisfied. Later, a recently introduced test case
creates 'sub' again. Use -p with mkdir so that it does not fail if 'sub'
already exists.

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

checkout: fix ambiguity check in subdirNguyễn Thái Ngọc Duy Wed, 7 Sep 2016 11:19:41 +0000 (18:19 +0700)

checkout: fix ambiguity check in subdir

The two functions in parse_branchname_arg(), verify_non_filename and
check_filename, need correct prefix in order to reconstruct the paths
and check for their existence. With NULL prefix, they just check paths
at top dir instead.

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

checkout.txt: document a common case that ignores ambig... Nguyễn Thái Ngọc Duy Wed, 7 Sep 2016 11:19:40 +0000 (18:19 +0700)

checkout.txt: document a common case that ignores ambiguation rules

Normally we err on the safe side: if something can be seen as both an
SHA1 and a pathspec, we stop and scream. In checkout, there is one
exception added in 859fdab (git-checkout: improve error messages, detect
ambiguities. - 2008-07-23), to allow the common case "git checkout
branch". Let's document this exception.

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

Start preparing for 2.10.1Junio C Hamano Mon, 19 Sep 2016 20:54:50 +0000 (13:54 -0700)

Start preparing for 2.10.1

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

Merge branch 'sb/diff-cleanup' into maintJunio C Hamano Mon, 19 Sep 2016 20:51:45 +0000 (13:51 -0700)

Merge branch 'sb/diff-cleanup' into maint

Code cleanup.

* sb/diff-cleanup:
diff: remove dead code
diff: omit found pointer from emit_callback
diff.c: use diff_options directly

Merge branch 'ah/misc-message-fixes' into maintJunio C Hamano Mon, 19 Sep 2016 20:51:45 +0000 (13:51 -0700)

Merge branch 'ah/misc-message-fixes' into maint

Message cleanup.

* ah/misc-message-fixes:
unpack-trees: do not capitalize "working"
git-merge-octopus: do not capitalize "octopus"
git-rebase--interactive: fix English grammar
cat-file: put spaces around pipes in usage string
am: put spaces around pipe in usage string

Merge branch 'sb/transport-report-missing-submodule... Junio C Hamano Mon, 19 Sep 2016 20:51:45 +0000 (13:51 -0700)

Merge branch 'sb/transport-report-missing-submodule-on-stderr' into maint

Message cleanup.

* sb/transport-report-missing-submodule-on-stderr:
transport: report missing submodule pushes consistently on stderr

Merge branch 'sb/xdiff-remove-unused-static-decl' into... Junio C Hamano Mon, 19 Sep 2016 20:51:44 +0000 (13:51 -0700)

Merge branch 'sb/xdiff-remove-unused-static-decl' into maint

Code cleanup.

* sb/xdiff-remove-unused-static-decl:
xdiff: remove unneeded declarations

Merge branch 'js/t9903-chaining' into maintJunio C Hamano Mon, 19 Sep 2016 20:51:44 +0000 (13:51 -0700)

Merge branch 'js/t9903-chaining' into maint

Test fix.

* js/t9903-chaining:
t9903: fix broken && chain

Merge branch 'rs/hex2chr' into maintJunio C Hamano Mon, 19 Sep 2016 20:51:43 +0000 (13:51 -0700)

Merge branch 'rs/hex2chr' into maint

Code cleanup.

* rs/hex2chr:
introduce hex2chr() for converting two hexadecimal digits to a character

Merge branch 'rs/compat-strdup' into maintJunio C Hamano Mon, 19 Sep 2016 20:51:42 +0000 (13:51 -0700)

Merge branch 'rs/compat-strdup' into maint

Code cleanup.

* rs/compat-strdup:
compat: move strdup(3) replacement to its own file

Merge branch 'jk/squelch-false-warning-from-gcc-o3... Junio C Hamano Mon, 19 Sep 2016 20:51:41 +0000 (13:51 -0700)

Merge branch 'jk/squelch-false-warning-from-gcc-o3' into maint

Compilation fix.

* jk/squelch-false-warning-from-gcc-o3:
color_parse_mem: initialize "struct color" temporary
error_errno: use constant return similar to error()

Merge branch 'ep/use-git-trace-curl-in-tests' into... Junio C Hamano Mon, 19 Sep 2016 20:51:41 +0000 (13:51 -0700)

Merge branch 'ep/use-git-trace-curl-in-tests' into maint

Update a few tests that used to use GIT_CURL_VERBOSE to use the
newer GIT_TRACE_CURL.

* ep/use-git-trace-curl-in-tests:
t5551-http-fetch-smart.sh: use the GIT_TRACE_CURL environment var
t5550-http-fetch-dumb.sh: use the GIT_TRACE_CURL environment var
test-lib.sh: preserve GIT_TRACE_CURL from the environment
t5541-http-push-smart.sh: use the GIT_TRACE_CURL environment var

Merge branch 'js/t6026-clean-up' into maintJunio C Hamano Mon, 19 Sep 2016 20:51:41 +0000 (13:51 -0700)

Merge branch 'js/t6026-clean-up' into maint

A test spawned a short-lived background process, which sometimes
prevented the test directory from getting removed at the end of the
script on some platforms.

* js/t6026-clean-up:
t6026-merge-attr: clean up background process at end of test case

Merge branch 'jc/forbid-symbolic-ref-d-HEAD' into maintJunio C Hamano Mon, 19 Sep 2016 20:51:40 +0000 (13:51 -0700)

Merge branch 'jc/forbid-symbolic-ref-d-HEAD' into maint

"git symbolic-ref -d HEAD" happily removes the symbolic ref, but
the resulting repository becomes an invalid one. Teach the command
to forbid removal of HEAD.

* jc/forbid-symbolic-ref-d-HEAD:
symbolic-ref -d: do not allow removal of HEAD

Merge branch 'jc/submodule-anchor-git-dir' into maintJunio C Hamano Mon, 19 Sep 2016 20:51:40 +0000 (13:51 -0700)

Merge branch 'jc/submodule-anchor-git-dir' into maint

Having a submodule whose ".git" repository is somehow corrupt
caused a few commands that recurse into submodules loop forever.

* jc/submodule-anchor-git-dir:
submodule: avoid auto-discovery in prepare_submodule_repo_env()

Merge branch 'jk/test-lib-drop-pid-from-results' into... Junio C Hamano Mon, 19 Sep 2016 20:51:39 +0000 (13:51 -0700)

Merge branch 'jk/test-lib-drop-pid-from-results' into maint

The test framework left the number of tests and success/failure
count in the t/test-results directory, keyed by the name of the
test script plus the process ID. The latter however turned out not
to serve any useful purpose. The process ID part of the filename
has been removed.

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

Merge branch 'bh/diff-highlight-graph' into maintJunio C Hamano Mon, 19 Sep 2016 20:51:38 +0000 (13:51 -0700)

Merge branch 'bh/diff-highlight-graph' into maint

"diff-highlight" script (in contrib/) learned to work better with
"git log -p --graph" output.

* bh/diff-highlight-graph:
diff-highlight: avoid highlighting combined diffs
diff-highlight: add multi-byte tests
diff-highlight: ignore test cruft
diff-highlight: add support for --graph output
diff-highlight: add failing test for handling --graph output
diff-highlight: add some tests

Merge branch 'po/range-doc' into maintJunio C Hamano Mon, 19 Sep 2016 20:51:37 +0000 (13:51 -0700)

Merge branch 'po/range-doc' into maint

Clarify various ways to specify the "revision ranges" in the
documentation.

* po/range-doc:
doc: revisions: sort examples and fix alignment of the unchanged
doc: revisions: show revision expansion in examples
doc: revisions - clarify reachability examples
doc: revisions - define `reachable`
doc: gitrevisions - clarify 'latter case' is revision walk
doc: gitrevisions - use 'reachable' in page description
doc: revisions: single vs multi-parent notation comparison
doc: revisions: extra clarification of <rev>^! notation effects
doc: revisions: give headings for the two and three dot notations
doc: show the actual left, right, and boundary marks
doc: revisions - name the left and right sides
doc: use 'symmetric difference' consistently

pretty: let %C(auto) reset all attributesRené Scharfe Sat, 17 Sep 2016 18:25:24 +0000 (20:25 +0200)

pretty: let %C(auto) reset all attributes

Reset colors and attributes upon %C(auto) to enable full automatic
control over them; otherwise attributes like bold or reverse could
still be in effect from previous %C placeholders.

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

Documentation/config: default for color.* is color.uiMatthieu Moy Fri, 16 Sep 2016 07:32:48 +0000 (09:32 +0200)

Documentation/config: default for color.* is color.ui

Since 4c7f181 (make color.ui default to 'auto', 2013-06-10), the
default for color.* when nothing is set is 'auto' and we still claimed
that the default was 'false'. Be more precise by saying explicitly
that the default is to follow color.ui, and recall that the default is
'auto' to avoid one indirection for the reader.

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

t/perf/run: copy config.mak.autogen & friends to build... Kirill Smelkov Tue, 13 Sep 2016 06:58:00 +0000 (09:58 +0300)

t/perf/run: copy config.mak.autogen & friends to build area

Otherwise for people who use autotools-based configure in main worktree,
the performance testing results will be inconsistent as work and build
trees could be using e.g. different optimization levels.

See e.g.

http://public-inbox.org/git/20160818175222.bmm3ivjheokf2qzl@sigill.intra.peff.net/

for example.

NOTE config.status has to be copied because otherwise without it the build
would want to run reconfigure this way loosing just copied config.mak.autogen.

Signed-off-by: Kirill Smelkov <kirr@nexedi.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

add: modify already added files when --chmod is givenThomas Gummerer Wed, 14 Sep 2016 21:07:47 +0000 (22:07 +0100)

add: modify already added files when --chmod is given

When the chmod option was added to git add, it was hooked up to the diff
machinery, meaning that it only works when the version in the index
differs from the version on disk.

As the option was supposed to mirror the chmod option in update-index,
which always changes the mode in the index, regardless of the status of
the file, make sure the option behaves the same way in git add.

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

read-cache: introduce chmod_index_entryThomas Gummerer Wed, 14 Sep 2016 21:07:46 +0000 (22:07 +0100)

read-cache: introduce chmod_index_entry

As there are chmod options for both add and update-index, introduce a
new chmod_index_entry function to do the work. Use it in update-index,
while it will be used in add in the next patch.

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

format-patch: show base info before email signatureJosh Triplett Thu, 8 Sep 2016 01:12:01 +0000 (18:12 -0700)

format-patch: show base info before email signature

Any text below the "-- " for the email signature gets treated as part of
the signature, and many mail clients will trim it from the quoted text
for a reply. Move it above the signature, so people can reply to it
more easily.

Similarly, when producing the patch as a MIME attachment, the
original code placed the base info after the attached part, which
would be discarded. Move the base info to the end of the part,
still inside the part boundary.

Add tests for the exact format of the email signature, and add tests
to ensure that the base info appears before the email signature when
producing a plain-text output, and that it appears before the part
boundary when producing a MIME attachment.

Signed-off-by: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

xdiff: fix merging of hunks with -W context and -u... René Scharfe Wed, 14 Sep 2016 16:05:27 +0000 (18:05 +0200)

xdiff: fix merging of hunks with -W context and -u context

If the function context for a hunk (with -W) reaches the beginning of
the next hunk then we need to merge these two -- otherwise we'd show
some lines twice, which looks strange and even confuses git apply. We
already do this checking and merging in xdl_emit_diff(), but forget to
consider regular context (with -u or -U).

Fix that by merging hunks already if function context of the first one
touches or overlaps regular context of the second one.

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

update-index: add test for chmod flagsThomas Gummerer Wed, 14 Sep 2016 21:07:45 +0000 (22:07 +0100)

update-index: add test for chmod flags

Currently there is no test checking the expected behaviour when multiple
chmod flags with different arguments are passed. As argument handling
is not in line with other git commands it's easy to miss and
accidentally change the current behaviour.

While there, fix the argument type of chmod_path, which takes an int,
but had a char passed in.

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

Merge branch 'ib/t3700-add-chmod-x-updates' into tg... Junio C Hamano Wed, 14 Sep 2016 22:02:25 +0000 (15:02 -0700)

Merge branch 'ib/t3700-add-chmod-x-updates' into tg/add-chmod+x-fix

Newly added tests to this topic uses helper functions that did not
exist back when the bug being fixed by the topic was introduced.

* 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

vcs-svn/fast_export: fix timestamp fmt specifiersMike Ralphson Wed, 14 Sep 2016 06:40:57 +0000 (06:40 +0000)

vcs-svn/fast_export: fix timestamp fmt specifiers

Two instances of %ld being used for unsigned longs

Signed-off-by: Mike Ralphson <mike.ralphson@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

unpack-trees: pass checkout state explicitly to check_u... René Scharfe Tue, 13 Sep 2016 17:37:06 +0000 (19:37 +0200)

unpack-trees: pass checkout state explicitly to check_updates()

Add a parameter for the struct checkout variable to check_updates()
instead of using a static global variable. Passing it explicitly makes
object ownership and usage more easily apparent. And we get rid of a
static variable; those can be problematic in library-like code.

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

checkout: constify parameters of checkout_stage() and... René Scharfe Tue, 13 Sep 2016 17:11:52 +0000 (19:11 +0200)

checkout: constify parameters of checkout_stage() and checkout_merged()

Document the fact that checkout_stage() and checkout_merged() don't
change the objects passed to them by adding the modifier const.

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

pathspec: remove unnecessary function prototypesBrandon Williams Tue, 13 Sep 2016 16:52:51 +0000 (09:52 -0700)

pathspec: remove unnecessary function prototypes

A few functions were removed in 5a76aff1 ("add: convert to use
parse_pathspec", 2013-07-14), but we forgot to remove their external
declarations from pathspec.h while doing so.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

strbuf: use valid pointer in strbuf_remove()René Scharfe Tue, 13 Sep 2016 16:40:22 +0000 (18:40 +0200)

strbuf: use valid pointer in strbuf_remove()

The fourth argument of strbuf_splice() is passed to memcpy(3), which is
not supposed to handle NULL pointers. Let's be extra careful and use a
valid empty string instead. It even shortens the source code. :)

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

http: always remove curl easy from curlm session on... Eric Wong Tue, 13 Sep 2016 00:25:57 +0000 (00:25 +0000)

http: always remove curl easy from curlm session on release

We must call curl_multi_remove_handle when releasing the slot to
prevent subsequent calls to curl_multi_add_handle from failing
with CURLM_ADDED_ALREADY (in curl 7.32.1+; older versions
returned CURLM_BAD_EASY_HANDLE)

Signed-off-by: Eric Wong <e@80x24.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

http: consolidate #ifdefs for curl_multi_remove_handleEric Wong Tue, 13 Sep 2016 00:25:56 +0000 (00:25 +0000)

http: consolidate #ifdefs for curl_multi_remove_handle

I find #ifdefs makes code difficult-to-follow.

An early version of this patch had error checking for
curl_multi_remove_handle calls, but caused some tests (e.g.
t5541) to fail under curl 7.26.0 on old Debian wheezy.

Signed-off-by: Eric Wong <e@80x24.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

http: warn on curl_multi_add_handle failuresEric Wong Tue, 13 Sep 2016 00:25:55 +0000 (00:25 +0000)

http: warn on curl_multi_add_handle failures

This will be useful for tracking down curl usage errors.

Signed-off-by: Eric Wong <e@80x24.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge tag 'l10n-2.10.0-rnd2.3' of git://github.com... Junio C Hamano Mon, 12 Sep 2016 22:23:42 +0000 (15:23 -0700)

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

l10n-2.10.0-rnd2.3

* tag 'l10n-2.10.0-rnd2.3' of git://github.com/git-l10n/git-po:
l10n: zh_CN: review for git v2.10.0 l10n
l10n: zh_CN: fixed some typos for git 2.10.0
l10n: pt_PT: update Portuguese repository info
l10n: pt_PT: update Portuguese translation

add: document the chmod optionThomas Gummerer Mon, 12 Sep 2016 21:08:15 +0000 (22:08 +0100)

add: document the chmod option

The git add --chmod option was introduced in 4e55ed3 ("add: add
--chmod=+x / --chmod=-x options", 2016-05-31), but was never
documented. Document the feature.

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

patch-ids: refuse to compute patch-id for merge commitJeff King Mon, 12 Sep 2016 17:56:41 +0000 (13:56 -0400)

patch-ids: refuse to compute patch-id for merge commit

The patch-id code which powers "log --cherry-pick" doesn't
look at whether each commit is a merge or not. It just feeds
the commit's first parent to the diff, and ignores any
additional parents.

In theory, this might be useful if you wanted to find
equivalence between, say, a merge commit and a squash-merge
that does the same thing. But it also promotes a false
equivalence between distinct merges. For example, every
"merge -s ours" would look identical to an empty commit
(which is true in a sense, but presumably there was a value
in merging in the discarded history). Since patch-ids are
meant for throwing away duplicates, we should err on the
side of _not_ matching such merges.

Moreover, we may spend a lot of extra time computing these
merge diffs. In the case that inspired this patch, a "git
format-patch --cherry-pick" dropped from over 3 minutes to
less than 3 seconds.

This seems pretty drastic, but is easily explained. The
command was invoked by a "git rebase" of an older topic
branch; there had been tens of thousands of commits on the
upstream branch in the meantime. In addition, this project
used a topic-branch workflow with occasional "back-merges"
from "master" to each topic (to resolve conflicts on the
topics rather than in the merge commits). So there were not
only extra merges, but the diffs for these back-merges were
generally quite large (because they represented _everything_
that had been merged to master since the topic branched).

This patch treats a merge fed to commit_patch_id() or
add_commit_patch_id() as an error, and a lookup for such a
merge via has_commit_patch_id() will always return NULL.
An earlier version of the patch tried to distinguish between
"error" and "patch id for merges not defined", but that
becomes unnecessarily complicated. The only callers are:

1. revision traversals which want to do --cherry-pick;
they call add_commit_patch_id(), but do not care if it
fails. They only want to add what we can, look it up
later with has_commit_patch_id(), and err on the side
of not-matching.

2. format-patch --base, which calls commit_patch_id().
This _does_ notice errors, but should never feed a
merge in the first place (and if it were to do so
accidentally, then this patch is a strict improvement;
we notice the bug rather than generating a bogus
patch-id).

So in both cases, this does the right thing.

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

l10n: de.po: fix translation of autostashRalf Thielow Fri, 24 Jun 2016 18:03:22 +0000 (20:03 +0200)

l10n: de.po: fix translation of autostash

Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
Acked-by: Matthias Rüster <matthias.ruester@gmail.com>

Merge branch 'js/commit-gpgsign' of ../git-gui into... Junio C Hamano Sun, 11 Sep 2016 21:53:26 +0000 (14:53 -0700)

Merge branch 'js/commit-gpgsign' of ../git-gui into js/git-gui-commit-gpgsign

* 'js/commit-gpgsign' of ../git-gui:
git-gui: respect commit.gpgsign again

git-gui: respect commit.gpgsign againJohannes Schindelin Fri, 9 Sep 2016 12:28:24 +0000 (14:28 +0200)

git-gui: respect commit.gpgsign again

As of v2.9.0, `git commit-tree` no longer heeds the `commit.gpgsign`
config setting. This broke committing with GPG signature in Git GUI.

This fixes https://github.com/git-for-windows/git/issues/850

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

l10n: zh_CN: review for git v2.10.0 l10nRay Chen Wed, 7 Sep 2016 10:03:04 +0000 (18:03 +0800)

l10n: zh_CN: review for git v2.10.0 l10n

Signed-off-by: Ray Chen <oldsharp@gmail.com>

l10n: zh_CN: fixed some typos for git 2.10.0Jiang Xin Mon, 5 Sep 2016 15:26:21 +0000 (23:26 +0800)

l10n: zh_CN: fixed some typos for git 2.10.0

Reviewed-by: Ray <tvvocold@163.com>
Signed-off-by: Jiang Xin <worldhello.net@gmail.com>

patch-ids: turn off rename detectionJeff King Fri, 9 Sep 2016 20:34:34 +0000 (16:34 -0400)

patch-ids: turn off rename detection

The patch-id code may be running inside another porcelain
like "git log" or "git format-patch", and therefore may have
set diff_detect_rename_default, either via the diff-ui
config, or by default since 5404c11 (diff: activate
diff.renames by default, 2016-02-25). This is the case even
if a command is run with `--no-renames`, as that is applied
only to the diff-options used by the command itself.

Rename detection doesn't help the patch-id results. It
_may_ actually hurt, as minor differences in the files that
would be overlooked by patch-id's canonicalization might
result in different renames (though I'd doubt that it ever
comes up in practice).

But mostly it is just a waste of CPU to compute these
renames.

Note that this does have one user-visible impact: the
prerequisite patches listed by "format-patch --base". There
may be some confusion between different versions of git as
older ones will enable renames, but newer ones will not.
However, this was already a problem, as people with
different settings for the "diff.renames" config would get
different results. After this patch, everyone should get the
same results, regardless of their config.

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

Start maintenance track for 2.10.x seriesJunio C Hamano Fri, 9 Sep 2016 04:39:38 +0000 (21:39 -0700)

Start maintenance track for 2.10.x series

Prepare for 2.9.4Junio C Hamano Fri, 9 Sep 2016 04:37:59 +0000 (21:37 -0700)

Prepare for 2.9.4

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

Merge branch 'hv/doc-commit-reference-style' into maintJunio C Hamano Fri, 9 Sep 2016 04:36:03 +0000 (21:36 -0700)

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

A small doc update.

* hv/doc-commit-reference-style:
SubmittingPatches: use gitk's "Copy commit summary" format
SubmittingPatches: document how to reference previous commits

Merge branch 'sg/reflog-past-root' into maintJunio C Hamano Fri, 9 Sep 2016 04:36:02 +0000 (21:36 -0700)

Merge branch 'sg/reflog-past-root' into maint

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' into maintJunio C Hamano Fri, 9 Sep 2016 04:36:01 +0000 (21:36 -0700)

Merge branch 'rs/mailinfo-lib' into maint

Small code clean-up.

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

Merge branch 'jk/tighten-alloc' into maintJunio C Hamano Fri, 9 Sep 2016 04:36:00 +0000 (21:36 -0700)

Merge branch 'jk/tighten-alloc' into maint

Small code and comment clean-up.

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

Merge branch 'rs/use-strbuf-add-unique-abbrev' into... Junio C Hamano Fri, 9 Sep 2016 04:35:59 +0000 (21:35 -0700)

Merge branch 'rs/use-strbuf-add-unique-abbrev' into maint

A small code clean-up.

* rs/use-strbuf-add-unique-abbrev:
use strbuf_add_unique_abbrev() for adding short hashes

Merge branch 'rs/merge-recursive-string-list-init'... Junio C Hamano Fri, 9 Sep 2016 04:35:59 +0000 (21:35 -0700)

Merge branch 'rs/merge-recursive-string-list-init' into maint

A small code clean-up.

* rs/merge-recursive-string-list-init:
merge-recursive: use STRING_LIST_INIT_NODUP

Merge branch 'rs/merge-add-strategies-simplification... Junio C Hamano Fri, 9 Sep 2016 04:35:58 +0000 (21:35 -0700)

Merge branch 'rs/merge-add-strategies-simplification' into maint

A small code clean-up.

* rs/merge-add-strategies-simplification:
merge: use string_list_split() in add_strategies()

Merge branch 'ls/packet-line-protocol-doc-fix' into... Junio C Hamano Fri, 9 Sep 2016 04:35:57 +0000 (21:35 -0700)

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

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 'bw/mingw-avoid-inheriting-fd-to-lockfile... Junio C Hamano Fri, 9 Sep 2016 04:35:56 +0000 (21:35 -0700)

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

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 Fri, 9 Sep 2016 04:35:56 +0000 (21:35 -0700)

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

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' into maintJunio C Hamano Fri, 9 Sep 2016 04:35:55 +0000 (21:35 -0700)

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

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 'jk/difftool-command-not-found' into maintJunio C Hamano Fri, 9 Sep 2016 04:35:54 +0000 (21:35 -0700)

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

"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, 9 Sep 2016 04:35:54 +0000 (21:35 -0700)

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

"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 'rs/pull-signed-tag' into maintJunio C Hamano Fri, 9 Sep 2016 04:35:54 +0000 (21:35 -0700)

Merge branch 'rs/pull-signed-tag' into maint

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()

Merge branch 'js/test-lint-pathname' into maintJunio C Hamano Fri, 9 Sep 2016 04:35:54 +0000 (21:35 -0700)

Merge branch 'js/test-lint-pathname' into maint

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 'js/mv-dir-to-new-directory' into maintJunio C Hamano Fri, 9 Sep 2016 04:35:54 +0000 (21:35 -0700)

Merge branch 'js/mv-dir-to-new-directory' into maint

"git mv dir non-existing-dir/" did not work in some environments
the same way as existing mainstream platforms. The code now moves
"dir" to "non-existing-dir", without relying on rename("A", "B/")
that strips the trailing slash of '/'.

* js/mv-dir-to-new-directory:
git mv: do not keep slash in `git mv dir non-existing-dir/`

Merge branch 'js/import-tars-hardlinks' into maintJunio C Hamano Fri, 9 Sep 2016 04:35:54 +0000 (21:35 -0700)

Merge branch 'js/import-tars-hardlinks' into maint

"import-tars" fast-import script (in contrib/) used to ignore a
hardlink target and replaced it with an empty file, which has been
corrected to record the same blob as the other file the hardlink is
shared with.

* js/import-tars-hardlinks:
import-tars: support hard links

Merge branch 'ms/document-pack-window-memory-is-per... Junio C Hamano Fri, 9 Sep 2016 04:35:53 +0000 (21:35 -0700)

Merge branch 'ms/document-pack-window-memory-is-per-thread' into maint

* ms/document-pack-window-memory-is-per-thread:
document git-repack interaction of pack.threads and pack.windowMemory

Merge branch 'jk/push-force-with-lease-creation' into... Junio C Hamano Fri, 9 Sep 2016 04:35:53 +0000 (21:35 -0700)

Merge branch 'jk/push-force-with-lease-creation' into maint

"git push --force-with-lease" already had enough logic to allow
ensuring that such a push results in creation of a ref (i.e. the
receiving end did not have another push from sideways that would be
discarded by our force-pushing), but didn't expose this possibility
to the users. It does so now.

* jk/push-force-with-lease-creation:
t5533: make it pass on case-sensitive filesystems
push: allow pushing new branches with --force-with-lease
push: add shorthand for --force-with-lease branch creation
Documentation/git-push: fix placeholder formatting

Merge branch 'jk/reflog-date' into maintJunio C Hamano Fri, 9 Sep 2016 04:35:52 +0000 (21:35 -0700)

Merge branch 'jk/reflog-date' into maint

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 'jc/renormalize-merge-kill-safer-crlf... Junio C Hamano Fri, 9 Sep 2016 04:35:51 +0000 (21:35 -0700)

Merge branch 'jc/renormalize-merge-kill-safer-crlf' into maint

"git merge" with renormalization did not work well with
merge-recursive, due to "safer crlf" conversion kicking in when it
shouldn't.

* jc/renormalize-merge-kill-safer-crlf:
merge: avoid "safer crlf" during recording of merge results
convert: unify the "auto" handling of CRLF

Merge branch 'jk/common-main' into maintJunio C Hamano Fri, 9 Sep 2016 04:35:50 +0000 (21:35 -0700)

Merge branch 'jk/common-main' into maint

There are certain house-keeping tasks that need to be performed at
the very beginning of any Git program, and programs that are not
built-in commands had to do them exactly the same way as "git"
potty does. It was easy to make mistakes in one-off standalone
programs (like test helpers). A common "main()" function that
calls cmd_main() of individual program has been introduced to
make it harder to make mistakes.

* jk/common-main:
mingw: declare main()'s argv as const
common-main: call git_setup_gettext()
common-main: call restore_sigpipe_to_default()
common-main: call sanitize_stdfds()
common-main: call git_extract_argv0_path()
add an extra level of indirection to main()

diff: remove dead codeStefan Beller Wed, 7 Sep 2016 23:36:48 +0000 (16:36 -0700)

diff: remove dead code

When `len < 1`, len has to be 0 or negative, emit_line will then remove the
first character and by then `len` would be negative. As this doesn't
happen, it is safe to assume it is dead code.

This continues to simplify the code, which was started in b8d9c1a66b
(2009-09-03, diff.c: the builtin_diff() deals with only two-file
comparison).

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

diff: omit found pointer from emit_callbackStefan Beller Wed, 7 Sep 2016 23:36:46 +0000 (16:36 -0700)

diff: omit found pointer from emit_callback

We keep the actual data in the diff options, which are just as accessible.
Remove the pointer stored in struct emit_callback for readability.

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

diff.c: use diff_options directlyStefan Beller Wed, 7 Sep 2016 23:36:44 +0000 (16:36 -0700)

diff.c: use diff_options directly

The value of `ecbdata->opt` is accessible via the short variable `o`
already, so let's use that instead.

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

transport: report missing submodule pushes consistently... Stefan Beller Tue, 23 Aug 2016 21:40:08 +0000 (14:40 -0700)

transport: report missing submodule pushes consistently on stderr

The surrounding advice is printed to stderr, but the list of submodules
is not. Make the report consistent by reporting everything to stderr.

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

checkout: add some spaces between code and commentNguyễn Thái Ngọc Duy Wed, 7 Sep 2016 11:19:39 +0000 (18:19 +0700)

checkout: add some spaces between code and comment

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

unpack-trees: do not capitalize "working"Alex Henrie Thu, 8 Sep 2016 04:34:53 +0000 (22:34 -0600)

unpack-trees: do not capitalize "working"

In English, only proper nouns are capitalized.

Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-merge-octopus: do not capitalize "octopus"Alex Henrie Thu, 8 Sep 2016 04:34:40 +0000 (22:34 -0600)

git-merge-octopus: do not capitalize "octopus"

In English, only proper nouns are capitalized.

Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-rebase--interactive: fix English grammarAlex Henrie Thu, 8 Sep 2016 04:34:17 +0000 (22:34 -0600)

git-rebase--interactive: fix English grammar

Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

cat-file: put spaces around pipes in usage stringAlex Henrie Thu, 8 Sep 2016 04:34:00 +0000 (22:34 -0600)

cat-file: put spaces around pipes in usage string

This makes the style a little more consistent with other usage strings,
and will resolve a warning at
https://www.softcatala.org/recursos/quality/git.html

Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

am: put spaces around pipe in usage stringAlex Henrie Thu, 8 Sep 2016 04:33:08 +0000 (22:33 -0600)

am: put spaces around pipe in usage string

This makes the style a little more consistent with other usage strings,
and will resolve a warning at
https://www.softcatala.org/recursos/quality/git.html

Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

remote-curl: handle URLs without protocolJeff King Wed, 7 Sep 2016 20:06:42 +0000 (16:06 -0400)

remote-curl: handle URLs without protocol

Generally remote-curl would never see a URL that did not
have "proto:" at the beginning, as that is what tells git to
run the "git-remote-proto" helper (and git-remote-http, etc,
are aliases for git-remote-curl).

However, the special syntax "proto::something" will run
git-remote-proto with only "something" as the URL. So a
malformed URL like:

http::/example.com/repo.git

will feed the URL "/example.com/repo.git" to
git-remote-http. The resulting URL has no protocol, but the
code added by 372370f (http: use credential API to handle
proxy authentication, 2016-01-26) does not handle this case
and segfaults.

For the purposes of this code, we don't really care what the
exact protocol; only whether or not it is https. So let's
just assume that a missing protocol is not, and curl will
handle the real error (which is that the URL is nonsense).

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

rebase -i: improve advice on bad instruction linesRalf Thielow Tue, 6 Sep 2016 18:59:18 +0000 (20:59 +0200)

rebase -i: improve advice on bad instruction lines

If we found bad instruction lines in the instruction sheet
of interactive rebase, we give the user advice on how to
fix it. However, we don't tell the user what to do afterwards.
Give the user advice to run 'git rebase --continue' after
the fix.

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

pack-objects: walk tag chains for --include-tagJeff King Mon, 5 Sep 2016 21:52:26 +0000 (17:52 -0400)

pack-objects: walk tag chains for --include-tag

When pack-objects is given --include-tag, it peels each tag
ref down to a non-tag object, and if that non-tag object is
going to be packed, we include the tag, too. But what
happens if we have a chain of tags (e.g., tag "A" points to
tag "B", which points to commit "C")?

We'll peel down to "C" and realize that we want to include
tag "A", but we do not ever consider tag "B", leading to a
broken pack (assuming "B" was not otherwise selected).
Instead, we have to walk the whole chain, adding any tags we
find to the pack.

Interestingly, it doesn't seem possible to trigger this
problem with "git fetch", but you can with "git clone
--single-branch". The reason is that we generate the correct
pack when the client explicitly asks for "A" (because we do
a real reachability analysis there), and "fetch" is more
willing to do so. There are basically two cases:

1. If "C" is already a ref tip, then the client can deduce
that it needs "A" itself (via find_non_local_tags), and
will ask for it explicitly rather than relying on the
include-tag capability. Everything works.

2. If "C" is not already a ref tip, then we hope for
include-tag to send us the correct tag. But it doesn't;
it generates a broken pack. However, the next step is
to do a follow-up run of find_non_local_tags(),
followed by fetch_refs() to backfill any tags we
learned about.

In the normal case, fetch_refs() calls quickfetch(),
which does a connectivity check and sees we have no
new objects to fetch. We just write the refs.

But for the broken-pack case, the connectivity check
fails, and quickfetch will follow-up with the remote,
asking explicitly for each of the ref tips. This picks
up the missing object in a new pack.

For a regular "git clone", we are similarly OK, because we
explicitly request all of the tag refs, and get a correct
pack. But with "--single-branch", we kick in tag
auto-following via "include-tag", but do _not_ do a
follow-up backfill. We just take whatever the server sent us
via include-tag and write out tag refs for any tag objects
we were sent. So prior to c6807a4 (clone: open a shortcut
for connectivity check, 2013-05-26), we actually claimed the
clone was a success, but the result was silently
corrupted! Since c6807a4, index-pack's connectivity
check catches this case, and we correctly complain.

The included test directly checks that pack-objects does not
generate a broken pack, but also confirms that "clone
--single-branch" does not hit the bug.

Note that tag chains introduce another interesting question:
if we are packing the tag "B" but not the commit "C", should
"A" be included?

Both before and after this patch, we do not include "A",
because the initial peel_ref() check only knows about the
bottom-most level, "C". To realize that "B" is involved at
all, we would have to switch to an incremental peel, in
which we examine each tagged object, asking if it is being
packed (and including the outer tag if so).

But that runs contrary to the optimizations in peel_ref(),
which avoid accessing the objects at all, in favor of using
the value we pull from packed-refs. It's OK to walk the
whole chain once we know we're going to include the tag (we
have to access it anyway, so the effort is proportional to
the pack we're generating). But for the initial selection,
we have to look at every ref. If we're only packing a few
objects, we'd still have to parse every single referenced
tag object just to confirm that it isn't part of a tag
chain.

This could be addressed if packed-refs stored the complete
tag chain for each peeled ref (in most cases, this would be
the same cost as now, as each "chain" is only a single
link). But given the size of that project, it's out of scope
for this fix (and probably nobody cares enough anyway, as
it's such an obscure situation). This commit limits itself
to just avoiding the creation of a broken pack.

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

t5305: simplify packname handlingJeff King Mon, 5 Sep 2016 21:52:22 +0000 (17:52 -0400)

t5305: simplify packname handling

We generate a series of packfiles test-1-$pack,
test-2-$pack, with different properties and then examine
them. However we always store the packname generated by
pack-objects in the variable packname_1. This probably was
meant to be packname_2 in the second test, but it turns out
that it doesn't matter: once we are done with the first
pack, we can just keep using the same $packname variable.

So let's drop the confusing "_1" parameter. At the same
time, let's give test-1 and test-2 more descriptive names,
which can help keep them straight (note that we _could_
likewise overwrite the packfiles in each test, but by using
separate filenames, we are sure that test 2 does not
accidentally use the packfile from test 1).

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

t5305: use "git -C"Jeff King Mon, 5 Sep 2016 21:52:17 +0000 (17:52 -0400)

t5305: use "git -C"

This test unpacks objects into a separate repository, and
accesses it by setting GIT_DIR in a subshell. We can do the
same thing these days by using "git init <repo>" and "git
-C". In most cases this is shorter, though when there are
multiple commands, we may end up repeating the "-C".

However, this repetition can actually be a good thing. This
patch also fixes a bug introduced by 512477b (tests: use
"env" to run commands with temporary env-var settings,
2014-03-18). That commit essentially converted:

(GIT_DIR=...; export GIT_DIR
cmd1 &&
cmd2)

into:

(GIT_DIR=... cmd1 &&
cmd2)

which obviously loses the GIT_DIR setting for cmd2 (we never
noticed the bug because it simply runs "cmd2" in the parent
repo, which means we were simply failing to test anything
interesting). By using "git -C" rather than a subshell, it
becomes quite obvious where each command is supposed to be
running.

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

t5305: drop "dry-run" of unpack-objectsJeff King Mon, 5 Sep 2016 21:52:14 +0000 (17:52 -0400)

t5305: drop "dry-run" of unpack-objects

For each test we do a dry-run of unpack-objects, followed by
a real run, followed by confirming that it contained the
objects we expected. The dry-run is telling us nothing, as
any errors it encounters would be found in the real run.

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

t5305: move cleanup into test blockJeff King Mon, 5 Sep 2016 21:52:10 +0000 (17:52 -0400)

t5305: move cleanup into test block

We usually try to avoid doing any significant actions
outside of test blocks. Although "rm -rf" is unlikely to
either fail or to generate output, moving these to the
point of use makes it more clear that they are part of the
overall setup of "clone.git".

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

t5551-http-fetch-smart.sh: use the GIT_TRACE_CURL envir... Elia Pinto Mon, 5 Sep 2016 10:24:44 +0000 (10:24 +0000)

t5551-http-fetch-smart.sh: use the GIT_TRACE_CURL environment var

Use the new GIT_TRACE_CURL environment variable instead
of the deprecated GIT_CURL_VERBOSE.

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t5550-http-fetch-dumb.sh: use the GIT_TRACE_CURL enviro... Elia Pinto Mon, 5 Sep 2016 19:19:40 +0000 (19:19 +0000)

t5550-http-fetch-dumb.sh: use the GIT_TRACE_CURL environment var

Use the new GIT_TRACE_CURL environment variable instead
of the deprecated GIT_CURL_VERBOSE.

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

test-lib.sh: preserve GIT_TRACE_CURL from the environmentElia Pinto Mon, 5 Sep 2016 10:24:42 +0000 (10:24 +0000)

test-lib.sh: preserve GIT_TRACE_CURL from the environment

Turning on this variable can be useful when debugging http
tests. It can break a few tests in t5541 if not set
to an absolute path but it is not a variable
that the user is likely to have enabled accidentally.

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t5541-http-push-smart.sh: use the GIT_TRACE_CURL enviro... Elia Pinto Mon, 5 Sep 2016 10:24:41 +0000 (10:24 +0000)

t5541-http-push-smart.sh: use the GIT_TRACE_CURL environment var

Use the new GIT_TRACE_CURL environment variable instead
of the deprecated GIT_CURL_VERBOSE.

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t6026-merge-attr: clean up background process at end... Johannes Sixt Wed, 7 Sep 2016 06:10:41 +0000 (08:10 +0200)

t6026-merge-attr: clean up background process at end of test case

The process spawned in the hook uses the test's trash directory as CWD.
As long as it is alive, the directory cannot be removed on Windows.
Although the test succeeds, the 'test_done' that follows produces an
error message and leaves the trash directory around. Kill the process
before the test case advances.

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>

t9903: fix broken && chainJohannes Sixt Mon, 5 Sep 2016 19:00:47 +0000 (21:00 +0200)

t9903: fix broken && chain

We might wonder why our && chain check does not catch this case:
The && chain check uses a strange exit code with the expectation that
the second or later part of a broken && chain would not exit with this
particular code.

This expectation does not work in this case because __git_ps1, being
the first command in the second part of the broken && chain, records
the current exit code, does its work, and finally returns to the caller
with the recorded exit code. This fools our && chain check.

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

introduce hex2chr() for converting two hexadecimal... René Scharfe Sat, 3 Sep 2016 15:59:20 +0000 (17:59 +0200)

introduce hex2chr() for converting two hexadecimal digits to a character

Add and use a helper function that decodes the char value of two
hexadecimal digits. It returns a negative number on error, avoids
running over the end of the given string and doesn't shift negative
values.

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