git
6 years agot/chainlint: add chainlint "cuddled" test cases
Eric Sunshine [Wed, 11 Jul 2018 06:46:40 +0000 (02:46 -0400)] 
t/chainlint: add chainlint "cuddled" test cases

The --chain-lint option uses heuristics and knowledge of shell syntax to
detect broken &&-chains in subshells by pure textual inspection. The
heuristics handle a range of stylistic variations in existing tests
(evolved over the years), however, they are still best-guesses. As such,
it is possible for future changes to accidentally break assumptions upon
which the heuristics are based. Protect against this possibility by
adding tests which check the linter itself for correctness.

In addition to protecting against regressions, these tests help document
(for humans) expected behavior, which is important since the linter's
implementation language ('sed') does not necessarily lend itself to easy
comprehension.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot/chainlint: add chainlint "loop" and "conditional" test cases
Eric Sunshine [Wed, 11 Jul 2018 06:46:39 +0000 (02:46 -0400)] 
t/chainlint: add chainlint "loop" and "conditional" test cases

The --chain-lint option uses heuristics and knowledge of shell syntax to
detect broken &&-chains in subshells by pure textual inspection. The
heuristics handle a range of stylistic variations in existing tests
(evolved over the years), however, they are still best-guesses. As such,
it is possible for future changes to accidentally break assumptions upon
which the heuristics are based. Protect against this possibility by
adding tests which check the linter itself for correctness.

In addition to protecting against regressions, these tests help document
(for humans) expected behavior, which is important since the linter's
implementation language ('sed') does not necessarily lend itself to easy
comprehension.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot/chainlint: add chainlint "nested subshell" test cases
Eric Sunshine [Wed, 11 Jul 2018 06:46:38 +0000 (02:46 -0400)] 
t/chainlint: add chainlint "nested subshell" test cases

The --chain-lint option uses heuristics and knowledge of shell syntax to
detect broken &&-chains in subshells by pure textual inspection. The
heuristics handle a range of stylistic variations in existing tests
(evolved over the years), however, they are still best-guesses. As such,
it is possible for future changes to accidentally break assumptions upon
which the heuristics are based. Protect against this possibility by
adding tests which check the linter itself for correctness.

In addition to protecting against regressions, these tests help document
(for humans) expected behavior, which is important since the linter's
implementation language ('sed') does not necessarily lend itself to easy
comprehension.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot/chainlint: add chainlint "one-liner" test cases
Eric Sunshine [Wed, 11 Jul 2018 06:46:37 +0000 (02:46 -0400)] 
t/chainlint: add chainlint "one-liner" test cases

The --chain-lint option uses heuristics and knowledge of shell syntax to
detect broken &&-chains in subshells by pure textual inspection. The
heuristics handle a range of stylistic variations in existing tests
(evolved over the years), however, they are still best-guesses. As such,
it is possible for future changes to accidentally break assumptions upon
which the heuristics are based. Protect against this possibility by
adding tests which check the linter itself for correctness.

In addition to protecting against regressions, these tests help document
(for humans) expected behavior, which is important since the linter's
implementation language ('sed') does not necessarily lend itself to easy
comprehension.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot/chainlint: add chainlint "whitespace" test cases
Eric Sunshine [Wed, 11 Jul 2018 06:46:36 +0000 (02:46 -0400)] 
t/chainlint: add chainlint "whitespace" test cases

The --chain-lint option uses heuristics and knowledge of shell syntax to
detect broken &&-chains in subshells by pure textual inspection. The
heuristics handle a range of stylistic variations in existing tests
(evolved over the years), however, they are still best-guesses. As such,
it is possible for future changes to accidentally break assumptions upon
which the heuristics are based. Protect against this possibility by
adding tests which check the linter itself for correctness.

In addition to protecting against regressions, these tests help document
(for humans) expected behavior, which is important since the linter's
implementation language ('sed') does not necessarily lend itself to easy
comprehension.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot/chainlint: add chainlint "basic" test cases
Eric Sunshine [Wed, 11 Jul 2018 06:46:35 +0000 (02:46 -0400)] 
t/chainlint: add chainlint "basic" test cases

The --chain-lint option uses heuristics and knowledge of shell syntax to
detect broken &&-chains in subshells by pure textual inspection. The
heuristics handle a range of stylistic variations in existing tests
(evolved over the years), however, they are still best-guesses. As such,
it is possible for future changes to accidentally break assumptions upon
which the heuristics are based. Protect against this possibility by
adding tests which check the linter itself for correctness.

In addition to protecting against regressions, these tests help document
(for humans) expected behavior, which is important since the linter's
implementation language ('sed') does not necessarily lend itself to easy
comprehension.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot/Makefile: add machinery to check correctness of chainlint.sed
Eric Sunshine [Wed, 11 Jul 2018 06:46:34 +0000 (02:46 -0400)] 
t/Makefile: add machinery to check correctness of chainlint.sed

The --chain-lint option uses heuristics and knowledge of shell syntax to
detect broken &&-chains in subshells by pure textual inspection.
Although the heuristics work well, they are still best-guesses and
future changes could accidentally break assumptions upon which they are
based. To protect against this possibility, tests checking correctness
of the linter itself will be added. As preparation, add a new makefile
"check-chainlint" target and associated machinery.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot/test-lib: teach --chain-lint to detect broken &&-chains in subshells
Eric Sunshine [Wed, 11 Jul 2018 06:46:33 +0000 (02:46 -0400)] 
t/test-lib: teach --chain-lint to detect broken &&-chains in subshells

The --chain-lint option detects broken &&-chains by forcing the test to
exit early (as the very first step) with a sentinel value. If that
sentinel is the test's overall exit code, then the &&-chain is intact;
if not, then the chain is broken. Unfortunately, this detection does not
extend to &&-chains within subshells even when the subshell itself is
properly linked into the outer &&-chain.

Address this shortcoming by feeding the body of the test to a
lightweight "linter" which can peer inside subshells and identify broken
&&-chains by pure textual inspection. Although the linter does not
actually parse shell scripts, it has enough knowledge of shell syntax to
reliably deal with formatting style variations (as evolved over the
years) and to avoid being fooled by non-shell content (such as inside
here-docs and multi-line strings). It recognizes modern subshell
formatting:

    statement1 &&
    (
        statement2 &&
        statement3
    ) &&
    statement4

as well as old-style:

    statement1 &&
    (statement2 &&
     statement3) &&
    statement4

Heuristics are employed to properly identify the extent of a subshell
formatted in the old-style since a number of legitimate constructs may
superficially appear to close the subshell even though they don't. For
example, it understands that neither "x=$(command)" nor "case $x in *)"
end a subshell, despite the ")" at the end of line.

Due to limitations of the tool used ('sed') and its inherent
line-by-line processing, only subshells one level deep are handled, as
well as one-liner subshells one level below that. Subshells deeper than
that or multi-line subshells at level two are passed through as-is, thus
&&-chains in their bodies are not checked.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot5608: fix broken &&-chain
SZEDER Gábor [Thu, 12 Jul 2018 12:37:29 +0000 (14:37 +0200)] 
t5608: fix broken &&-chain

This was missed by the previous clean-ups.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot9119: fix broken &&-chains
Eric Sunshine [Mon, 2 Jul 2018 00:24:05 +0000 (20:24 -0400)] 
t9119: fix broken &&-chains

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot9000-t9999: fix broken &&-chains
Eric Sunshine [Mon, 2 Jul 2018 00:24:04 +0000 (20:24 -0400)] 
t9000-t9999: fix broken &&-chains

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot7000-t7999: fix broken &&-chains
Eric Sunshine [Mon, 2 Jul 2018 00:24:03 +0000 (20:24 -0400)] 
t7000-t7999: fix broken &&-chains

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot6000-t6999: fix broken &&-chains
Eric Sunshine [Mon, 2 Jul 2018 00:24:02 +0000 (20:24 -0400)] 
t6000-t6999: fix broken &&-chains

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot5000-t5999: fix broken &&-chains
Eric Sunshine [Mon, 2 Jul 2018 00:24:01 +0000 (20:24 -0400)] 
t5000-t5999: fix broken &&-chains

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot4000-t4999: fix broken &&-chains
Eric Sunshine [Mon, 2 Jul 2018 00:24:00 +0000 (20:24 -0400)] 
t4000-t4999: fix broken &&-chains

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot3030: fix broken &&-chains
Eric Sunshine [Mon, 2 Jul 2018 00:23:59 +0000 (20:23 -0400)] 
t3030: fix broken &&-chains

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot3000-t3999: fix broken &&-chains
Eric Sunshine [Mon, 2 Jul 2018 00:23:58 +0000 (20:23 -0400)] 
t3000-t3999: fix broken &&-chains

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot2000-t2999: fix broken &&-chains
Eric Sunshine [Mon, 2 Jul 2018 00:23:57 +0000 (20:23 -0400)] 
t2000-t2999: fix broken &&-chains

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot1000-t1999: fix broken &&-chains
Eric Sunshine [Mon, 2 Jul 2018 00:23:56 +0000 (20:23 -0400)] 
t1000-t1999: fix broken &&-chains

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot0000-t0999: fix broken &&-chains
Eric Sunshine [Mon, 2 Jul 2018 00:23:55 +0000 (20:23 -0400)] 
t0000-t0999: fix broken &&-chains

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot9814: simplify convoluted check that command correctly errors out
Eric Sunshine [Mon, 2 Jul 2018 00:23:54 +0000 (20:23 -0400)] 
t9814: simplify convoluted check that command correctly errors out

This test uses a convoluted method to verify that "p4 help" errors
out when asked for help about an unknown command. In doing so, it
intentionally breaks the &&-chain. Simplify by employing the typical
"! command" idiom and a normal &&-chain instead.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot9001: fix broken "invoke hook" test
Eric Sunshine [Mon, 2 Jul 2018 00:23:53 +0000 (20:23 -0400)] 
t9001: fix broken "invoke hook" test

This test has been dysfunctional since it was added by 6489660b4b
(send-email: support validate hook, 2017-05-12), however, the problem
went unnoticed due to a broken &&-chain late in the test.

The test wants to verify that a non-zero exit code from the
'sendemail-validate' hook causes git-send-email to abort with a
particular error message. A command which is expected to fail should be
run with 'test_must_fail', however, the test neglects to do so.

Fix this problem, as well as the broken &&-chain behind which the
problem hid.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot7810: use test_expect_code() instead of hand-rolled comparison
Eric Sunshine [Mon, 2 Jul 2018 00:23:52 +0000 (20:23 -0400)] 
t7810: use test_expect_code() instead of hand-rolled comparison

This test manually checks the exit code of git-grep for a particular
value. In doing so, it intentionally breaks the &&-chain. Modernize the
test by taking advantage of test_expect_code() and a normal &&-chain.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot7400: fix broken "submodule add/reconfigure --force" test
Eric Sunshine [Mon, 2 Jul 2018 00:23:51 +0000 (20:23 -0400)] 
t7400: fix broken "submodule add/reconfigure --force" test

This test has been dysfunctional since it was added by 619acfc78c
(submodule add: extend force flag to add existing repos, 2016-10-06),
however, two problems early in the test went unnoticed due to a broken
&&-chain later in the test.

First, it tries configuring the submodule with repository "bogus-url",
however, "git submodule add" insists that the repository be either an
absolute URL or a relative pathname requiring prefix "./" or "../" (this
is true even with --force), but "bogus-url" does not meet those
criteria, thus the command fails.

Second, it then tries configuring a submodule with a path which is
.gitignore'd, which is disallowed. This restriction can be overridden
with --force, but the test neglects to use that option.

Fix both problems, as well as the broken &&-chain behind which they hid.

Reviewed-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot7201: drop pointless "exit 0" at end of subshell
Eric Sunshine [Mon, 2 Jul 2018 00:23:50 +0000 (20:23 -0400)] 
t7201: drop pointless "exit 0" at end of subshell

This test employs a for-loop inside a subshell and correctly aborts the
loop and fails the test overall (via "exit 1") if any iteration of the
for-loop fails. Otherwise, it exits the subshell with an explicit but
entirely unnecessary "exit 0", presumably to indicate that all
iterations of the loop succeeded. The &&-chain is broken between the
for-loop and the "exit 0". Rather than fixing the &&-chain, just drop
the pointless "exit 0".

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot6036: fix broken "merge fails but has appropriate contents" tests
Eric Sunshine [Mon, 2 Jul 2018 00:23:49 +0000 (20:23 -0400)] 
t6036: fix broken "merge fails but has appropriate contents" tests

These tests reference non-existent object "c" when they really mean to
be referencing "C", however, these errors went unnoticed due to a broken
&&-chain later in the tests. Fix these errors, as well as the broken
&&-chains behind which they hid.

Reviewed-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot5505: modernize and simplify hard-to-digest test
Eric Sunshine [Mon, 2 Jul 2018 00:23:48 +0000 (20:23 -0400)] 
t5505: modernize and simplify hard-to-digest test

This test uses a subshell within a subshell but is formatted in such a
way as to suggests that the inner subshell is a sibling rather than a
child, which makes it difficult to digest the test's structure and
intent.

Worse, the inner subshell performs cleanup of actions from earlier in
the test, however, a failure between the initial actions and the cleanup
will prevent the cleanup from taking place.

Fix these problems by modernizing and simplifying the test and by using
test_when_finished() for the cleanup action.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot5406: use write_script() instead of birthing shell script manually
Eric Sunshine [Mon, 2 Jul 2018 00:23:47 +0000 (20:23 -0400)] 
t5406: use write_script() instead of birthing shell script manually

Take advantage of write_script() to abstract-away details of shell
script creation, thus allowing the reader to focus on script content.
Readability benefits, particularly in this case, since the script body
was buried in a noisy one-liner subshell responsible for emitting
boilerplate and body.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot5405: use test_must_fail() instead of checking exit code manually
Eric Sunshine [Mon, 2 Jul 2018 00:23:46 +0000 (20:23 -0400)] 
t5405: use test_must_fail() instead of checking exit code manually

This test expects "git push" to fail, thus it manually inverts that
local expected failure into a successful exit code for the test overall.
In doing so, it intentionally breaks the &&-chain. Modernize by
replacing manual exit code management with test_must_fail() and a normal
&&-chain.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot/lib-submodule-update: fix "absorbing" test
Eric Sunshine [Mon, 2 Jul 2018 00:23:45 +0000 (20:23 -0400)] 
t/lib-submodule-update: fix "absorbing" test

This test has been dysfunctional since it was added by 259f3ee296
(lib-submodule-update.sh: define tests for recursing into submodules,
2017-03-14), however, the problem went unnoticed due to a broken
&&-chain.

The test wants to verify that replacing a submodule containing a .git
directory will absorb the .git directory into the .git/modules/ of the
superproject, and then replace the working tree content appropriate to
the superproject. It is, therefore, incorrect to check if the
submodule content still exists since the submodule will have been
replaced by the content of the superproject.

Fix this by removing the submodule content check, which also happens
to be the line that broke the &&-chain.

While at it, fix broken &&-chains in a couple neighboring tests.

Helped-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot: drop unnecessary terminating semicolon in subshell
Eric Sunshine [Mon, 2 Jul 2018 00:23:44 +0000 (20:23 -0400)] 
t: drop unnecessary terminating semicolon in subshell

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot: use sane_unset() rather than 'unset' with broken &&-chain
Eric Sunshine [Mon, 2 Jul 2018 00:23:43 +0000 (20:23 -0400)] 
t: use sane_unset() rather than 'unset' with broken &&-chain

These tests intentionally break the &&-chain after using 'unset' since
they don't know if 'unset' will succeed or fail and don't want a local
'unset' failure to fail the test overall. We can do better by using
sane_unset(), which can be linked into the &&-chain as usual.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot: use test_write_lines() instead of series of 'echo' commands
Eric Sunshine [Mon, 2 Jul 2018 00:23:42 +0000 (20:23 -0400)] 
t: use test_write_lines() instead of series of 'echo' commands

These tests employ a noisy subshell (with missing &&-chain) to feed
input into Git commands or files:

    (echo a; echo b; echo c) | git some-command ...

Simplify by taking advantage of test_write_lines():

    test_write_lines a b c | git some-command ...

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot: use test_might_fail() instead of manipulating exit code manually
Eric Sunshine [Mon, 2 Jul 2018 00:23:41 +0000 (20:23 -0400)] 
t: use test_might_fail() instead of manipulating exit code manually

These tests manually coerce the exit code of invoked commands to
"success" when they don't care if the command succeeds or fails since
failure of those commands should not cause the test to fail overall.
In doing so, they intentionally break the &&-chain. Modernize by
replacing manual exit code management with test_might_fail() and a
normal &&-chain.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoSecond batch for 2.19 cycle
Junio C Hamano [Thu, 28 Jun 2018 19:55:47 +0000 (12:55 -0700)] 
Second batch for 2.19 cycle

Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoMerge branch 'sb/fix-fetching-moved-submodules'
Junio C Hamano [Thu, 28 Jun 2018 19:53:34 +0000 (12:53 -0700)] 
Merge branch 'sb/fix-fetching-moved-submodules'

The code to try seeing if a fetch is necessary in a submodule
during a fetch with --recurse-submodules got confused when the path
to the submodule was changed in the range of commits in the
superproject, sometimes showing "(null)".  This has been corrected.

* sb/fix-fetching-moved-submodules:
  t5526: test recursive submodules when fetching moved submodules
  submodule: fix NULL correctness in renamed broken submodules

6 years agoMerge branch 'tz/cred-netrc-cleanup'
Junio C Hamano [Thu, 28 Jun 2018 19:53:33 +0000 (12:53 -0700)] 
Merge branch 'tz/cred-netrc-cleanup'

Build and test procedure for netrc credential helper (in contrib/)
has been updated.

* tz/cred-netrc-cleanup:
  git-credential-netrc: make "all" default target of Makefile
  git-credential-netrc: fix exit status when tests fail
  git-credential-netrc: use in-tree Git.pm for tests
  git-credential-netrc: minor whitespace cleanup in test script

6 years agoMerge branch 'jc/clean-after-sanity-tests'
Junio C Hamano [Thu, 28 Jun 2018 19:53:33 +0000 (12:53 -0700)] 
Merge branch 'jc/clean-after-sanity-tests'

test cleanup.

* jc/clean-after-sanity-tests:
  tests: clean after SANITY tests

6 years agoMerge branch 'nd/completion-negation'
Junio C Hamano [Thu, 28 Jun 2018 19:53:32 +0000 (12:53 -0700)] 
Merge branch 'nd/completion-negation'

Continuing with the idea to programmatically enumerate various
pieces of data required for command line completion, the codebase
has been taught to enumerate options prefixed with "--no-" to
negate them.

* nd/completion-negation:
  completion: collapse extra --no-.. options
  completion: suppress some -no- options
  parse-options: option to let --git-completion-helper show negative form

6 years agoMerge branch 'pw/add-p-recount'
Junio C Hamano [Thu, 28 Jun 2018 19:53:32 +0000 (12:53 -0700)] 
Merge branch 'pw/add-p-recount'

When user edits the patch in "git add -p" and the user's editor is
set to strip trailing whitespaces indiscriminately, an empty line
that is unchanged in the patch would become completely empty
(instead of a line with a sole SP on it).  The code introduced in
Git 2.17 timeframe failed to parse such a patch, but now it learned
to notice the situation and cope with it.

* pw/add-p-recount:
  add -p: fix counting empty context lines in edited patches

6 years agoMerge branch 'jk/fetch-all-peeled-fix'
Junio C Hamano [Thu, 28 Jun 2018 19:53:32 +0000 (12:53 -0700)] 
Merge branch 'jk/fetch-all-peeled-fix'

"git fetch-pack --all" used to unnecessarily fail upon seeing an
annotated tag that points at an object other than a commit.

* jk/fetch-all-peeled-fix:
  fetch-pack: test explicitly that --all can fetch tag references pointing to non-commits
  fetch-pack: don't try to fetch peel values with --all

6 years agoMerge branch 'ms/send-pack-honor-config'
Junio C Hamano [Thu, 28 Jun 2018 19:53:30 +0000 (12:53 -0700)] 
Merge branch 'ms/send-pack-honor-config'

"git send-pack --signed" (hence "git push --signed" over the http
transport) did not read user ident from the config mechanism to
determine whom to sign the push certificate as, which has been
corrected.

* ms/send-pack-honor-config:
  builtin/send-pack: populate the default configs

6 years agoMerge branch 'jh/partial-clone'
Junio C Hamano [Thu, 28 Jun 2018 19:53:30 +0000 (12:53 -0700)] 
Merge branch 'jh/partial-clone'

The recent addition of "partial clone" experimental feature kicked
in when it shouldn't, namely, when there is no partial-clone filter
defined even if extensions.partialclone is set.

* jh/partial-clone:
  list-objects: check if filter is NULL before using

6 years agoMerge branch 'sg/gpg-tests-fix'
Junio C Hamano [Thu, 28 Jun 2018 19:53:29 +0000 (12:53 -0700)] 
Merge branch 'sg/gpg-tests-fix'

Some flaky tests have been fixed.

* sg/gpg-tests-fix:
  tests: make forging GPG signed commits and tags more robust
  t7510-signed-commit: use 'test_must_fail'

6 years agoMerge branch 'as/safecrlf-quiet-fix'
Junio C Hamano [Thu, 28 Jun 2018 19:53:29 +0000 (12:53 -0700)] 
Merge branch 'as/safecrlf-quiet-fix'

Fix for 2.17-era regression around `core.safecrlf`.

* as/safecrlf-quiet-fix:
  config.c: fix regression for core.safecrlf false

6 years agoMerge branch 'ab/refspec-init-fix'
Junio C Hamano [Thu, 28 Jun 2018 19:53:29 +0000 (12:53 -0700)] 
Merge branch 'ab/refspec-init-fix'

Make refspec parsing codepath more robust.

* ab/refspec-init-fix:
  refspec: initalize `refspec_item` in `valid_fetch_refspec()`
  refspec: add back a refspec_item_init() function
  refspec: s/refspec_item_init/&_or_die/g

6 years agoFirst batch for 2.19 cycle
Junio C Hamano [Mon, 25 Jun 2018 20:27:15 +0000 (13:27 -0700)] 
First batch for 2.19 cycle

Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoMerge branch 'sb/plug-misc-leaks'
Junio C Hamano [Mon, 25 Jun 2018 20:22:41 +0000 (13:22 -0700)] 
Merge branch 'sb/plug-misc-leaks'

Misc leak plugging.

* sb/plug-misc-leaks:
  sequencer.c: plug mem leak in git_sequencer_config
  sequencer.c: plug leaks in do_pick_commit
  submodule--helper: plug mem leak in print_default_remote
  refs/packed-backend.c: close fd of empty file

6 years agoMerge branch 'cc/tests-without-assuming-ref-files-backend'
Junio C Hamano [Mon, 25 Jun 2018 20:22:41 +0000 (13:22 -0700)] 
Merge branch 'cc/tests-without-assuming-ref-files-backend'

Instead of mucking with filesystem directly, use plumbing commands
update-ref etc. to manipulate the refs in the tests.

* cc/tests-without-assuming-ref-files-backend:
  t9104: kosherly remove remote refs

6 years agoMerge branch 'sg/update-ref-stdin-cleanup'
Junio C Hamano [Mon, 25 Jun 2018 20:22:40 +0000 (13:22 -0700)] 
Merge branch 'sg/update-ref-stdin-cleanup'

Code cleanup.

* sg/update-ref-stdin-cleanup:
  update-ref --stdin: use skip_prefix()

6 years agoMerge branch 'nd/reject-empty-shallow-request'
Junio C Hamano [Mon, 25 Jun 2018 20:22:40 +0000 (13:22 -0700)] 
Merge branch 'nd/reject-empty-shallow-request'

"git fetch --shallow-since=<cutoff>" that specifies the cut-off
point that is newer than the existing history used to end up
grabbing the entire history.  Such a request now errors out.

* nd/reject-empty-shallow-request:
  upload-pack: reject shallow requests that would return nothing

6 years agoMerge branch 'ls/complete-remote-update-names'
Junio C Hamano [Mon, 25 Jun 2018 20:22:39 +0000 (13:22 -0700)] 
Merge branch 'ls/complete-remote-update-names'

"git remote update" can take both a single remote nickname and a
nickname for remote groups, and the completion script (in contrib/)
has been taught about it.

* ls/complete-remote-update-names:
  completion: complete remote names too

6 years agoMerge branch 'ag/rebase-p'
Junio C Hamano [Mon, 25 Jun 2018 20:22:39 +0000 (13:22 -0700)] 
Merge branch 'ag/rebase-p'

Separate "rebase -p" codepath out of "rebase -i" implementation to
slim down the latter and make it easier to manage.

* ag/rebase-p:
  rebase: remove -p code from git-rebase--interactive.sh
  rebase: use the new git-rebase--preserve-merges.sh
  rebase: strip unused code in git-rebase--preserve-merges.sh
  rebase: introduce a dedicated backend for --preserve-merges

6 years agoMerge branch 'nd/complete-config-vars'
Junio C Hamano [Mon, 25 Jun 2018 20:22:38 +0000 (13:22 -0700)] 
Merge branch 'nd/complete-config-vars'

Continuing with the idea to programatically enumerate various
pieces of data required for command line completion, teach the
codebase to report the list of configuration variables
subcommands care about to help complete them.

* nd/complete-config-vars:
  completion: complete general config vars in two steps
  log-tree: allow to customize 'grafted' color
  completion: support case-insensitive config vars
  completion: keep other config var completion in camelCase
  completion: drop the hard coded list of config vars
  am: move advice.amWorkDir parsing back to advice.c
  advice: keep config name in camelCase in advice_config[]
  fsck: produce camelCase config key names
  help: add --config to list all available config
  fsck: factor out msg_id_info[] lazy initialization code
  grep: keep all colors in an array
  Add and use generic name->id mapping code for color slot parsing

6 years agoMerge branch 'sb/object-store-alloc'
Junio C Hamano [Mon, 25 Jun 2018 20:22:38 +0000 (13:22 -0700)] 
Merge branch 'sb/object-store-alloc'

The conversion to pass "the_repository" and then "a_repository"
throughout the object access API continues.

* sb/object-store-alloc:
  alloc: allow arbitrary repositories for alloc functions
  object: allow create_object to handle arbitrary repositories
  object: allow grow_object_hash to handle arbitrary repositories
  alloc: add repository argument to alloc_commit_index
  alloc: add repository argument to alloc_report
  alloc: add repository argument to alloc_object_node
  alloc: add repository argument to alloc_tag_node
  alloc: add repository argument to alloc_commit_node
  alloc: add repository argument to alloc_tree_node
  alloc: add repository argument to alloc_blob_node
  object: add repository argument to grow_object_hash
  object: add repository argument to create_object
  repository: introduce parsed objects field

6 years agoMerge branch 'jk/show-index'
Junio C Hamano [Mon, 25 Jun 2018 20:22:37 +0000 (13:22 -0700)] 
Merge branch 'jk/show-index'

Modernize a less often used command.

* jk/show-index:
  show-index: update documentation for index v2
  make show-index a builtin

6 years agoMerge branch 'en/merge-recursive-tests'
Junio C Hamano [Mon, 25 Jun 2018 20:22:36 +0000 (13:22 -0700)] 
Merge branch 'en/merge-recursive-tests'

Clean up tests in t6xxx series about 'merge' command.

* en/merge-recursive-tests:
  t6036: prefer test_when_finished to manual cleanup in following test
  t6036, t6042: prefer test_cmp to sequences of test
  t6036, t6042: prefer test_path_is_file, test_path_is_missing
  t6036, t6042: use test_line_count instead of wc -l
  t6036, t6042: use test_create_repo to keep tests independent

6 years agoMerge branch 'nd/diff-apply-ita'
Junio C Hamano [Mon, 25 Jun 2018 20:22:36 +0000 (13:22 -0700)] 
Merge branch 'nd/diff-apply-ita'

"git diff" compares the index and the working tree.  For paths
added with intent-to-add bit, the command shows the full contents
of them as added, but the paths themselves were not marked as new
files.  They are now shown as new by default.

"git apply" learned the "--intent-to-add" option so that an
otherwise working-tree-only application of a patch will add new
paths to the index marked with the "intent-to-add" bit.

* nd/diff-apply-ita:
  apply: add --intent-to-add
  t2203: add a test about "diff HEAD" case
  diff: turn --ita-invisible-in-index on by default
  diff: ignore --ita-[in]visible-in-index when diffing worktree-to-tree

6 years agoMerge branch 'ds/commit-graph-lockfile-fix'
Junio C Hamano [Mon, 25 Jun 2018 20:22:36 +0000 (13:22 -0700)] 
Merge branch 'ds/commit-graph-lockfile-fix'

Update to ds/generation-numbers topic.

* ds/commit-graph-lockfile-fix:
  commit-graph: fix UX issue when .lock file exists
  commit-graph.txt: update design document
  merge: check config before loading commits
  commit: use generation number in remove_redundant()
  commit: add short-circuit to paint_down_to_common()
  commit: use generation numbers for in_merge_bases()
  ref-filter: use generation number for --contains
  commit-graph: always load commit-graph information
  commit: use generations in paint_down_to_common()
  commit-graph: compute generation numbers
  commit: add generation number to struct commit
  ref-filter: fix outdated comment on in_commit_list

6 years agoMerge branch 'nd/commit-util-to-slab'
Junio C Hamano [Mon, 25 Jun 2018 20:22:35 +0000 (13:22 -0700)] 
Merge branch 'nd/commit-util-to-slab'

The in-core "commit" object had an all-purpose "void *util" field,
which was tricky to use especially in library-ish part of the
code.  All of the existing uses of the field has been migrated to a
more dedicated "commit-slab" mechanism and the field is eliminated.

* nd/commit-util-to-slab:
  commit.h: delete 'util' field in struct commit
  merge: use commit-slab in merge remote desc instead of commit->util
  log: use commit-slab in prepare_bases() instead of commit->util
  show-branch: note about its object flags usage
  show-branch: use commit-slab for commit-name instead of commit->util
  name-rev: use commit-slab for rev-name instead of commit->util
  bisect.c: use commit-slab for commit weight instead of commit->util
  revision.c: use commit-slab for show_source
  sequencer.c: use commit-slab to associate todo items to commits
  sequencer.c: use commit-slab to mark seen commits
  shallow.c: use commit-slab for commit depth instead of commit->util
  describe: use commit-slab for commit names instead of commit->util
  blame: use commit-slab for blame suspects instead of commit->util
  commit-slab: support shared commit-slab
  commit-slab.h: code split

6 years agoMerge branch 'pc/submodule-helper-foreach'
Junio C Hamano [Mon, 25 Jun 2018 20:22:35 +0000 (13:22 -0700)] 
Merge branch 'pc/submodule-helper-foreach'

The bulk of "git submodule foreach" has been rewritten in C.

* pc/submodule-helper-foreach:
  submodule: port submodule subcommand 'foreach' from shell to C
  submodule foreach: document variable '$displaypath'
  submodule foreach: document '$sm_path' instead of '$path'
  submodule foreach: correct '$path' in nested submodules from a subdirectory

6 years agoPrepare to start 2.19 cycle
Junio C Hamano [Mon, 25 Jun 2018 20:22:27 +0000 (13:22 -0700)] 
Prepare to start 2.19 cycle

Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agosequencer.c: plug mem leak in git_sequencer_config
Stefan Beller [Fri, 1 Jun 2018 20:01:46 +0000 (13:01 -0700)] 
sequencer.c: plug mem leak in git_sequencer_config

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoGit 2.18 v2.18.0
Junio C Hamano [Thu, 21 Jun 2018 17:00:06 +0000 (10:00 -0700)] 
Git 2.18

Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoMerge branch 'en/rename-directory-detection-reboot'
Junio C Hamano [Tue, 19 Jun 2018 18:11:03 +0000 (11:11 -0700)] 
Merge branch 'en/rename-directory-detection-reboot'

* en/rename-directory-detection-reboot:
  merge-recursive: use xstrdup() instead of fixed buffer

6 years agoMerge tag 'l10n-2.18.0-rnd3.1' of git://github.com/git-l10n/git-po
Junio C Hamano [Tue, 19 Jun 2018 16:29:23 +0000 (09:29 -0700)] 
Merge tag 'l10n-2.18.0-rnd3.1' of git://github.com/git-l10n/git-po

Merge Korean translation for l10n of Git 2.18.0 round 3

* tag 'l10n-2.18.0-rnd3.1' of git://github.com/git-l10n/git-po:
  l10n: ko.po: Update Korean translation

6 years agoMerge branch 'cf/submodule-progress-dissociate'
Junio C Hamano [Tue, 19 Jun 2018 16:26:59 +0000 (09:26 -0700)] 
Merge branch 'cf/submodule-progress-dissociate'

* cf/submodule-progress-dissociate:
  t7400: encapsulate setup code in test_expect_success

6 years agoMerge branch 'js/rebase-i-root-fix'
Junio C Hamano [Tue, 19 Jun 2018 16:26:28 +0000 (09:26 -0700)] 
Merge branch 'js/rebase-i-root-fix'

* js/rebase-i-root-fix:
  t3404: check root commit in 'rebase -i --root reword root commit'

6 years agot7400: encapsulate setup code in test_expect_success
Stefan Beller [Mon, 18 Jun 2018 23:41:48 +0000 (16:41 -0700)] 
t7400: encapsulate setup code in test_expect_success

When running t7400 in a shell you observe more output than expected:

    ...
    ok 8 - setup - hide init subdirectory
    ok 9 - setup - repository to add submodules to
    ok 10 - submodule add
    [master (root-commit) d79ce16] one
     Author: A U Thor <author@example.com>
     1 file changed, 1 insertion(+)
     create mode 100644 one.t
    ok 11 - redirected submodule add does not show progress
    ok 12 - redirected submodule add --progress does show progress
    ok 13 - submodule add to .gitignored path fails
    ...

Fix the output by encapsulating the setup code in test_expect_success

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot3404: check root commit in 'rebase -i --root reword root commit'
Todd Zullinger [Mon, 18 Jun 2018 22:19:42 +0000 (18:19 -0400)] 
t3404: check root commit in 'rebase -i --root reword root commit'

When testing a reworded root commit, ensure that the squash-onto commit
which is created and amended is still the root commit.

Suggested-by: Phillip Wood <phillip.wood@talktalk.net>
Helped-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Todd Zullinger <tmz@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agodoc: fix typos in documentation and release notes
Karthikeyan Singaravelan [Sun, 17 Jun 2018 04:35:54 +0000 (04:35 +0000)] 
doc: fix typos in documentation and release notes

Signed-off-by: Karthikeyan Singaravelan <tir.karthi@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agogit-credential-netrc: make "all" default target of Makefile
Todd Zullinger [Wed, 13 Jun 2018 03:10:36 +0000 (23:10 -0400)] 
git-credential-netrc: make "all" default target of Makefile

Running "make" in contrib/credential/netrc should run the "all" target
rather than the "test" target.  Add an empty "all::" target like most of
our other Makefiles.

Signed-off-by: Todd Zullinger <tmz@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoAlmost 2.18 final
Junio C Hamano [Mon, 18 Jun 2018 18:24:21 +0000 (11:24 -0700)] 
Almost 2.18 final

Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoMerge branch 'es/make-no-iconv'
Junio C Hamano [Mon, 18 Jun 2018 18:23:24 +0000 (11:23 -0700)] 
Merge branch 'es/make-no-iconv'

"make NO_ICONV=NoThanks" did not override NEEDS_LIBICONV
(i.e. linkage of -lintl, -liconv, etc. that are platform-specific
tweaks), which has been corrected.

* es/make-no-iconv:
  Makefile: make NO_ICONV really mean "no iconv"

6 years agoMerge branch 'sg/t7406-chain-fix'
Junio C Hamano [Mon, 18 Jun 2018 18:23:23 +0000 (11:23 -0700)] 
Merge branch 'sg/t7406-chain-fix'

Test fix.

* sg/t7406-chain-fix:
  t7406-submodule-update: fix broken &&-chains

6 years agoMerge branch 'ks/branch-set-upstream'
Junio C Hamano [Mon, 18 Jun 2018 18:23:23 +0000 (11:23 -0700)] 
Merge branch 'ks/branch-set-upstream'

A test title has been reworded to clarify it.

* ks/branch-set-upstream:
  t3200: clarify description of --set-upstream test

6 years agoMerge branch 'js/rebase-i-root-fix'
Junio C Hamano [Mon, 18 Jun 2018 18:23:22 +0000 (11:23 -0700)] 
Merge branch 'js/rebase-i-root-fix'

A regression to "rebase -i --root" introduced during this cycle has
been fixed.

* js/rebase-i-root-fix:
  rebase --root: fix amending root commit messages
  rebase --root: demonstrate a bug while amending root commit messages

6 years agoMerge branch 'jk/ewah-bounds-check'
Junio C Hamano [Mon, 18 Jun 2018 18:23:22 +0000 (11:23 -0700)] 
Merge branch 'jk/ewah-bounds-check'

The code to read compressed bitmap was not careful to avoid reading
past the end of the file, which has been corrected.

* jk/ewah-bounds-check:
  ewah: adjust callers of ewah_read_mmap()
  ewah_read_mmap: bounds-check mmap reads

6 years agoMerge tag 'l10n-2.18.0-rnd3' of git://github.com/git-l10n/git-po
Junio C Hamano [Mon, 18 Jun 2018 17:21:24 +0000 (10:21 -0700)] 
Merge tag 'l10n-2.18.0-rnd3' of git://github.com/git-l10n/git-po

l10n for Git 2.18.0 round 3

* tag 'l10n-2.18.0-rnd3' of git://github.com/git-l10n/git-po:
  l10n: zh_CN: for git v2.18.0 l10n round 1 to 3
  l10n: bg.po: Updated Bulgarian translation (3608t)
  l10n: vi.po(3608t): Update Vietnamese translation for v2.18.0 round 3
  l10n: fr.po v2.18.0 round 3
  l10n: es.po: Spanish update for v2.18.0 round 3
  l10n: git.pot: v2.18.0 round 3 (1 new, 1 removed)
  l10n: vi.po(3608t): Update Vietnamese translation for v2.18.0 round2
  l10n: bg.po: Updated Bulgarian translation (3608t)
  l10n: es.po: Spanish update for v2.18.0 round 2
  l10n: sv.po: Update Swedish translation (3608t0f0u)
  l10n: sv.po: Update Swedish translation (3470t0f0u)
  l10n: git.pot: v2.18.0 round 2 (144 new, 6 removed)
  l10n: fr.po v2.18 round 1
  l10n: vi(3470t): Updated Vietnamese translation for v2.18.0
  l10n: es.po: Spanish update for v2.18.0 round 1
  l10n: git.pot: v2.18.0 round 1 (108 new, 14 removed)
  l10n: TEAMS: remove inactive de team members
  l10n: de.po: fix typos
  l10n: Update Catalan translation

6 years agoA bunch of micro-fixes before going 2.18 final
Junio C Hamano [Mon, 18 Jun 2018 17:20:42 +0000 (10:20 -0700)] 
A bunch of micro-fixes before going 2.18 final

Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agol10n: ko.po: Update Korean translation
Changwoo Ryu [Mon, 18 Jun 2018 17:07:46 +0000 (02:07 +0900)] 
l10n: ko.po: Update Korean translation

Update the Korean translation and change the team leader to Gwan-gyeong
Mun.

Signed-off-by: Gwan-gyeong Mun <elongbug@gmail.com>
Signed-off-by: Changwoo Ryu <cwryu@debian.org>
Reviewed-by: Gwan-gyeong Mun <elongbug@gmail.com>
6 years agoMerge branch 'sb/blame-color'
Junio C Hamano [Mon, 18 Jun 2018 17:18:45 +0000 (10:18 -0700)] 
Merge branch 'sb/blame-color'

Leakfix.

* sb/blame-color:
  blame: release string_list after use in parse_color_fields()

6 years agoMerge branch 'mw/doc-merge-enumfix'
Junio C Hamano [Mon, 18 Jun 2018 17:18:45 +0000 (10:18 -0700)] 
Merge branch 'mw/doc-merge-enumfix'

Fix old merge glitch in Documentation during v2.13-rc0 era.

* mw/doc-merge-enumfix:
  doc: update the order of the syntax `git merge --continue`

6 years agoMerge branch 'en/rename-directory-detection'
Junio C Hamano [Mon, 18 Jun 2018 17:18:44 +0000 (10:18 -0700)] 
Merge branch 'en/rename-directory-detection'

Newly added codepath in merge-recursive had potential buffer
overrun, which has been fixed.

* en/rename-directory-detection:
  merge-recursive: use xstrdup() instead of fixed buffer

6 years agoMerge branch 'rd/doc-remote-tracking-with-hyphen'
Junio C Hamano [Mon, 18 Jun 2018 17:18:43 +0000 (10:18 -0700)] 
Merge branch 'rd/doc-remote-tracking-with-hyphen'

Doc update.

* rd/doc-remote-tracking-with-hyphen:
  Use hyphenated "remote-tracking branch" (docs and comments)

6 years agoMerge branch 'jl/zlib-restore-nul-termination'
Junio C Hamano [Mon, 18 Jun 2018 17:18:43 +0000 (10:18 -0700)] 
Merge branch 'jl/zlib-restore-nul-termination'

Make zlib inflate codepath more robust against versions of zlib
that clobber unused portion of outbuf.

* jl/zlib-restore-nul-termination:
  packfile: correct zlib buffer handling

6 years agoMerge branch 'ab/cred-netrc-no-autodie'
Junio C Hamano [Mon, 18 Jun 2018 17:18:42 +0000 (10:18 -0700)] 
Merge branch 'ab/cred-netrc-no-autodie'

Hotfix for contrib/ stuff broken by this cycle.

* ab/cred-netrc-no-autodie:
  git-credential-netrc: remove use of "autodie"

6 years agoMerge branch 'km/doc-workflows-typofix'
Junio C Hamano [Mon, 18 Jun 2018 17:18:42 +0000 (10:18 -0700)] 
Merge branch 'km/doc-workflows-typofix'

Typofix.

* km/doc-workflows-typofix:
  gitworkflows: fix grammar in 'Merge upwards' rule

6 years agoMerge branch 'ld/git-p4-updates'
Junio C Hamano [Mon, 18 Jun 2018 17:18:41 +0000 (10:18 -0700)] 
Merge branch 'ld/git-p4-updates'

"git p4" updates.

* ld/git-p4-updates:
  git-p4: auto-size the block
  git-p4: narrow the scope of exceptions caught when parsing an int
  git-p4: raise exceptions from p4CmdList based on error from p4 server
  git-p4: better error reporting when p4 fails
  git-p4: add option to disable syncing of p4/master with p4
  git-p4: disable-rebase: allow setting this via configuration
  git-p4: add options --commit and --disable-rebase

6 years agoMerge branch 'rd/diff-options-typofix'
Junio C Hamano [Mon, 18 Jun 2018 17:18:41 +0000 (10:18 -0700)] 
Merge branch 'rd/diff-options-typofix'

Typofix.

* rd/diff-options-typofix:
  diff-options.txt: fix minor typos, font inconsistencies, in docs

6 years agoMerge branch 'rd/comment-typofix-in-sha1-file'
Junio C Hamano [Mon, 18 Jun 2018 17:18:40 +0000 (10:18 -0700)] 
Merge branch 'rd/comment-typofix-in-sha1-file'

In code comment typofix

* rd/comment-typofix-in-sha1-file:
  sha1-file.c: correct $GITDIR to $GIT_DIR in a comment

6 years agomerge-recursive: use xstrdup() instead of fixed buffer
René Scharfe [Sun, 10 Jun 2018 10:56:31 +0000 (12:56 +0200)] 
merge-recursive: use xstrdup() instead of fixed buffer

Paths can be longer than PATH_MAX.  Avoid a buffer overrun in
check_dir_renamed() by using xstrdup() to make a private copy safely.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoRelNotes 2.18: minor fix to entry about dynamically loading completions
SZEDER Gábor [Mon, 18 Jun 2018 10:46:09 +0000 (12:46 +0200)] 
RelNotes 2.18: minor fix to entry about dynamically loading completions

It was not "newer versions of bash" but newer versions of
bash-completion that made commit 085e2ee0e6 (completion: load
completion file for external subcommand, 2018-04-29) both necessary
and possible.

Update the corresponding RelNotes entry accordingly.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot7406-submodule-update: fix broken &&-chains
SZEDER Gábor [Sat, 16 Jun 2018 20:33:19 +0000 (22:33 +0200)] 
t7406-submodule-update: fix broken &&-chains

Three tests in 't7406-submodule-update' contain broken &&-chains, but
since they are all in subshells, chain-lint couldn't notice them.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agorebase --root: fix amending root commit messages
Johannes Schindelin [Sat, 16 Jun 2018 19:00:38 +0000 (21:00 +0200)] 
rebase --root: fix amending root commit messages

The code path that triggered that "BUG" really does not want to run
without an explicit commit message. In the case where we want to amend a
commit message, we have an *implicit* commit message, though: the one of
the commit to amend. Therefore, this code path should not even be
entered.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agorebase --root: demonstrate a bug while amending root commit messages
Todd Zullinger [Fri, 15 Jun 2018 04:31:11 +0000 (00:31 -0400)] 
rebase --root: demonstrate a bug while amending root commit messages

When splitting a repository, running `git rebase -i --root` to reword
the initial commit, Git dies with

BUG: sequencer.c:795: root commit without message.

Signed-off-by: Todd Zullinger <tmz@pobox.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoewah: adjust callers of ewah_read_mmap()
Jeff King [Fri, 15 Jun 2018 03:44:43 +0000 (23:44 -0400)] 
ewah: adjust callers of ewah_read_mmap()

The return value of ewah_read_mmap() is now an ssize_t,
since we could (in theory) process up to 32GB of data. This
would never happen in practice, but a corrupt or malicious
.bitmap or index file could convince us to do so.

Let's make sure that we don't stuff the value into an int,
which would cause us to incorrectly move our pointer
forward.  We'd always move too little, since negative values
are used for reporting errors. So the worst case is just
that we end up reporting a corrupt file, not an
out-of-bounds read.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoewah_read_mmap: bounds-check mmap reads
Jeff King [Fri, 15 Jun 2018 03:31:13 +0000 (23:31 -0400)] 
ewah_read_mmap: bounds-check mmap reads

The on-disk ewah format tells us how big the ewah data is,
and we blindly read that much from the buffer without
considering whether the mmap'd data is long enough, which
can lead to out-of-bound reads.

Let's make sure we have data available before reading it,
both for the ewah header/footer as well as for the bit data
itself. In particular:

  - keep our ptr/len pair in sync as we move through the
    buffer, and check it before each read

  - check the size for integer overflow (this should be
    impossible on 64-bit, as the size is given as a 32-bit
    count of 8-byte words, but is possible on a 32-bit
    system)

  - return the number of bytes read as an ssize_t instead of
    an int, again to prevent integer overflow

  - compute the return value using a pointer difference;
    this should yield the same result as the existing code,
    but makes it more obvious that we got our computations
    right

The included test is far from comprehensive, as it just
picks a static point at which to truncate the generated
bitmap. But in practice this will hit in the middle of an
ewah and make sure we're at least exercising this code.

Reported-by: Luat Nguyen <root@l4w.io>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot3200: clarify description of --set-upstream test
Kaartic Sivaraam [Sun, 17 Jun 2018 11:56:27 +0000 (17:26 +0530)] 
t3200: clarify description of --set-upstream test

Support for the --set-upstream option was removed in 52668846ea
(builtin/branch: stop supporting the "--set-upstream" option,
2017-08-17). The change did not completely remove the command
due to an issue noted in the commit's log message.

So, a test was added to ensure that a command which uses the
'--set-upstream' option fails instead of silently acting as an alias
for the '--set-upstream-to' option due to option parsing features.

To avoid confusion, clarify that the option is disabled intentionally
in the corresponding test description.

The test is expected to be around as long as we intentionally fail
on seeing the '--set-upstream' option which in turn we expect to
do for a period of time after which we can be sure that existing
users of '--set-upstream' are aware that the option is no
longer supported.

Signed-off-by: Kaartic Sivaraam <kaartic.sivaraam@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agogit-credential-netrc: fix exit status when tests fail
Luis Marsano [Wed, 13 Jun 2018 03:10:39 +0000 (23:10 -0400)] 
git-credential-netrc: fix exit status when tests fail

Signed-off-by: Luis Marsano <luis.marsano@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>