gitweb.git
diff: add --compact-summaryNguyễn Thái Ngọc Duy Sat, 24 Feb 2018 14:09:59 +0000 (21:09 +0700)

diff: add --compact-summary

Certain information is currently shown with --summary, but when used
in combination with --stat it's a bit hard to read since info of the
same file is in two places (--stat and --summary).

On top of that, commits that add or remove files double the number of
display lines, which could be a lot if you add or remove a lot of
files.

--compact-summary embeds most of --summary back in --stat in the
little space between the file name part and the graph line, e.g. with
commit 0433d533f1:

Documentation/merge-config.txt | 4 +
builtin/merge.c | 2 +
...-pull-verify-signatures.sh (new +x) | 81 ++++++++++++++
t/t7612-merge-verify-signatures.sh | 45 ++++++++
4 files changed, 132 insertions(+)

It helps both condensing information and saving some text
space. What's new in diffstat is:

- A new 0644 file is shown as (new)
- A new 0755 file is shown as (new +x)
- A new symlink is shown as (new +l)
- A deleted file is shown as (gone)
- A mode change adding executable bit is shown as (mode +x)
- A mode change removing it is shown as (mode -x)

Note that --compact-summary does not contain all the information
--summary provides. Rewrite percentage is not shown but it could be
added later, like R50% or C20%.

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

revision.c: reduce object database queriesDerrick Stolee Sun, 25 Feb 2018 01:34:56 +0000 (20:34 -0500)

revision.c: reduce object database queries

In mark_parents_uninteresting(), we check for the existence of an
object file to see if we should treat a commit as parsed. The result
is to set the "parsed" bit on the commit.

Modify the condition to only check has_object_file() if the result
would change the parsed bit.

When a local branch is different from its upstream ref, "git status"
will compute ahead/behind counts. This uses paint_down_to_common()
and hits mark_parents_uninteresting(). On a copy of the Linux repo
with a local instance of "master" behind the remote branch
"origin/master" by ~60,000 commits, we find the performance of
"git status" went from 1.42 seconds to 1.32 seconds, for a relative
difference of -7.0%.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

perf: use GIT_PERF_REPEAT_COUNT=3 by default even witho... René Scharfe Sun, 25 Feb 2018 13:18:05 +0000 (14:18 +0100)

perf: use GIT_PERF_REPEAT_COUNT=3 by default even without config file

9ba95ed23c (perf/run: update get_var_from_env_or_config() for
subsections) stopped setting a default value for GIT_PERF_REPEAT_COUNT
if no perf config file is present, because get_var_from_env_or_config
returns early in that case.

Fix it by setting the default value after calling this function. Its
fifth parameter is not used for any other variable, so remove the
associated code.

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

Git.pm: add the "use warnings" pragmaÆvar Arnfjörð Bjarmason Sun, 25 Feb 2018 19:46:27 +0000 (19:46 +0000)

Git.pm: add the "use warnings" pragma

Amend Git.pm to load the "warnings" pragma like the rest of the code
in perl/ in addition to the existing "strict" pragma. This is
considered the bare minimum best practice in Perl.

Ever since this code was introduced in b1edc53d06 ("Introduce
Git.pm (v4)", 2006-06-24) it's only been using "strict", not
"warnings".

This leaves contrib/buildsystems/Generators/{QMake,VCproj}.pm and
contrib/mw-to-git/Git/Mediawiki.pm without "use warnings". Amending
those would be a sensible follow-up change, but I don't have an easy
way to test those so I'm not changing them.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Git.pm: remove redundant "use strict" from sub-packageÆvar Arnfjörð Bjarmason Sun, 25 Feb 2018 19:46:26 +0000 (19:46 +0000)

Git.pm: remove redundant "use strict" from sub-package

In Perl the "use strict/warnings" pragmas are lexical, thus there's no
reason to do:

package Foo;
use strict;
package Bar;
use strict;
$x = 5;

To satisfy the desire that the undeclared $x variable will be spotted
at compile-time. It's enough to include the first "use strict".

This functionally changes nothing, but makes a subsequent change where
"use warnings" will be added to Git.pm less confusing and less
verbose, since as with "strict" we'll only need to do that at the top
of the file.

Changes code initially added in a6065b548f ("Git.pm: Try to support
ActiveState output pipe", 2006-06-25).

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

perl: *.pm files should not have the executable bitÆvar Arnfjörð Bjarmason Sun, 25 Feb 2018 19:46:25 +0000 (19:46 +0000)

perl: *.pm files should not have the executable bit

The Git::Mail::Address file added in bd869f67b9 ("send-email: add and
use a local copy of Mail::Address", 2018-01-05) had the executable bit
set. That bit should not be set for *.pm files. It breaks nothing but
it is redundant and confusing as none of the other files have it and
these files are never executed as stand-alone programs.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

sequencer: always roll back lock in `do_recursive_merge()`Martin Ågren Tue, 27 Feb 2018 21:30:10 +0000 (22:30 +0100)

sequencer: always roll back lock in `do_recursive_merge()`

If we return early, we forget to roll back the lockfile. Do so.

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

sequencer: make lockfiles non-staticMartin Ågren Tue, 27 Feb 2018 21:30:09 +0000 (22:30 +0100)

sequencer: make lockfiles non-static

After 076aa2cbd (tempfile: auto-allocate tempfiles on heap, 2017-09-05),
we can have lockfiles on the stack.

One of these functions fails to always roll back the lock. That will be
fixed in the next commit.

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

sha1_name: fix uninitialized memory errorsDerrick Stolee Tue, 27 Feb 2018 11:47:04 +0000 (06:47 -0500)

sha1_name: fix uninitialized memory errors

During abbreviation checks, we navigate to the position within a
pack-index that an OID would be inserted and check surrounding OIDs
for the maximum matching prefix. This position may be beyond the
last position, because the given OID is lexicographically larger
than every OID in the pack. Then nth_packed_object_oid() does not
initialize "oid".

Use the return value of nth_packed_object_oid() to prevent these
errors.

Also the comment about checking near-by objects miscounts the
neighbours. If we have a hit at "first", we check "first-1" and
"first+1" to make sure we have sufficiently long abbreviation not to
match either. If we do not have a hit, "first" is the smallest
among the objects that are larger than what we want to name, so we
check that and "first-1" to make sure we have sufficiently long
abbreviation not to match either. In either case, we only check up
to two near-by objects.

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

docs/pretty-formats: fix typo '% <(<N>)' -> '%<|(<N>)'Mårten Kongstad Tue, 27 Feb 2018 20:17:44 +0000 (21:17 +0100)

docs/pretty-formats: fix typo '% <(<N>)' -> '%<|(<N>)'

Remove erroneous space between % and < in '% <(<N>)'.

Signed-off-by: Mårten Kongstad <marten.kongstad@gmail.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

test_must_be_empty: make sure the file exists, not... Junio C Hamano Tue, 27 Feb 2018 21:27:29 +0000 (13:27 -0800)

test_must_be_empty: make sure the file exists, not just empty

The helper function test_must_be_empty is meant to make sure the
given file is empty, but its implementation is:

if test -s "$1"
then
... not empty, we detected a failure ...
fi

Surely, the file having non-zero size is a sign that the condition
"the file must be empty" is violated, but it misses the case where
the file does not even exist. It is an accident waiting to happen
with a buggy test like this:

git frotz 2>error-message &&
test_must_be_empty errro-message

that won't get caught until you deliberately break 'git frotz' and
notice why the test does not fail.

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

t1507-rev-parse-upstream: don't check the stderr of... SZEDER Gábor Fri, 23 Feb 2018 23:39:43 +0000 (00:39 +0100)

t1507-rev-parse-upstream: don't check the stderr of a shell function

Three tests in 't1507-rev-parse-upstream.sh' fail when the test script
is run with '-x' tracing (and using a shell other than a Bash version
supporting BASH_XTRACEFD). The reason for those failures is that the
tests check the stderr of the function 'error_message', which includes
the trace of commands executed in that function as well, throwing off
the comparison with the expected output.

Save stderr of 'git rev-parse' only instead of the whole function, so
it remains free from tracing output.

After this change t1507 passes with '-x', even when running with
/bin/sh.

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

t: add means to disable '-x' tracing for individual... SZEDER Gábor Fri, 23 Feb 2018 23:39:42 +0000 (00:39 +0100)

t: add means to disable '-x' tracing for individual test scripts

The previous patch resolved most of the test failures caused by
running our test suite with '-x' tracing and /bin/sh, and the
following patches in this series will resolve almost all of the
remaining failures. Unfortunately, not yet all.

Add means to disable '-x' tracing for individual test scripts by
setting the $test_untraceable variable to a non-empty value in the
test script before sourcing 'test-lib.sh'. However, since '-x'
tracing is not an issue with recent Bash versions supporting
BASH_XTRACEFD, i.e. v4.1 and later, don't disable tracing when the
test script is run with such a Bash version even when
$test_untraceable is set.

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

t: prevent '-x' tracing from interfering with test... SZEDER Gábor Sun, 25 Feb 2018 13:40:15 +0000 (14:40 +0100)

t: prevent '-x' tracing from interfering with test helpers' stderr

Running a test script with '-x' turns on 'set -x' tracing, the output
of which is normally sent to stderr. This causes a lot of
test failures, because many tests redirect and verify the stderr
of shell functions, most frequently that of 'test_must_fail'.
These issues were worked around somewhat in d88785e424 (test-lib: set
BASH_XTRACEFD automatically, 2016-05-11), so at least we could
reliably run tests with '-x' tracing under a Bash version supporting
BASH_XTRACEFD, i.e. v4.1 and later.

Futhermore, redirecting the stderr of test helper functions like
'test_must_fail' or 'test_expect_code' is the cause of a different
issue as well. If these functions detect something unexpected, they
will write their error messages intended to the user to thier stderr.
However, if their stderr is redirected in order to save and verify the
stderr of the tested git command invoked in the function, then the
function's error messages will be redirected as well. Consequently,
those messages won't reach the user, making the test's verbose output
less useful.

This patch makes it safe to redirect and verify the stderr of those
test helper functions which are meant to run the tested command given
as argument, even when running tests with '-x' and /bin/sh. This is
achieved through a couple of file descriptor redirections:

- Duplicate stderr of the tested command executed in the test helper
function from the function's fd 7 (see next point), to ensure that
the tested command's error messages go to a different fd than the
'-x' trace of the commands executed in the function or the
function's error messages.

- Duplicate the test helper function's fd 7 from the function's
original stderr, meaning that, after taking a detour through fd 7,
the error messages of the tested command do end up on the
function's original stderr.

- Duplicate stderr of the test helper function from fd 4, i.e. the
fd connected to the test script's original stderr and the fd used
for BASH_XTRACEFD. This ensures that the '-x' trace of the
commands executed in the function

- doesn't go to the function's original stderr, so it won't mess
with callers who want to save and verify the tested command's
stderr.

- does go to the same fd independently from the shell running
the test script, be it /bin/sh, an older Bash without
BASH_XTRACEFD, or a more recent Bash already supporting
BASH_XTRACEFD.

Furthermore, this also makes sure that the function's error
messages go to this fd 4, meaning that the user will be able to
see them even if the function's stderr is redirected in the test.

- Specify the latter two redirections above in the test helper
function's definition, so they are performed every time the
function is invoked, without the need to modify the callsites of
the function.

Perform these redirections in those test helper functions which can be
expected to have their stderr redirected, i.e. in the functions
'test_must_fail', 'test_might_fail', 'test_expect_code', 'test_env',
'nongit', 'test_terminal' and 'perl'. Note that 'test_might_fail',
'test_env', and 'nongit' are not involved in any test failures when
running tests with '-x' and /bin/sh.

The other test helper functions are left unchanged, because they
either don't run commands specified as their arguments, or redirecting
their stderr wouldn't make sense, or both.

With this change the number of failures when running the test suite
with '-x' tracing and /bin/sh goes down from 340 failed tests in 43
test scripts to 22 failed tests in 6 scripts (or 23 in 7, if the
system (OSX) uses an older Bash version without BASH_XTRACEFD to run
't9903-bash-prompt.sh').

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

Fifth batch for 2.17Junio C Hamano Tue, 27 Feb 2018 18:35:18 +0000 (10:35 -0800)

Fifth batch for 2.17

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

Sync with maintJunio C Hamano Tue, 27 Feb 2018 18:53:19 +0000 (10:53 -0800)

Sync with maint

Merge branch 'ys/bisect-object-id-missing-conversion... Junio C Hamano Tue, 27 Feb 2018 18:43:55 +0000 (10:43 -0800)

Merge branch 'ys/bisect-object-id-missing-conversion-fix' into maint

Fix for a commented-out code to adjust it to a rather old API change.

* ys/bisect-object-id-missing-conversion-fix:
bisect: debug: convert struct object to object_id

Merge branch 'sb/submodule-update-reset-fix' into maintJunio C Hamano Tue, 27 Feb 2018 18:43:54 +0000 (10:43 -0800)

Merge branch 'sb/submodule-update-reset-fix' into maint

When resetting the working tree files recursively, the working tree
of submodules are now also reset to match.

* sb/submodule-update-reset-fix:
submodule: submodule_move_head omits old argument in forced case
unpack-trees: oneway_merge to update submodules
t/lib-submodule-update.sh: fix test ignoring ignored files in submodules
t/lib-submodule-update.sh: clarify test

Merge branch 'ab/commit-m-with-fixup' into maintJunio C Hamano Tue, 27 Feb 2018 18:43:54 +0000 (10:43 -0800)

Merge branch 'ab/commit-m-with-fixup' into maint

"git commit --fixup" did not allow "-m<message>" option to be used
at the same time; allow it to annotate resulting commit with more
text.

* ab/commit-m-with-fixup:
commit: add support for --fixup <commit> -m"<extra message>"
commit doc: document that -c, -C, -F and --fixup with -m error

Merge branch 'nd/ita-wt-renames-in-status' into maintJunio C Hamano Tue, 27 Feb 2018 18:39:34 +0000 (10:39 -0800)

Merge branch 'nd/ita-wt-renames-in-status' into maint

"git status" after moving a path in the working tree (hence making
it appear "removed") and then adding with the -N option (hence
making that appear "added") detected it as a rename, but did not
report the old and new pathnames correctly.

* nd/ita-wt-renames-in-status:
wt-status.c: handle worktree renames
wt-status.c: rename rename-related fields in wt_status_change_data
wt-status.c: catch unhandled diff status codes
wt-status.c: coding style fix
Use DIFF_DETECT_RENAME for detect_rename assignments
t2203: test status output with porcelain v2 format

Merge branch 'jt/binsearch-with-fanout'Junio C Hamano Tue, 27 Feb 2018 18:34:03 +0000 (10:34 -0800)

Merge branch 'jt/binsearch-with-fanout'

Refactor the code to binary search starting from a fan-out table
(which is how the packfile is indexed with object names) into a
reusable helper.

* jt/binsearch-with-fanout:
packfile: refactor hash search with fanout table
packfile: remove GIT_DEBUG_LOOKUP log statements

Merge branch 'rd/typofix'Junio C Hamano Tue, 27 Feb 2018 18:34:03 +0000 (10:34 -0800)

Merge branch 'rd/typofix'

Typofix.

* rd/typofix:
Correct mispellings of ".gitmodule" to ".gitmodules"
t/: correct obvious typo "detahced"

Merge branch 'jk/test-hashmap-updates'Junio C Hamano Tue, 27 Feb 2018 18:34:02 +0000 (10:34 -0800)

Merge branch 'jk/test-hashmap-updates'

Code clean-up.

* jk/test-hashmap-updates:
test-hashmap: use "unsigned int" for hash storage
test-hashmap: simplify alloc_test_entry
test-hashmap: use strbuf_getline rather than fgets
test-hashmap: use xsnprintf rather than snprintf
test-hashmap: check allocation computation for overflow
test-hashmap: use ALLOC_ARRAY rather than bare malloc

Merge branch 'jk/sq-dequote-on-bogus-input'Junio C Hamano Tue, 27 Feb 2018 18:34:02 +0000 (10:34 -0800)

Merge branch 'jk/sq-dequote-on-bogus-input'

Code to unquote single-quoted string (used in the parser for
configuration files, etc.) did not diagnose bogus input correctly
and produced bogus results instead.

* jk/sq-dequote-on-bogus-input:
sq_dequote: fix extra consumption of source string

Merge branch 'bp/fsmonitor'Junio C Hamano Tue, 27 Feb 2018 18:34:01 +0000 (10:34 -0800)

Merge branch 'bp/fsmonitor'

Doc update for a recently added feature.

* bp/fsmonitor:
fsmonitor: update documentation to remove reference to invalid config settings

Merge branch 'bc/doc-interpret-trailers-grammofix'Junio C Hamano Tue, 27 Feb 2018 18:34:00 +0000 (10:34 -0800)

Merge branch 'bc/doc-interpret-trailers-grammofix'

Docfix.

* bc/doc-interpret-trailers-grammofix:
docs/interpret-trailers: fix agreement error

Merge branch 'as/ll-i18n'Junio C Hamano Tue, 27 Feb 2018 18:33:58 +0000 (10:33 -0800)

Merge branch 'as/ll-i18n'

Some messages in low level start-up codepath have been i18n-ized.

* as/ll-i18n:
Mark messages for translations

Merge branch 'sg/doc-test-must-fail-args'Junio C Hamano Tue, 27 Feb 2018 18:33:58 +0000 (10:33 -0800)

Merge branch 'sg/doc-test-must-fail-args'

Devdoc update.

* sg/doc-test-must-fail-args:
t: document 'test_must_fail ok=<signal-name>'

Merge branch 'sb/describe-blob'Junio C Hamano Tue, 27 Feb 2018 18:33:57 +0000 (10:33 -0800)

Merge branch 'sb/describe-blob'

"git describe $garbage" stopped giving any errors when the garbage
happens to be a string with 40 hexadecimal letters.

* sb/describe-blob:
describe: confirm that blobs actually exist

Merge branch 'rs/check-ignore-multi'Junio C Hamano Tue, 27 Feb 2018 18:33:56 +0000 (10:33 -0800)

Merge branch 'rs/check-ignore-multi'

"git check-ignore" with multiple paths got confused when one is a
file and the other is a directory, which has been fixed.

* rs/check-ignore-multi:
check-ignore: fix mix of directories and other file types

Merge branch 'rj/sparse-updates'Junio C Hamano Tue, 27 Feb 2018 18:33:55 +0000 (10:33 -0800)

Merge branch 'rj/sparse-updates'

Devtool update.

* rj/sparse-updates:
Makefile: suppress a sparse warning for pack-revindex.c
config.mak.uname: remove SPARSE_FLAGS setting for cygwin

Merge branch 'jk/t0002-simplify'Junio C Hamano Tue, 27 Feb 2018 18:33:55 +0000 (10:33 -0800)

Merge branch 'jk/t0002-simplify'

Code cleanup.

* jk/t0002-simplify:
t0002: simplify error checking

Merge branch 'js/packet-read-line-check-null'Junio C Hamano Tue, 27 Feb 2018 18:33:54 +0000 (10:33 -0800)

Merge branch 'js/packet-read-line-check-null'

Some low level protocol codepath could crash when they get an
unexpected flush packet, which is now fixed.

* js/packet-read-line-check-null:
always check for NULL return from packet_read_line()
correct error messages for NULL packet_read_line()

Merge branch 'js/fix-merge-arg-quoting-in-rebase-p'Junio C Hamano Tue, 27 Feb 2018 18:33:54 +0000 (10:33 -0800)

Merge branch 'js/fix-merge-arg-quoting-in-rebase-p'

"git rebase -p" mangled log messages of a merge commit, which is
now fixed.

* js/fix-merge-arg-quoting-in-rebase-p:
rebase -p: fix incorrect commit message when calling `git merge`.

Merge branch 'jk/gettext-poison'Junio C Hamano Tue, 27 Feb 2018 18:33:54 +0000 (10:33 -0800)

Merge branch 'jk/gettext-poison'

Test updates.

* jk/gettext-poison:
git-sh-i18n: check GETTEXT_POISON before USE_GETTEXT_SCHEME
t0205: drop redundant test

Merge branch 'jk/doc-do-not-write-extern'Junio C Hamano Tue, 27 Feb 2018 18:33:53 +0000 (10:33 -0800)

Merge branch 'jk/doc-do-not-write-extern'

Devdoc update.

* jk/doc-do-not-write-extern:
CodingGuidelines: mention "static" and "extern"

Merge branch 'bp/name-hash-dirname-fix'Junio C Hamano Tue, 27 Feb 2018 18:33:53 +0000 (10:33 -0800)

Merge branch 'bp/name-hash-dirname-fix'

"git add" files in the same directory, but spelling the directory
path in different cases on case insensitive filesystem, corrupted
the name hash data structure and led to unexpected results. This
has been corrected.

* bp/name-hash-dirname-fix:
name-hash: properly fold directory names in adjust_dirname_case()

Merge branch 'jc/blame-missing-path'Junio C Hamano Tue, 27 Feb 2018 18:33:50 +0000 (10:33 -0800)

Merge branch 'jc/blame-missing-path'

"git blame HEAD COPYING" in a bare repository failed to run, while
"git blame HEAD -- COPYING" run just fine. This has been corrected.

* jc/blame-missing-path:
blame: tighten command line parser

Merge branch 'ab/untracked-cache-invalidation-docs'Junio C Hamano Tue, 27 Feb 2018 18:33:50 +0000 (10:33 -0800)

Merge branch 'ab/untracked-cache-invalidation-docs'

Doc update to warn against remaining bugs in untracked cache.

* ab/untracked-cache-invalidation-docs:
update-index doc: note the caveat with "could not open..."
update-index doc: note a fixed bug in the untracked cache

Merge branch 'nd/fix-untracked-cache-invalidation'Junio C Hamano Tue, 27 Feb 2018 18:33:49 +0000 (10:33 -0800)

Merge branch 'nd/fix-untracked-cache-invalidation'

Some bugs around "untracked cache" feature have been fixed.

* nd/fix-untracked-cache-invalidation:
dir.c: ignore paths containing .git when invalidating untracked cache
dir.c: stop ignoring opendir() error in open_cached_dir()
dir.c: fix missing dir invalidation in untracked code
dir.c: avoid stat() in valid_cached_dir()
status: add a failing test showing a core.untrackedCache bug

perl: call timegm and timelocal with 4-digit yearBernhard M. Wiedemann Fri, 23 Feb 2018 17:20:45 +0000 (18:20 +0100)

perl: call timegm and timelocal with 4-digit year

Amazingly, timegm(gmtime(0)) is only 0 before 2020 because perl's
timegm deviates from GNU timegm(3) in how it handles years.

man Time::Local says

Whenever possible, use an absolute four digit year instead.

with a detailed explanation about ambiguity of 2-digit years above that.

Even though this ambiguity is error-prone with >50% of users getting it
wrong, it has been like this for 20+ years, so we just use 4-digit years
everywhere to be on the safe side.

We add some extra logic to cvsimport because it allows 2-digit year
input and interpreting an 18 as 1918 can be avoided easily and safely.

Signed-off-by: Bernhard M. Wiedemann <bwiedemann@suse.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

subtree: fix add and pull for GPG-signed commitsStephen R Guglielmo Fri, 23 Feb 2018 20:41:25 +0000 (15:41 -0500)

subtree: fix add and pull for GPG-signed commits

If log.showsignature is true (or --show-signature is passed) while
performing a `subtree add` or `subtree pull`, the command fails.

toptree_for_commit() calls `log` and passes the output to `commit-tree`.
If this output shows the GPG signature data, `commit-tree` throws a
fatal error.

This commit fixes the issue by adding --no-show-signature to `log` calls
in a few places, as well as using the more appropriate `rev-parse`
instead where possible.

Signed-off-by: Stephen R Guglielmo <srg@guglielmo.us>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

strbuf_read_file(): preserve errno across close() callJeff King Fri, 23 Feb 2018 07:00:54 +0000 (02:00 -0500)

strbuf_read_file(): preserve errno across close() call

If we encounter a read error, the user may want to report it
by looking at errno. However, our close() call may clobber
errno, leading to confusing results. Let's save and restore
it in the error case.

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

grep: simplify grep_oid and grep_fileRasmus Villemoes Fri, 23 Feb 2018 14:47:57 +0000 (15:47 +0100)

grep: simplify grep_oid and grep_file

In the NO_PTHREADS or !num_threads case, this doesn't change
anything. In the threaded case, note that grep_source_init duplicates
its third argument, so there is no need to keep [path]buf.buf alive
across the call of add_work().

Signed-off-by: Rasmus Villemoes <rv@rasmusvillemoes.dk>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

grep: move grep_source_init outside critical sectionRasmus Villemoes Fri, 23 Feb 2018 14:47:56 +0000 (15:47 +0100)

grep: move grep_source_init outside critical section

grep_source_init typically does three strdup()s, and in the threaded
case, the call from add_work() happens while holding grep_mutex.

We can thus reduce the time we hold grep_mutex by moving the
grep_source_init() call out of add_work(), and simply have add_work()
copy the initialized structure to the available slot in the todo
array.

This also simplifies the prototype of add_work(), since it no longer
needs to duplicate all the parameters of grep_source_init(). In the
callers of add_work(), we get to reduce the amount of code duplicated in
the threaded and non-threaded cases slightly (avoiding repeating the
long "GREP_SOURCE_OID, pathbuf.buf, path, oid" argument list); a
subsequent cleanup patch will make that even more so.

Signed-off-by: Rasmus Villemoes <rv@rasmusvillemoes.dk>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Documentation/gitsubmodules.txt: avoid non-ASCII apostr... Motoki Seki Thu, 22 Feb 2018 08:52:25 +0000 (08:52 +0000)

Documentation/gitsubmodules.txt: avoid non-ASCII apostrophes

In gitsubmodules.txt, a few non-ASCII apostrophes are used to spell
possessive, e.g. "submodule's". These unfortunately are not
rendered at https://git-scm.com/docs/gitsubmodules correctly by the
renderer used there.

Use ASCII apostrophes instead to work around the problem. It also
is good to be consistent, as there are possessives spelled with
ASCII apostrophes.

Signed-off-by: Motoki Seki <marmot.motoki@gmail.com>
Acked-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

sequencer: factor out strbuf_read_file_or_whine()René Scharfe Thu, 22 Feb 2018 19:29:25 +0000 (20:29 +0100)

sequencer: factor out strbuf_read_file_or_whine()

Reduce code duplication by factoring out a function that reads an entire
file into a strbuf, or reports errors on stderr if something goes wrong.

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

t: send verbose test-helper output to fd 4Jeff King Thu, 22 Feb 2018 06:48:37 +0000 (01:48 -0500)

t: send verbose test-helper output to fd 4

Test helper functions like test_must_fail may produce
messages to stderr when they see a problem. When the tests
are run with "--verbose", this ends up on the test script's
stderr, and the user can read it.

But there's a problem. Some tests record stderr as part of
the test, like:

test_must_fail git foo 2>output &&
test_i18ngrep expected.message output

In this case the error text goes into "output". This makes
the --verbose output less useful (it also means we might
accidentally match it in the second, though in practice we
tend to produce these messages only on error, so we'd abort
the test when the first command fails).

Let's instead send this user-facing output directly to
descriptor 4, which always points to the original stderr (or
/dev/null in non-verbose mode). And it's already forbidden
to redirect descriptor 4, since we use it for BASH_XTRACEFD,
as explained in 9be795fbce (t5615: avoid re-using descriptor
4, 2017-12-08).

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

revision: drop --show-all optionJeff King Wed, 21 Feb 2018 23:27:24 +0000 (18:27 -0500)

revision: drop --show-all option

This was an undocumented debugging aid that does not seem to
have come in handy in the past decade, judging from its lack
of mentions on the mailing list.

Let's drop it in the name of simplicity. This is morally a
revert of 3131b71301 (Add "--show-all" revision walker flag
for debugging, 2008-02-09), but note that I did leave in the
mapping of UNINTERESTING to "^" in get_revision_mark(). I
don't think this would be possible to trigger with the
current code, but it's the only sensible marker.

We'll skip the usual deprecation period because this was
explicitly a debugging aid that was never documented.

Signed-off-by: Jeff King <peff@peff.net>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

commit: drop uses of get_cached_commit_buffer()Jeff King Wed, 21 Feb 2018 23:13:38 +0000 (18:13 -0500)

commit: drop uses of get_cached_commit_buffer()

The "--show-all" revision option shows UNINTERESTING
commits. Some of these commits may be unparsed when we try
to show them (since we may or may not need to walk their
parents to fulfill the request).

Commit 3131b71301 (Add "--show-all" revision walker flag for
debugging, 2008-02-09) resolved this by just skipping
pretty-printing for commits without their object contents
cached, saying:

Because we now end up listing commits we may not even have been parsed
at all "show_log" and "show_commit" need to protect against commits
that don't have a commit buffer entry.

That was the easy fix to avoid the pretty-printer segfaulting,
but:

1. It doesn't work for all formats. E.g., --oneline
prints the oid for each such commit but not a trailing
newline, leading to jumbled output.

2. It only affects some commits, depending on whether we
happened to parse them or not (so if they were at the
tip of an UNINTERESTING starting point, or if we
happened to traverse over them, you'd see more data).

3. It unncessarily ties the decision to show the verbose
header to whether the commit buffer was cached. That
makes it harder to change the logic around caching
(e.g., if we could traverse without actually loading
the full commit objects).

These days it's safe to feed such a commit to the
pretty-print code. Since be5c9fb904 (logmsg_reencode: lazily
load missing commit buffers, 2013-01-26), we'll load it on
demand in such a case. So let's just always show the verbose
headers.

This does change the behavior of plumbing, but:

a. The --show-all option was explicitly introduced as a
debugging aid, and was never documented (and has rarely
even been mentioned on the list by git devs).

b. Avoiding the commits was already not deterministic due
to (2) above. So the caller might have seen full
headers for these commits anyway, and would need to be
prepared for it.

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

replace: rename 'new' variablesBrandon Williams Wed, 14 Feb 2018 18:59:59 +0000 (10:59 -0800)

replace: rename 'new' variables

Rename C++ keyword in order to bring the codebase closer to being able
to be compiled with a C++ compiler.

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

trailer: rename 'template' variablesBrandon Williams Wed, 14 Feb 2018 18:59:58 +0000 (10:59 -0800)

trailer: rename 'template' variables

Rename C++ keyword in order to bring the codebase closer to being able
to be compiled with a C++ compiler.

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

tempfile: rename 'template' variablesBrandon Williams Wed, 14 Feb 2018 18:59:57 +0000 (10:59 -0800)

tempfile: rename 'template' variables

Rename C++ keyword in order to bring the codebase closer to being able
to be compiled with a C++ compiler.

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

wrapper: rename 'template' variablesBrandon Williams Wed, 14 Feb 2018 18:59:56 +0000 (10:59 -0800)

wrapper: rename 'template' variables

Rename C++ keyword in order to bring the codebase closer to being able
to be compiled with a C++ compiler.

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

environment: rename 'namespace' variablesBrandon Williams Wed, 14 Feb 2018 18:59:55 +0000 (10:59 -0800)

environment: rename 'namespace' variables

Rename C++ keyword in order to bring the codebase closer to being able
to be compiled with a C++ compiler.

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

diff: rename 'template' variablesBrandon Williams Wed, 14 Feb 2018 18:59:54 +0000 (10:59 -0800)

diff: rename 'template' variables

Rename C++ keyword in order to bring the codebase closer to being able
to be compiled with a C++ compiler.

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

environment: rename 'template' variablesBrandon Williams Wed, 14 Feb 2018 18:59:53 +0000 (10:59 -0800)

environment: rename 'template' variables

Rename C++ keyword in order to bring the codebase closer to being able
to be compiled with a C++ compiler.

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

init-db: rename 'template' variablesBrandon Williams Wed, 14 Feb 2018 18:59:52 +0000 (10:59 -0800)

init-db: rename 'template' variables

Rename C++ keyword in order to bring the codebase closer to being able
to be compiled with a C++ compiler.

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

unpack-trees: rename 'new' variablesBrandon Williams Wed, 14 Feb 2018 18:59:51 +0000 (10:59 -0800)

unpack-trees: rename 'new' variables

Rename C++ keyword in order to bring the codebase closer to being able
to be compiled with a C++ compiler.

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

trailer: rename 'new' variablesBrandon Williams Wed, 14 Feb 2018 18:59:50 +0000 (10:59 -0800)

trailer: rename 'new' variables

Rename C++ keyword in order to bring the codebase closer to being able
to be compiled with a C++ compiler.

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

submodule: rename 'new' variablesBrandon Williams Wed, 14 Feb 2018 18:59:49 +0000 (10:59 -0800)

submodule: rename 'new' variables

Rename C++ keyword in order to bring the codebase closer to being able
to be compiled with a C++ compiler.

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

split-index: rename 'new' variablesBrandon Williams Wed, 14 Feb 2018 18:59:48 +0000 (10:59 -0800)

split-index: rename 'new' variables

Rename C++ keyword in order to bring the codebase closer to being able
to be compiled with a C++ compiler.

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

remote: rename 'new' variablesBrandon Williams Wed, 14 Feb 2018 18:59:47 +0000 (10:59 -0800)

remote: rename 'new' variables

Rename C++ keyword in order to bring the codebase closer to being able
to be compiled with a C++ compiler.

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

ref-filter: rename 'new' variablesBrandon Williams Wed, 14 Feb 2018 18:59:46 +0000 (10:59 -0800)

ref-filter: rename 'new' variables

Rename C++ keyword in order to bring the codebase closer to being able
to be compiled with a C++ compiler.

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

read-cache: rename 'new' variablesBrandon Williams Wed, 14 Feb 2018 18:59:45 +0000 (10:59 -0800)

read-cache: rename 'new' variables

Rename C++ keyword in order to bring the codebase closer to being able
to be compiled with a C++ compiler.

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

line-log: rename 'new' variablesBrandon Williams Wed, 14 Feb 2018 18:59:44 +0000 (10:59 -0800)

line-log: rename 'new' variables

Rename C++ keyword in order to bring the codebase closer to being able
to be compiled with a C++ compiler.

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

imap-send: rename 'new' variablesBrandon Williams Wed, 14 Feb 2018 18:59:43 +0000 (10:59 -0800)

imap-send: rename 'new' variables

Rename C++ keyword in order to bring the codebase closer to being able
to be compiled with a C++ compiler.

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

http: rename 'new' variablesBrandon Williams Wed, 14 Feb 2018 18:59:42 +0000 (10:59 -0800)

http: rename 'new' variables

Rename C++ keyword in order to bring the codebase closer to being able
to be compiled with a C++ compiler.

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

entry: rename 'new' variablesBrandon Williams Wed, 14 Feb 2018 18:59:41 +0000 (10:59 -0800)

entry: rename 'new' variables

Rename C++ keyword in order to bring the codebase closer to being able
to be compiled with a C++ compiler.

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

diffcore-delta: rename 'new' variablesBrandon Williams Wed, 14 Feb 2018 18:59:40 +0000 (10:59 -0800)

diffcore-delta: rename 'new' variables

Rename C++ keyword in order to bring the codebase closer to being able
to be compiled with a C++ compiler.

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

diff: rename 'new' variablesBrandon Williams Wed, 14 Feb 2018 18:59:39 +0000 (10:59 -0800)

diff: rename 'new' variables

Rename C++ keyword in order to bring the codebase closer to being able
to be compiled with a C++ compiler.

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

diff-lib: rename 'new' variableBrandon Williams Wed, 14 Feb 2018 18:59:38 +0000 (10:59 -0800)

diff-lib: rename 'new' variable

Rename C++ keyword in order to bring the codebase closer to being able
to be compiled with a C++ compiler.

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

commit: rename 'new' variablesBrandon Williams Wed, 14 Feb 2018 18:59:37 +0000 (10:59 -0800)

commit: rename 'new' variables

Rename C++ keyword in order to bring the codebase closer to being able
to be compiled with a C++ compiler.

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

combine-diff: rename 'new' variablesBrandon Williams Wed, 14 Feb 2018 18:59:36 +0000 (10:59 -0800)

combine-diff: rename 'new' variables

Rename C++ keyword in order to bring the codebase closer to being able
to be compiled with a C++ compiler.

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

remote: rename 'new' variablesBrandon Williams Wed, 14 Feb 2018 18:59:35 +0000 (10:59 -0800)

remote: rename 'new' variables

Rename C++ keyword in order to bring the codebase closer to being able
to be compiled with a C++ compiler.

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

reflog: rename 'new' variablesBrandon Williams Wed, 14 Feb 2018 18:59:34 +0000 (10:59 -0800)

reflog: rename 'new' variables

Rename C++ keyword in order to bring the codebase closer to being able
to be compiled with a C++ compiler.

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

pack-redundant: rename 'new' variablesBrandon Williams Wed, 14 Feb 2018 18:59:33 +0000 (10:59 -0800)

pack-redundant: rename 'new' variables

Rename C++ keyword in order to bring the codebase closer to being able
to be compiled with a C++ compiler.

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

help: rename 'new' variablesBrandon Williams Wed, 14 Feb 2018 18:59:32 +0000 (10:59 -0800)

help: rename 'new' variables

Rename C++ keyword in order to bring the codebase closer to being able
to be compiled with a C++ compiler.

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

checkout: rename 'new' variablesBrandon Williams Wed, 14 Feb 2018 18:59:31 +0000 (10:59 -0800)

checkout: rename 'new' variables

Rename C++ keyword in order to bring the codebase closer to being able
to be compiled with a C++ compiler.

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

apply: rename 'new' variablesBrandon Williams Wed, 14 Feb 2018 18:59:30 +0000 (10:59 -0800)

apply: rename 'new' variables

Rename C++ keyword in order to bring the codebase closer to being able
to be compiled with a C++ compiler.

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

apply: rename 'try' variablesBrandon Williams Wed, 14 Feb 2018 18:59:29 +0000 (10:59 -0800)

apply: rename 'try' variables

Rename C++ keyword in order to bring the codebase closer to being able
to be compiled with a C++ compiler.

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

diff: rename 'this' variablesBrandon Williams Wed, 14 Feb 2018 18:59:28 +0000 (10:59 -0800)

diff: rename 'this' variables

Rename C++ keyword in order to bring the codebase closer to being able
to be compiled with a C++ compiler.

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

Fourth batch for 2.17Junio C Hamano Wed, 21 Feb 2018 20:45:35 +0000 (12:45 -0800)

Fourth batch for 2.17

Merge branch 'sg/test-i18ngrep'Junio C Hamano Wed, 21 Feb 2018 20:45:05 +0000 (12:45 -0800)

Merge branch 'sg/test-i18ngrep'

Test fixes.

* sg/test-i18ngrep:
t: make 'test_i18ngrep' more informative on failure
t: validate 'test_i18ngrep's parameters
t: move 'test_i18ncmp' and 'test_i18ngrep' to 'test-lib-functions.sh'
t5536: let 'test_i18ngrep' read the file without redirection
t5510: consolidate 'grep' and 'test_i18ngrep' patterns
t4001: don't run 'git status' upstream of a pipe
t6022: don't run 'git merge' upstream of a pipe
t5812: add 'test_i18ngrep's missing filename parameter
t5541: add 'test_i18ngrep's missing filename parameter

Merge branch 'gs/rebase-allow-empty-message'Junio C Hamano Wed, 21 Feb 2018 20:45:04 +0000 (12:45 -0800)

Merge branch 'gs/rebase-allow-empty-message'

"git rebase" learned to take "--allow-empty-message" option.

* gs/rebase-allow-empty-message:
rebase: add --allow-empty-message option

Merge branch 'lw/daemon-log-destination'Junio C Hamano Wed, 21 Feb 2018 20:45:04 +0000 (12:45 -0800)

Merge branch 'lw/daemon-log-destination'

The log from "git daemon" can be redirected with a new option; one
relevant use case is to send the log to standard error (instead of
syslog) when running it from inetd.

* lw/daemon-log-destination:
daemon: add --log-destination=(stderr|syslog|none)

Merge branch 'nd/format-patch-stat-width'Junio C Hamano Wed, 21 Feb 2018 20:45:04 +0000 (12:45 -0800)

Merge branch 'nd/format-patch-stat-width'

"git format-patch" learned to give 72-cols to diffstat, which is
consistent with other line length limits the subcommand uses for
its output meant for e-mails.

* nd/format-patch-stat-width:
format-patch: reduce patch diffstat width to 72
format-patch: keep cover-letter diffstat wrapped in 72 columns

submodule: indicate that 'submodule.recurse' doesn... Brandon Williams Tue, 20 Feb 2018 20:29:22 +0000 (12:29 -0800)

submodule: indicate that 'submodule.recurse' doesn't apply to clone

Update the documentation for the 'submodule.recurse' config to identify
that the clone command does not respect it.

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

ref-filter: get rid of gotoOlga Telezhnaya Wed, 21 Feb 2018 06:59:01 +0000 (06:59 +0000)

ref-filter: get rid of goto

Get rid of goto command in ref-filter for better readability.

Signed-off-by: Olga Telezhnaia <olyatelezhnaya@gmail.com>
Mentored-by: Christian Couder <christian.couder@gmail.com>
Mentored by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

ref-filter: get rid of duplicate codeOlga Telezhnaya Wed, 21 Feb 2018 06:59:00 +0000 (06:59 +0000)

ref-filter: get rid of duplicate code

Make one function from 2 duplicate pieces and invoke it twice.

Signed-off-by: Olga Telezhnaia <olyatelezhnaya@gmail.com>
Mentored-by: Christian Couder <christian.couder@gmail.com>
Mentored by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

remote-curl: unquote incoming push-optionsJeff King Mon, 19 Feb 2018 19:50:14 +0000 (14:50 -0500)

remote-curl: unquote incoming push-options

The transport-helper protocol c-style quotes the value of
any options passed to the helper via the "option <key> <value>"
directive. However, remote-curl doesn't actually unquote the
push-option values, meaning that we will send the quoted
version to the other side (whereas git-over-ssh would send
the raw value).

The pack-protocol.txt documentation defines the push-options
as a series of VCHARs, which excludes most characters that
would need quoting. But:

1. You can still see the bug with a valid push-option that
starts with a double-quote (since that triggers
quoting).

2. We do currently handle any non-NUL characters correctly
in git-over-ssh. So even though the spec does not say
that we need to handle most quoted characters, it's
nice if our behavior is consistent between protocols.

There are two new tests: the "direct" one shows that this
already works in the non-http case, and the http one covers
this bugfix.

Reported-by: Jon Simons <jon@jonsimons.org>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t5545: factor out http repository setupJeff King Mon, 19 Feb 2018 19:48:44 +0000 (14:48 -0500)

t5545: factor out http repository setup

We repeat many lines of setup code in the two http tests,
and further tests would need to repeat it again. Let's
factor this out into a function.

Incidentally, this also fixes an unlikely bug: if the httpd
root path contains a double-quote, our test_when_finished
would barf due to improper quoting (we escape the embedded
quotes, but not the $, meaning we expand the variable before
the eval).

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

t3701: use test_write_lines and write_scriptPhillip Wood Mon, 19 Feb 2018 11:29:04 +0000 (11:29 +0000)

t3701: use test_write_lines and write_script

Simplify things slightly by using the above helpers.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t3701: indent here documentsPhillip Wood Mon, 19 Feb 2018 11:29:03 +0000 (11:29 +0000)

t3701: indent here documents

Indent here documents in line with the current style for tests.
While at it, quote the end marker of here-docs that do not use
variable interpolation.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

add -i: add function to format hunk headerPhillip Wood Mon, 19 Feb 2018 11:29:02 +0000 (11:29 +0000)

add -i: add function to format hunk header

This code is duplicated in a couple of places so make it into a
function as we're going to add some more callers shortly.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Makefile: remove *.spec from clean targetTodd Zullinger Sat, 17 Feb 2018 03:06:24 +0000 (22:06 -0500)

Makefile: remove *.spec from clean target

Support for generating an rpm was dropped in ab214331cf ("Makefile: stop
pretending to support rpmbuild", 2016-04-04). We don't generate any
*.spec files so there is no need to clean them up.

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

git-worktree.txt: fix indentation of example and text... Eric Sunshine Fri, 16 Feb 2018 20:44:52 +0000 (15:44 -0500)

git-worktree.txt: fix indentation of example and text of 'add' command

When 4e85333197 (worktree: make add <path> <branch> dwim, 2017-11-26)
added an example command in a literal code block, it neglected to
insert a mandatory "+" line before the block. This omission resulted
in both the literal code block and the (existing) paragraph following
the block to be outdented, even though they should be indented under
the 'add' sub-command along with the rest of the text pertaining to
that command. Furthermore, the mandatory "+" line separating the code
block from the following text got rendered as a leading character on
the line ("+ If <commit-ish>...") rather than being treated as a
formatting directive.

Fix these problems by adding the missing "+" line before the example
code block.

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

git-worktree.txt: fix missing ")" typoEric Sunshine Fri, 16 Feb 2018 20:44:51 +0000 (15:44 -0500)

git-worktree.txt: fix missing ")" typo

Add the closing ")" to a parenthetical phrase introduced by 4e85333197
(worktree: make add <path> <branch> dwim, 2017-11-26).

While at it, add a missing ":" at the end of the same sentence since
it precedes an example literal command block.

Reported-by: Mike Nordell <tamlin.thefirst@gmail.com>
Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

test-lib.sh: unset XDG_CACHE_HOMEGenki Sky Fri, 16 Feb 2018 02:46:04 +0000 (21:46 -0500)

test-lib.sh: unset XDG_CACHE_HOME

git respects XDG_CACHE_HOME for the credential cache. So, we should
unset XDG_CACHE_HOME for the test environment, lest a user's custom one
cause failure in the test.

For example, t/t0301-credential-cache.sh expects a default directory
to be used if it hasn't explicitly set XDG_CACHE_HOME.

Signed-off-by: Genki Sky <sky@genki.is>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

merge: allow fast-forward when merging a tracked tagJunio C Hamano Wed, 14 Feb 2018 18:18:55 +0000 (10:18 -0800)

merge: allow fast-forward when merging a tracked tag

Long time ago at fab47d05 ("merge: force edit and no-ff mode when
merging a tag object", 2011-11-07), "git merge" was made to always
create a merge commit when merging a tag, even when the side branch
being merged is a descendant of the current branch.

This default is good for merges made by upstream maintainers to
integrate work signed by downstream contributors, but will leave
pointless no-ff merges when downstream contributors pull a newer
release tag to make their long-running topic branches catch up with
the upstream. When there is no local work left on the topic, such a
merge should simply fast-forward to the commit pointed at by the
release tag.

Update the default (again) for "git merge" that merges a tag object
to (1) --no-ff (i.e. create a merge commit even when side branch
fast forwards) if the tag being merged is not at its expected place
in refs/tags/ hierarchy and (2) --ff (i.e. allow fast-forward update
when able) otherwise.

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