]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
4 years agoMerge branch 'jk/test-cleanup'
Junio C Hamano [Wed, 22 Apr 2020 20:42:44 +0000 (13:42 -0700)] 
Merge branch 'jk/test-cleanup'

Test cleanup.

* jk/test-cleanup:
  t/lib-*.sh: drop executable bit
  t/lib-credential.sh: drop shebang line

4 years agoMerge branch 'ak/run-command-on-cygwin-fix'
Junio C Hamano [Wed, 22 Apr 2020 20:42:44 +0000 (13:42 -0700)] 
Merge branch 'ak/run-command-on-cygwin-fix'

Utitiles run via the run_command() API were not spawned correctly
on Cygwin, when the paths to them are given as a full path with
backslashes.

* ak/run-command-on-cygwin-fix:
  run-command: trigger PATH lookup properly on Cygwin

4 years agoMerge branch 'dr/midx-avoid-int-underflow'
Junio C Hamano [Wed, 22 Apr 2020 20:42:44 +0000 (13:42 -0700)] 
Merge branch 'dr/midx-avoid-int-underflow'

When fed a midx that records no objects, some codepaths tried to
loop from 0 through (num_objects-1), which, due to integer
arithmetic wrapping around, made it nonsense operation with out of
bounds array accesses.  The code has been corrected to reject such
an midx file.

* dr/midx-avoid-int-underflow:
  midx.c: fix an integer underflow

4 years agoMerge branch 'dl/test-must-fail-fixes-3'
Junio C Hamano [Wed, 22 Apr 2020 20:42:44 +0000 (13:42 -0700)] 
Merge branch 'dl/test-must-fail-fixes-3'

Test clean-up continues.

* dl/test-must-fail-fixes-3:
  t5801: teach compare_refs() to accept !
  t5612: stop losing return codes of git commands
  t5612: don't use `test_must_fail test_cmp`
  t5607: reorder `nongit test_must_fail`
  t5550: simplify no matching line check
  t5512: stop losing return codes of git commands
  t5512: stop losing git exit code in here-docs
  t5512: don't use `test_must_fail test_cmp`

4 years agoMerge branch 'js/trace2-env-vars'
Junio C Hamano [Wed, 22 Apr 2020 20:42:43 +0000 (13:42 -0700)] 
Merge branch 'js/trace2-env-vars'

Trace2 enhancement to allow logging of the environment variables.

* js/trace2-env-vars:
  trace2: teach Git to log environment variables

4 years agoMerge branch 'jt/connectivity-check-optim-in-partial-clone'
Junio C Hamano [Wed, 22 Apr 2020 20:42:43 +0000 (13:42 -0700)] 
Merge branch 'jt/connectivity-check-optim-in-partial-clone'

Simplify the commit ancestry connectedness check in a partial clone
repository in which "promised" objects are assumed to be obtainable
lazily on-demand from promisor remote repositories.

* jt/connectivity-check-optim-in-partial-clone:
  connected: always use partial clone optimization

4 years agoMerge branch 'bc/faq'
Junio C Hamano [Wed, 22 Apr 2020 20:42:43 +0000 (13:42 -0700)] 
Merge branch 'bc/faq'

Doc update.

* bc/faq:
  docs: add a FAQ

4 years agoMerge branch 'bk/p4-pre-edit-changelist'
Junio C Hamano [Wed, 22 Apr 2020 20:42:43 +0000 (13:42 -0700)] 
Merge branch 'bk/p4-pre-edit-changelist'

"git p4" learned four new hooks and also "--no-verify" option to
bypass them (and the existing "p4-pre-submit" hook).

* bk/p4-pre-edit-changelist:
  git-p4: add RCS keyword status message
  git-p4: add p4 submit hooks
  git-p4: restructure code in submit
  git-p4: add --no-verify option
  git-p4: add p4-pre-submit exit text
  git-p4: create new function run_git_hook
  git-p4: rewrite prompt to be Windows compatible

4 years agoMerge branch 'mt/test-lib-bundled-short-options'
Junio C Hamano [Wed, 22 Apr 2020 20:42:43 +0000 (13:42 -0700)] 
Merge branch 'mt/test-lib-bundled-short-options'

Minor test usability improvement.

* mt/test-lib-bundled-short-options:
  test-lib: allow short options to be bundled

4 years agoMerge branch 'js/import-tars-do-not-make-phony-files-from-pax-headers'
Junio C Hamano [Wed, 22 Apr 2020 20:42:43 +0000 (13:42 -0700)] 
Merge branch 'js/import-tars-do-not-make-phony-files-from-pax-headers'

The import-tars importer (in contrib/fast-import/) used to create
phony files at the top-level of the repository when the archive
contains global PAX headers, which made its own logic to detect and
omit the common leading directory ineffective, which has been
corrected.

* js/import-tars-do-not-make-phony-files-from-pax-headers:
  import-tars: ignore the global PAX header

4 years agoMerge branch 'js/test-junit-finalization-fix'
Junio C Hamano [Wed, 22 Apr 2020 20:42:43 +0000 (13:42 -0700)] 
Merge branch 'js/test-junit-finalization-fix'

Test fix.

* js/test-junit-finalization-fix:
  tests(junit-xml): avoid invalid XML

4 years agoMerge branch 'js/tests-gpg-integration-on-windows'
Junio C Hamano [Wed, 22 Apr 2020 20:42:42 +0000 (13:42 -0700)] 
Merge branch 'js/tests-gpg-integration-on-windows'

Enable tests that require GnuPG on Windows.

* js/tests-gpg-integration-on-windows:
  tests: increase the verbosity of the GPG-related prereqs
  tests: turn GPG, GPGSM and RFC1991 into lazy prereqs
  tests: do not let lazy prereqs inside `test_expect_*` turn off tracing
  t/lib-gpg.sh: stop pretending to be a stand-alone script
  tests(gpg): allow the gpg-agent to start on Windows

4 years agoMerge branch 'jk/t3419-drop-expensive-tests'
Junio C Hamano [Wed, 22 Apr 2020 20:42:42 +0000 (13:42 -0700)] 
Merge branch 'jk/t3419-drop-expensive-tests'

Test update.

* jk/t3419-drop-expensive-tests:
  t3419: drop EXPENSIVE tests

4 years agoMerge branch 'ds/doc-clone-filter'
Junio C Hamano [Wed, 22 Apr 2020 20:42:42 +0000 (13:42 -0700)] 
Merge branch 'ds/doc-clone-filter'

Doc update.

* ds/doc-clone-filter:
  clone: document --filter options

4 years agoMerge branch 'ar/test-style-fixes'
Junio C Hamano [Wed, 22 Apr 2020 20:42:42 +0000 (13:42 -0700)] 
Merge branch 'ar/test-style-fixes'

Style fixes.

* ar/test-style-fixes:
  t: fix whitespace around &&
  t9500: remove spaces after redirect operators

4 years agoSync with 2.26.2
Junio C Hamano [Mon, 20 Apr 2020 05:05:56 +0000 (22:05 -0700)] 
Sync with 2.26.2

4 years agoGit 2.26.2 v2.26.2
Jonathan Nieder [Sun, 19 Apr 2020 23:32:24 +0000 (16:32 -0700)] 
Git 2.26.2

This merges up the security fix from v2.17.5.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
4 years agoGit 2.25.4 v2.25.4
Jonathan Nieder [Sun, 19 Apr 2020 23:31:07 +0000 (16:31 -0700)] 
Git 2.25.4

This merges up the security fix from v2.17.5.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
4 years agoGit 2.24.3 v2.24.3
Jonathan Nieder [Sun, 19 Apr 2020 23:30:34 +0000 (16:30 -0700)] 
Git 2.24.3

This merges up the security fix from v2.17.5.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
4 years agoGit 2.23.3 v2.23.3
Jonathan Nieder [Sun, 19 Apr 2020 23:30:27 +0000 (16:30 -0700)] 
Git 2.23.3

This merges up the security fix from v2.17.5.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
4 years agoGit 2.22.4 v2.22.4
Jonathan Nieder [Sun, 19 Apr 2020 23:30:19 +0000 (16:30 -0700)] 
Git 2.22.4

This merges up the security fix from v2.17.5.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
4 years agoGit 2.21.3 v2.21.3
Jonathan Nieder [Sun, 19 Apr 2020 23:30:08 +0000 (16:30 -0700)] 
Git 2.21.3

This merges up the security fix from v2.17.5.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
4 years agoGit 2.20.4 v2.20.4
Jonathan Nieder [Sun, 19 Apr 2020 23:28:57 +0000 (16:28 -0700)] 
Git 2.20.4

This merges up the security fix from v2.17.5.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
4 years agoGit 2.19.5 v2.19.5
Jonathan Nieder [Sun, 19 Apr 2020 23:26:41 +0000 (16:26 -0700)] 
Git 2.19.5

This merges up the security fix from v2.17.5.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
4 years agoGit 2.18.4 v2.18.4
Jonathan Nieder [Sun, 19 Apr 2020 23:24:14 +0000 (16:24 -0700)] 
Git 2.18.4

This merges up the security fix from v2.17.5.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
4 years agoGit 2.17.5 v2.17.5
Jeff King [Sun, 19 Apr 2020 06:34:55 +0000 (02:34 -0400)] 
Git 2.17.5

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
4 years agofsck: reject URL with empty host in .gitmodules
Jonathan Nieder [Sun, 19 Apr 2020 03:57:22 +0000 (20:57 -0700)] 
fsck: reject URL with empty host in .gitmodules

Git's URL parser interprets

https:///example.com/repo.git

to have no host and a path of "example.com/repo.git".  Curl, on the
other hand, internally redirects it to https://example.com/repo.git.  As
a result, until "credential: parse URL without host as empty host, not
unset", tricking a user into fetching from such a URL would cause Git to
send credentials for another host to example.com.

Teach fsck to block and detect .gitmodules files using such a URL to
prevent sharing them with Git versions that are not yet protected.

A relative URL in a .gitmodules file could also be used to trigger this.
The relative URL resolver used for .gitmodules does not normalize
sequences of slashes and can follow ".." components out of the path part
and to the host part of a URL, meaning that such a relative URL can be
used to traverse from a https://foo.example.com/innocent superproject to
a https:///attacker.example.com/exploit submodule. Fortunately,
redundant extra slashes in .gitmodules are rare, so we can catch this by
detecting one after a leading sequence of "./" and "../" components.

Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Reviewed-by: Jeff King <peff@peff.net>
4 years agocredential: treat URL with empty scheme as invalid
Jonathan Nieder [Sun, 19 Apr 2020 03:54:57 +0000 (20:54 -0700)] 
credential: treat URL with empty scheme as invalid

Until "credential: refuse to operate when missing host or protocol",
Git's credential handling code interpreted URLs with empty scheme to
mean "give me credentials matching this host for any protocol".

Luckily libcurl does not recognize such URLs (it tries to look for a
protocol named "" and fails). Just in case that changes, let's reject
them within Git as well. This way, credential_from_url is guaranteed to
always produce a "struct credential" with protocol and host set.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
4 years agocredential: treat URL without scheme as invalid
Jonathan Nieder [Sun, 19 Apr 2020 03:54:13 +0000 (20:54 -0700)] 
credential: treat URL without scheme as invalid

libcurl permits making requests without a URL scheme specified.  In
this case, it guesses the URL from the hostname, so I can run

git ls-remote http::ftp.example.com/path/to/repo

and it would make an FTP request.

Any user intentionally using such a URL is likely to have made a typo.
Unfortunately, credential_from_url is not able to determine the host and
protocol in order to determine appropriate credentials to send, and
until "credential: refuse to operate when missing host or protocol",
this resulted in another host's credentials being leaked to the named
host.

Teach credential_from_url_gently to consider such a URL to be invalid
so that fsck can detect and block gitmodules files with such URLs,
allowing server operators to avoid serving them to downstream users
running older versions of Git.

This also means that when such URLs are passed on the command line, Git
will print a clearer error so affected users can switch to the simpler
URL that explicitly specifies the host and protocol they intend.

One subtlety: .gitmodules files can contain relative URLs, representing
a URL relative to the URL they were cloned from.  The relative URL
resolver used for .gitmodules can follow ".." components out of the path
part and past the host part of a URL, meaning that such a relative URL
can be used to traverse from a https://foo.example.com/innocent
superproject to a https::attacker.example.com/exploit submodule.
Fortunately a leading ':' in the first path component after a series of
leading './' and '../' components is unlikely to show up in other
contexts, so we can catch this by detecting that pattern.

Reported-by: Jeff King <peff@peff.net>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Reviewed-by: Jeff King <peff@peff.net>
4 years agocredential: die() when parsing invalid urls
Jeff King [Sun, 19 Apr 2020 03:53:09 +0000 (20:53 -0700)] 
credential: die() when parsing invalid urls

When we try to initialize credential loading by URL and find that the
URL is invalid, we set all fields to NULL in order to avoid acting on
malicious input. Later when we request credentials, we diagonse the
erroneous input:

fatal: refusing to work with credential missing host field

This is problematic in two ways:

- The message doesn't tell the user *why* we are missing the host
  field, so they can't tell from this message alone how to recover.
  There can be intervening messages after the original warning of
  bad input, so the user may not have the context to put two and two
  together.

- The error only occurs when we actually need to get a credential.  If
  the URL permits anonymous access, the only encouragement the user gets
  to correct their bogus URL is a quiet warning.

  This is inconsistent with the check we perform in fsck, where any use
  of such a URL as a submodule is an error.

When we see such a bogus URL, let's not try to be nice and continue
without helpers. Instead, die() immediately. This is simpler and
obviously safe. And there's very little chance of disrupting a normal
workflow.

It's _possible_ that somebody has a legitimate URL with a raw newline in
it. It already wouldn't work with credential helpers, so this patch
steps that up from an inconvenience to "we will refuse to work with it
at all". If such a case does exist, we should figure out a way to work
with it (especially if the newline is only in the path component, which
we normally don't even pass to helpers). But until we see a real report,
we're better off being defensive.

Reported-by: Carlo Arenas <carenas@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
4 years agofsck: convert gitmodules url to URL passed to curl
Jonathan Nieder [Sun, 19 Apr 2020 03:52:34 +0000 (20:52 -0700)] 
fsck: convert gitmodules url to URL passed to curl

In 07259e74ec1 (fsck: detect gitmodules URLs with embedded newlines,
2020-03-11), git fsck learned to check whether URLs in .gitmodules could
be understood by the credential machinery when they are handled by
git-remote-curl.

However, the check is overbroad: it checks all URLs instead of only
URLs that would be passed to git-remote-curl. In principle a git:// or
file:/// URL does not need to follow the same conventions as an http://
URL; in particular, git:// and file:// protocols are not succeptible to
issues in the credential API because they do not support attaching
credentials.

In the HTTP case, the URL in .gitmodules does not always match the URL
that would be passed to git-remote-curl and the credential machinery:
Git's URL syntax allows specifying a remote helper followed by a "::"
delimiter and a URL to be passed to it, so that

git ls-remote http::https://example.com/repo.git

invokes git-remote-http with https://example.com/repo.git as its URL
argument. With today's checks, that distinction does not make a
difference, but for a check we are about to introduce (for empty URL
schemes) it will matter.

.gitmodules files also support relative URLs. To ensure coverage for the
https based embedded-newline attack, urldecode and check them directly
for embedded newlines.

Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Reviewed-by: Jeff King <peff@peff.net>
4 years agocredential: refuse to operate when missing host or protocol
Jeff King [Sun, 19 Apr 2020 03:50:48 +0000 (20:50 -0700)] 
credential: refuse to operate when missing host or protocol

The credential helper protocol was designed to be very flexible: the
fields it takes as input are treated as a pattern, and any missing
fields are taken as wildcards. This allows unusual things like:

  echo protocol=https | git credential reject

to delete all stored https credentials (assuming the helpers themselves
treat the input that way). But when helpers are invoked automatically by
Git, this flexibility works against us. If for whatever reason we don't
have a "host" field, then we'd match _any_ host. When you're filling a
credential to send to a remote server, this is almost certainly not what
you want.

Prevent this at the layer that writes to the credential helper. Add a
check to the credential API that the host and protocol are always passed
in, and add an assertion to the credential_write function that speaks
credential helper protocol to be doubly sure.

There are a few ways this can be triggered in practice:

  - the "git credential" command passes along arbitrary credential
    parameters it reads from stdin.

  - until the previous patch, when the host field of a URL is empty, we
    would leave it unset (rather than setting it to the empty string)

  - a URL like "example.com/foo.git" is treated by curl as if "http://"
    was present, but our parser sees it as a non-URL and leaves all
    fields unset

  - the recent fix for URLs with embedded newlines blanks the URL but
    otherwise continues. Rather than having the desired effect of
    looking up no credential at all, many helpers will return _any_
    credential

Our earlier test for an embedded newline didn't catch this because it
only checked that the credential was cleared, but didn't configure an
actual helper. Configuring the "verbatim" helper in the test would show
that it is invoked (it's obviously a silly helper which doesn't look at
its input, but the point is that it shouldn't be run at all). Since
we're switching this case to die(), we don't need to bother with a
helper. We can see the new behavior just by checking that the operation
fails.

We'll add new tests covering partial input as well (these can be
triggered through various means with url-parsing, but it's simpler to
just check them directly, as we know we are covered even if the url
parser changes behavior in the future).

[jn: changed to die() instead of logging and showing a manual
 username/password prompt]

Reported-by: Carlo Arenas <carenas@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
4 years agocredential: parse URL without host as empty host, not unset
Jeff King [Sun, 19 Apr 2020 03:48:05 +0000 (20:48 -0700)] 
credential: parse URL without host as empty host, not unset

We may feed a URL like "cert:///path/to/cert.pem" into the credential
machinery to get the key for a client-side certificate. That
credential has no hostname field, which is about to be disallowed (to
avoid confusion with protocols where a helper _would_ expect a
hostname).

This means as of the next patch, credential helpers won't work for
unlocking certs. Let's fix that by doing two things:

  - when we parse a url with an empty host, set the host field to the
    empty string (asking only to match stored entries with an empty
    host) rather than NULL (asking to match _any_ host).

  - when we build a cert:// credential by hand, similarly assign an
    empty string

It's the latter that is more likely to impact real users in practice,
since it's what's used for http connections. But we don't have good
infrastructure to test it.

The url-parsing version will help anybody using git-credential in a
script, and is easy to test.

Signed-off-by: Jeff King <peff@peff.net>
Reviewed-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
4 years agot0300: use more realistic inputs
Jeff King [Sun, 19 Apr 2020 03:47:30 +0000 (20:47 -0700)] 
t0300: use more realistic inputs

Many of the tests in t0300 give partial inputs to git-credential,
omitting a protocol or hostname. We're checking only high-level things
like whether and how helpers are invoked at all, and we don't care about
specific hosts. However, in preparation for tightening up the rules
about when we're willing to run a helper, let's start using input that's
a bit more realistic: pretend as if http://example.com is being
examined.

This shouldn't change the point of any of the tests, but do note we have
to adjust the expected output to accommodate this (filling a credential
will repeat back the protocol/host fields to stdout, and the helper
debug messages and askpass prompt will change on stderr).

Signed-off-by: Jeff King <peff@peff.net>
Reviewed-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
4 years agot0300: make "quit" helper more realistic
Jeff King [Sun, 19 Apr 2020 05:36:02 +0000 (01:36 -0400)] 
t0300: make "quit" helper more realistic

We test a toy credential helper that writes "quit=1" and confirms that
we stop running other helpers. However, that helper is unrealistic in
that it does not bother to read its stdin at all.

For now we don't send any input to it, because we feed git-credential a
blank credential. But that will change in the next patch, which will
cause this test to racily fail, as git-credential will get SIGPIPE
writing to the helper rather than exiting because it was asked to.

Let's make this one-off helper more like our other sample helpers, and
have it source the "dump" script. That will read stdin, fixing the
SIGPIPE problem. But it will also write what it sees to stderr. We can
make the test more robust by checking that output, which confirms that
we do run the quit helper, don't run any other helpers, and exit for the
reason we expected.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
4 years agoSync with v2.26.1
Junio C Hamano [Tue, 14 Apr 2020 01:40:10 +0000 (18:40 -0700)] 
Sync with v2.26.1

4 years agodocs: add a FAQ
brian m. carlson [Mon, 30 Mar 2020 11:55:18 +0000 (11:55 +0000)] 
docs: add a FAQ

Git is an enormously flexible and powerful piece of software.  However,
it can be intimidating for many users and there are a set of common
questions that users often ask.  While we already have some new user
documentation, it's worth adding a FAQ to address common questions that
users often have.  Even though some of this is addressed elsewhere in
the documentation, experience has shown that it is difficult for users
to find, so a centralized location is helpful.

Add such a FAQ and fill it with some common questions and answers.
While there are few entries now, we can expand it in the future to cover
more things as we find new questions that users have.  Let's also add
section markers so that people answering questions can directly link
users to the proper answer.

The FAQ also addresses common configuration questions that apply not
only to Git as an independent piece of software but also the ecosystem
of CI tools and hosting providers that people use, since these are the
source of common questions.  An attempt has been made to avoid
mentioning any particular provider or tool, but to nevertheless cover
common configurations that apply to a wide variety of such tools.

Note that the long lines for certain questions are required, since
Asciidoctor does not permit broken lines there.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoconnected: always use partial clone optimization
Jonathan Tan [Fri, 20 Mar 2020 22:00:45 +0000 (15:00 -0700)] 
connected: always use partial clone optimization

With 50033772d5 ("connected: verify promisor-ness of partial clone",
2020-01-30), the fast path (checking promisor packs) in
check_connected() now passes a subset of the slow path (rev-list) - if
all objects to be checked are found in promisor packs, both the fast
path and the slow path will pass; otherwise, the fast path will
definitely not pass. This means that we can always attempt the fast path
whenever we need to do the slow path.

The fast path is currently guarded by a flag; therefore, remove that
flag. Also, make the fast path fallback to the slow path - if the fast
path fails, the failing OID and all remaining OIDs will be passed to
rev-list.

The main user-visible benefit is the performance of fetch from a partial
clone - specifically, the speedup of the connectivity check done before
the fetch. In particular, a no-op fetch into a partial clone on my
computer was sped up from 7 seconds to 0.01 seconds. This is a
complement to the work in 2df1aa239c ("fetch: forgo full
connectivity check if --filter", 2020-01-30), which is the child of the
aforementioned 50033772d5. In that commit, the connectivity check
*after* the fetch was sped up.

The addition of the fast path might cause performance reductions in
these cases:

 - If a partial clone or a fetch into a partial clone fails, Git will
   fruitlessly run rev-list (it is expected that everything fetched
   would go into promisor packs, so if that didn't happen, it is most
   likely that rev-list will fail too).

 - Any connectivity checks done by receive-pack, in the (in my opinion,
   unlikely) event that a partial clone serves receive-pack.

I think that these cases are rare enough, and the performance reduction
in this case minor enough (additional object DB access), that the
benefit of avoiding a flag outweighs these.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Reviewed-by: Josh Steadmon <steadmon@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoMerge branch 'ds/default-pack-use-sparse-to-true'
Junio C Hamano [Sun, 29 Mar 2020 16:32:51 +0000 (09:32 -0700)] 
Merge branch 'ds/default-pack-use-sparse-to-true'

The 'pack.useSparse' configuration variable now defaults to 'true',
enabling an optimization that has been experimental since Git 2.21.

* ds/default-pack-use-sparse-to-true:
  pack-objects: flip the use of GIT_TEST_PACK_SPARSE
  config: set pack.useSparse=true by default

4 years agomidx.c: fix an integer underflow
Damien Robert [Sat, 28 Mar 2020 22:18:22 +0000 (23:18 +0100)] 
midx.c: fix an integer underflow

When verifying a midx index with 0 objects, the
    m->num_objects - 1
underflows and wraps around to 4294967295.

Fix this both by checking that the midx contains at least one oid,
and also that we don't write any midx when there is no packfiles.

Update the tests to check that `git multi-pack-index write` does
not write an midx when there is no objects, and another to check
that `git multi-pack-index verify` warns when it verifies an midx with no
objects. For this last test, use t5319/no-objects.midx which was
generated by an older version of git.

Signed-off-by: Damien Robert <damien.olivier.robert+git@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agot/lib-*.sh: drop executable bit
Jeff King [Thu, 26 Mar 2020 08:25:53 +0000 (04:25 -0400)] 
t/lib-*.sh: drop executable bit

There's no need for shell libraries to have the executable bit. They're
meant to be sourced, and running them stand-alone is pointless. Let's
reduce any possible confusion by making it more clear they're not meant
to be run this way.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agot/lib-credential.sh: drop shebang line
Jeff King [Thu, 26 Mar 2020 08:25:27 +0000 (04:25 -0400)] 
t/lib-credential.sh: drop shebang line

The purpose of lib-credential.sh is to be sourced into other test
scripts. It doesn't need a "#!/bin/sh" line, as running it directly
makes no sense. Nor does it serve any real filetype documentation
purpose, as the file is clearly named with a ".sh" extension.

In the spirit of c74c72034f (test: replace shebangs with descriptions in
shell libraries, 2013-11-25), let's replace it with a human-readable
description.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agorun-command: trigger PATH lookup properly on Cygwin
Andras Kucsma [Fri, 27 Mar 2020 00:36:43 +0000 (00:36 +0000)] 
run-command: trigger PATH lookup properly on Cygwin

On Cygwin, the codepath for POSIX-like systems is taken in
run-command.c::start_command(). The prepare_cmd() helper
function is called to decide if the command needs to be looked
up in the PATH. The logic there is to do the PATH-lookup if
and only if it does not have any slash '/' in it. If this test
passes we end up attempting to run the command by appending the
string after each colon-separated component of PATH.

The Cygwin environment supports both Windows and POSIX style
paths, so both forwardslahes '/' and back slashes '\' can be
used as directory separators for any external program the user
supplies.

Examples for path strings which are being incorrectly searched
for in the PATH instead of being executed as is:

- "C:\Program Files\some-program.exe"
- "a\b\c.exe"

To handle these, the PATH lookup detection logic in prepare_cmd()
is taught to know about this Cygwin quirk, by introducing
has_dir_sep(path) helper function to abstract away the difference
between true POSIX and Cygwin systems.

Signed-off-by: Andras Kucsma <r0maikx02b@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agot5801: teach compare_refs() to accept !
Denton Liu [Thu, 26 Mar 2020 08:27:55 +0000 (04:27 -0400)] 
t5801: teach compare_refs() to accept !

Before, testing if two refs weren't equal with compare_refs() was done
with `test_must_fail compare_refs`. This was wrong for two reasons.
First, test_must_fail should only be used on git commands. Second,
negating the error code is a little heavy-handed since in the case where
one of the git invocations within compare_refs() fails, we will report
success, even though it failed at an unexpected point.

Teach compare_refs() to accept `!` as the first argument which would
_only_ negate the test_cmp()'s return code.

Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agot5612: stop losing return codes of git commands
Denton Liu [Thu, 26 Mar 2020 08:27:54 +0000 (04:27 -0400)] 
t5612: stop losing return codes of git commands

In a pipe, only the return code of the last command is used. Thus, all
other commands will have their return codes masked. Rewrite pipes so
that there are no git commands upstream so that their failure is
reported.

Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agot5612: don't use `test_must_fail test_cmp`
Denton Liu [Thu, 26 Mar 2020 08:27:53 +0000 (04:27 -0400)] 
t5612: don't use `test_must_fail test_cmp`

The test_must_fail function should only be used for git commands since
we should assume that external commands work sanely. Since test_cmp() just
wraps an external command, replace `test_must_fail test_cmp` with
`! test_cmp`.

Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agot5607: reorder `nongit test_must_fail`
Denton Liu [Thu, 26 Mar 2020 08:27:52 +0000 (04:27 -0400)] 
t5607: reorder `nongit test_must_fail`

In the future, we plan on only allowing `test_must_fail` to work on a
restricted subset of commands, including `git`. Reorder the commands so
that `nongit` comes before `test_must_fail`. This way, `test_must_fail`
operates on a git command.

Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agot5550: simplify no matching line check
Denton Liu [Thu, 26 Mar 2020 08:27:51 +0000 (04:27 -0400)] 
t5550: simplify no matching line check

In the 'did not use upload-pack service' test, we have a complicated
song-and-dance to ensure that there are no "/git-upload-pack" lines in
"$HTTPD_ROOT_PATH/access.log". Simplify this by just checking that grep
returns a non-zero exit code.

Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agot5512: stop losing return codes of git commands
Denton Liu [Thu, 26 Mar 2020 08:27:50 +0000 (04:27 -0400)] 
t5512: stop losing return codes of git commands

In a pipe, only the return code of the last command is used. Thus, all
other commands will have their return codes masked. Rewrite pipes so
that there are no git commands upstream so that their failure is
reported.

Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agot5512: stop losing git exit code in here-docs
Denton Liu [Thu, 26 Mar 2020 08:27:49 +0000 (04:27 -0400)] 
t5512: stop losing git exit code in here-docs

The expected references are generated using a here-doc with some inline
command substitutions. If one of the `git rev-parse` invocations within
the command substitutions fails, its return code is swallowed and we
won't know about it. Replace these command substitutions with
generate_references(), which actually reports when `git rev-parse`
fails.

Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoThe second batch post 2.26 cycle
Junio C Hamano [Fri, 27 Mar 2020 00:00:57 +0000 (17:00 -0700)] 
The second batch post 2.26 cycle

Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoMerge branch 'ah/force-pull-rebase-configuration'
Junio C Hamano [Fri, 27 Mar 2020 00:11:21 +0000 (17:11 -0700)] 
Merge branch 'ah/force-pull-rebase-configuration'

"git pull" learned to warn when no pull.rebase configuration
exists, and neither --[no-]rebase nor --ff-only is given (which
would result a merge).

* ah/force-pull-rebase-configuration:
  pull: warn if the user didn't say whether to rebase or to merge

4 years agoMerge branch 'tg/retire-scripted-stash'
Junio C Hamano [Fri, 27 Mar 2020 00:11:21 +0000 (17:11 -0700)] 
Merge branch 'tg/retire-scripted-stash'

"git stash" has kept an escape hatch to use the scripted version
for a few releases, which got stale.  It has been removed.

* tg/retire-scripted-stash:
  stash: remove the stash.useBuiltin setting
  stash: get git_stash_config at the top level

4 years agoMerge branch 'jc/describe-misnamed-annotated-tag'
Junio C Hamano [Fri, 27 Mar 2020 00:11:21 +0000 (17:11 -0700)] 
Merge branch 'jc/describe-misnamed-annotated-tag'

When "git describe C" finds an annotated tag with tagname A to be
the best name to explain commit C, and the tag is stored in a
"wrong" place in the refs/tags hierarchy, e.g. refs/tags/B, the
command gave a warning message but used A (not B) to describe C.
If C is exactly at the tag, the describe output would be "A", but
"git rev-parse A^0" would not be equal as "git rev-parse C^0".  The
behavior of the command has been changed to use the "long" form
i.e. A-0-gOBJECTNAME, which is correctly interpreted by rev-parse.

* jc/describe-misnamed-annotated-tag:
  describe: force long format for a name based on a mislocated tag

4 years agoMerge branch 'at/rebase-fork-point-regression-fix'
Junio C Hamano [Fri, 27 Mar 2020 00:11:21 +0000 (17:11 -0700)] 
Merge branch 'at/rebase-fork-point-regression-fix'

The "--fork-point" mode of "git rebase" regressed when the command
was rewritten in C back in 2.20 era, which has been corrected.

* at/rebase-fork-point-regression-fix:
  rebase: --fork-point regression fix

4 years agoMerge branch 'bc/filter-process'
Junio C Hamano [Fri, 27 Mar 2020 00:11:20 +0000 (17:11 -0700)] 
Merge branch 'bc/filter-process'

Provide more information (e.g. the object of the tree-ish in which
the blob being converted appears, in addition to its path, which
has already been given) to smudge/clean conversion filters.

* bc/filter-process:
  t0021: test filter metadata for additional cases
  builtin/reset: compute checkout metadata for reset
  builtin/rebase: compute checkout metadata for rebases
  builtin/clone: compute checkout metadata for clones
  builtin/checkout: compute checkout metadata for checkouts
  convert: provide additional metadata to filters
  convert: permit passing additional metadata to filter processes
  builtin/checkout: pass branch info down to checkout_worktree

4 years agoMerge branch 'hi/gpg-prefer-check-signature'
Junio C Hamano [Fri, 27 Mar 2020 00:11:20 +0000 (17:11 -0700)] 
Merge branch 'hi/gpg-prefer-check-signature'

The code to interface with GnuPG has been refactored.

* hi/gpg-prefer-check-signature:
  gpg-interface: prefer check_signature() for GPG verification
  t: increase test coverage of signature verification output

4 years agoMerge branch 'bc/sha-256-part-1-of-4'
Junio C Hamano [Fri, 27 Mar 2020 00:11:20 +0000 (17:11 -0700)] 
Merge branch 'bc/sha-256-part-1-of-4'

SHA-256 transition continues.

* bc/sha-256-part-1-of-4: (22 commits)
  fast-import: add options for rewriting submodules
  fast-import: add a generic function to iterate over marks
  fast-import: make find_marks work on any mark set
  fast-import: add helper function for inserting mark object entries
  fast-import: permit reading multiple marks files
  commit: use expected signature header for SHA-256
  worktree: allow repository version 1
  init-db: move writing repo version into a function
  builtin/init-db: add environment variable for new repo hash
  builtin/init-db: allow specifying hash algorithm on command line
  setup: allow check_repository_format to read repository format
  t/helper: make repository tests hash independent
  t/helper: initialize repository if necessary
  t/helper/test-dump-split-index: initialize git repository
  t6300: make hash algorithm independent
  t6300: abstract away SHA-1-specific constants
  t: use hash-specific lookup tables to define test constants
  repository: require a build flag to use SHA-256
  hex: add functions to parse hex object IDs in any algorithm
  hex: introduce parsing variants taking hash algorithms
  ...

4 years agoMerge branch 'pb/recurse-submodules-fix'
Junio C Hamano [Fri, 27 Mar 2020 00:11:20 +0000 (17:11 -0700)] 
Merge branch 'pb/recurse-submodules-fix'

Fix "git checkout --recurse-submodules" of a nested submodule
hierarchy.

* pb/recurse-submodules-fix:
  t/lib-submodule-update: add test removing nested submodules
  unpack-trees: check for missing submodule directory in merged_entry
  unpack-trees: remove outdated description for verify_clean_submodule
  t/lib-submodule-update: move a test to the right section
  t/lib-submodule-update: remove outdated test description
  t7112: remove mention of KNOWN_FAILURE_SUBMODULE_RECURSIVE_NESTED

4 years agotests: increase the verbosity of the GPG-related prereqs
Johannes Schindelin [Thu, 26 Mar 2020 15:35:28 +0000 (15:35 +0000)] 
tests: increase the verbosity of the GPG-related prereqs

Especially when debugging a test failure that can only be reproduced in
the CI build (e.g. when the developer has no access to a macOS machine
other than running the tests on a macOS build agent), output should not
be suppressed.

In the instance of `hi/gpg-prefer-check-signature`, where one
GPG-related test failed for no apparent reason, the entire output of
`gpg` and `gpgsm` was suppressed, even in verbose mode, leaving
interested readers no clue what was going wrong.

Let's fix this by no longer redirecting the output not to `/dev/null`.
This is now possible because the affected prereqs were turned into lazy
ones (and are therefore evaluated via `test_eval_` which respects the
`--verbose` option).

Note that we _still_ redirect `stdout` to `/dev/null` for those commands
that sign their `stdin`, as the output would be binary (and useless
anyway, because the reader would not have anything against which to
compare the output).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agotests: turn GPG, GPGSM and RFC1991 into lazy prereqs
Johannes Schindelin [Thu, 26 Mar 2020 15:35:27 +0000 (15:35 +0000)] 
tests: turn GPG, GPGSM and RFC1991 into lazy prereqs

The code to set those prereqs is executed completely outside of any
`test_eval_` block. As a consequence, its output had to be suppressed so
that it does not clutter the output of a regular test script run.

Unfortunately, the output *stays* suppressed even when the `--verbose`
option is in effect.

This hid important output when debugging why the GPG prereq was not
enabled in the Windows part of our CI builds.

In preparation for fixing that, let's move all of this code into lazy
prereqs.

The only slightly tricky part is the global environment variable
`GNUPGHOME`. Originally, it was configured only when we verified that
there is a `gpg` in the `PATH` that we can use. This is now no longer
possible, as lazy prereqs are evaluated in a subshell that changes the
working directory to a temporary one. Therefore, we simply _always_ set
that environment variable: it does not hurt anything because it does not
indicate the presence of a working GPG.

Side note: it was quite tempting to use a hack that is possible because
we do not validate what is passed to `test_lazy_prereq` (and it is
therefore possible to "break out" of the lazy_prereq subshell:

test_lazy_prereq GPG '...) && GNUPGHOME=... && (...'

However, this is rather tricksy hobbitses code, and the current patch is
_much_ easier to understand.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agotests: do not let lazy prereqs inside `test_expect_*` turn off tracing
Johannes Schindelin [Thu, 26 Mar 2020 15:35:26 +0000 (15:35 +0000)] 
tests: do not let lazy prereqs inside `test_expect_*` turn off tracing

The `test_expect_*` functions use `test_eval_` and so does
`test_run_lazy_prereq_`. If tracing is enabled via the `-x` option,
`test_eval_` turns on tracing while evaluating the code block, and turns
it off directly after it.

This is unwanted for nested invocations.

One somewhat surprising example of this is when running a test that
calls `test_i18ngrep`: that function requires the `C_LOCALE_OUTPUT`
prereq, and that prereq is a lazy one, so it is evaluated via
`test_eval_`, the command tracing is turned off, and the test case
continues to run _without tracing the commands_.

Another somewhat surprising example is when one lazy prereq depends on
another lazy prereq: the former will call `test_have_prereq` with the
latter one, which in turn calls `test_eval_` and -- you guessed it --
tracing (if enabled) will be turned off _before_ returning to evaluating
the other lazy prereq.

As we will introduce just such a scenario with the GPG, GPGSM and
RFC1991 prereqs, let's fix that by introducing a variable that keeps
track of the current trace level: nested `test_eval_` calls will
increment and then decrement the level, and only when it reaches 0, the
tracing will _actually_ be turned off.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agot/lib-gpg.sh: stop pretending to be a stand-alone script
Johannes Schindelin [Thu, 26 Mar 2020 15:35:25 +0000 (15:35 +0000)] 
t/lib-gpg.sh: stop pretending to be a stand-alone script

It makes no sense to call `./lib-gpg.sh`. Therefore the hash-bang line
is unnecessary.

There are other similar instances in `t/`, but they are too far from the
context of the enclosing patch series, so they will be addressed
separately.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoThe first batch post 2.26 cycle
Junio C Hamano [Wed, 25 Mar 2020 20:37:05 +0000 (13:37 -0700)] 
The first batch post 2.26 cycle

Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoMerge branch 'ss/submodule-foreach-cb'
Junio C Hamano [Wed, 25 Mar 2020 20:57:44 +0000 (13:57 -0700)] 
Merge branch 'ss/submodule-foreach-cb'

Code clean-up.

* ss/submodule-foreach-cb:
  submodule--helper.c: Rename 'cb_foreach' to 'foreach_cb'

4 years agoMerge branch 'jc/config-tar'
Junio C Hamano [Wed, 25 Mar 2020 20:57:44 +0000 (13:57 -0700)] 
Merge branch 'jc/config-tar'

Improve the structure of the documentation source a bit.

* jc/config-tar:
  separate tar.* config to its own source file

4 years agoMerge branch 'en/oidset-uninclude-hashmap'
Junio C Hamano [Wed, 25 Mar 2020 20:57:44 +0000 (13:57 -0700)] 
Merge branch 'en/oidset-uninclude-hashmap'

Code clean-up.

* en/oidset-uninclude-hashmap:
  oidset: remove unnecessary include

4 years agoMerge branch 'ds/check-connected-reprepare-packed-git'
Junio C Hamano [Wed, 25 Mar 2020 20:57:43 +0000 (13:57 -0700)] 
Merge branch 'ds/check-connected-reprepare-packed-git'

Corner case "git fetch" fix.

* ds/check-connected-reprepare-packed-git:
  connected.c: reprepare packs for corner cases

4 years agoMerge branch 'rs/doc-passthru-fetch-options'
Junio C Hamano [Wed, 25 Mar 2020 20:57:43 +0000 (13:57 -0700)] 
Merge branch 'rs/doc-passthru-fetch-options'

Doc update.

* rs/doc-passthru-fetch-options:
  pull: document more passthru options

4 years agoMerge branch 'pw/advise-rebase-skip'
Junio C Hamano [Wed, 25 Mar 2020 20:57:43 +0000 (13:57 -0700)] 
Merge branch 'pw/advise-rebase-skip'

The mechanism to prevent "git commit" from making an empty commit
or amending during an interrupted cherry-pick was broken during the
rewrite of "git rebase" in C, which has been corrected.

* pw/advise-rebase-skip:
  commit: give correct advice for empty commit during a rebase
  commit: encapsulate determine_whence() for sequencer
  commit: use enum value for multiple cherry-picks
  sequencer: write CHERRY_PICK_HEAD for reword and edit
  cherry-pick: check commit error messages
  cherry-pick: add test for `--skip` advice in `git commit`
  t3404: use test_cmp_rev

4 years agoMerge branch 'yz/p4-py3'
Junio C Hamano [Wed, 25 Mar 2020 20:57:43 +0000 (13:57 -0700)] 
Merge branch 'yz/p4-py3'

Update "git p4" to work with Python 3.

* yz/p4-py3:
  ci: use python3 in linux-gcc and osx-gcc and python2 elsewhere
  git-p4: use python3's input() everywhere
  git-p4: simplify regex pattern generation for parsing diff-tree
  git-p4: use dict.items() iteration for python3 compatibility
  git-p4: use functools.reduce instead of reduce
  git-p4: fix freezing while waiting for fast-import progress
  git-p4: use marshal format version 2 when sending to p4
  git-p4: open .gitp4-usercache.txt in text mode
  git-p4: convert path to unicode before processing them
  git-p4: encode/decode communication with git for python3
  git-p4: encode/decode communication with p4 for python3
  git-p4: remove string type aliasing
  git-p4: change the expansion test from basestring to list
  git-p4: make python2.7 the oldest supported version

4 years agoMerge branch 'am/real-path-fix'
Junio C Hamano [Wed, 25 Mar 2020 20:57:42 +0000 (13:57 -0700)] 
Merge branch 'am/real-path-fix'

The real_path() convenience function can easily be misused; with a
bit of code refactoring in the callers' side, its use has been
eliminated.

* am/real-path-fix:
  get_superproject_working_tree(): return strbuf
  real_path_if_valid(): remove unsafe API
  real_path: remove unsafe API
  set_git_dir: fix crash when used with real_path()

4 years agoMerge branch 'sg/commit-slab-clarify-peek'
Junio C Hamano [Wed, 25 Mar 2020 20:57:42 +0000 (13:57 -0700)] 
Merge branch 'sg/commit-slab-clarify-peek'

In-code comment update.

* sg/commit-slab-clarify-peek:
  commit-slab: clarify slabname##_peek()'s return value

4 years agoMerge branch 'jc/maintain-doc'
Junio C Hamano [Wed, 25 Mar 2020 20:57:42 +0000 (13:57 -0700)] 
Merge branch 'jc/maintain-doc'

Doc update.

* jc/maintain-doc:
  update how-to-maintain-git

4 years agoMerge branch 'js/https-proxy-config'
Junio C Hamano [Wed, 25 Mar 2020 20:57:42 +0000 (13:57 -0700)] 
Merge branch 'js/https-proxy-config'

A handful of options to configure SSL when talking to proxies have
been added.

* js/https-proxy-config:
  http: add environment variable support for HTTPS proxies
  http: add client cert support for HTTPS proxies

4 years agoMerge branch 'hw/advise-ng'
Junio C Hamano [Wed, 25 Mar 2020 20:57:41 +0000 (13:57 -0700)] 
Merge branch 'hw/advise-ng'

Revamping of the advise API to allow more systematic enumeration of
advice knobs in the future.

* hw/advise-ng:
  tag: use new advice API to check visibility
  advice: revamp advise API
  advice: change "setupStreamFailure" to "setUpstreamFailure"
  advice: extract vadvise() from advise()

4 years agoGit 2.26.1 v2.26.1
Junio C Hamano [Wed, 25 Mar 2020 20:07:47 +0000 (13:07 -0700)] 
Git 2.26.1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agotests(gpg): allow the gpg-agent to start on Windows
Johannes Schindelin [Wed, 25 Mar 2020 05:41:17 +0000 (05:41 +0000)] 
tests(gpg): allow the gpg-agent to start on Windows

In Git for Windows' SDK, we use the MSYS2 version of OpenSSH, meaning
that the `gpg-agent` will fail horribly when being passed a `--homedir`
that contains colons.

Previously, we did pass the Windows version of the absolute path,
though, which starts in the drive letter followed by, you guessed it, a
colon.

Let's use the same trick found elsewhere in our test suite where `$PWD`
is used to refer to the pseudo-Unix path (which works only within the
MSYS2 Bash/OpenSSH/Perl/etc, as opposed to `$(pwd)` which refers to the
Windows path that `git.exe` understands, too).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agotest-lib: allow short options to be bundled
Matheus Tavares [Sun, 22 Mar 2020 15:58:57 +0000 (12:58 -0300)] 
test-lib: allow short options to be bundled

When debugging a test (or a set of tests), it's common to execute it
with some combination of short options, such as:

$ ./txxx-testname.sh -d -x -i

In cases like this, CLIs usually allow the short options to be bundled
in a single argument, for convenience and agility. Let's add this
feature to test-lib, allowing the above command to be run as:

$ ./txxx-testname.sh -dxi
(or any other permutation, e.g. '-ixd')

Note: Short options that require an argument can also be used in a
bundle, in any position. So, for example, '-r 5 -x', '-xr 5' and '-rx 5'
are all valid and equivalent. A special case would be having a bundle
with more than one of such options. To keep things simple, this case is
not allowed for now. This shouldn't be a major limitation, though, as
the only short option that requires an argument today is '-r'. And
concatenating '-r's as in '-rr 5 6' would probably not be very
practical: its unbundled format would be '-r 5 -r 6', for which test-lib
currently considers only the last argument. Therefore, if '-rr 5 6' were
to be allowed, it would have the same effect as just typing '-r 6'.

Note: the test-lib currently doesn't support '-r5', as an alternative
for '-r 5', so the former is not supported in bundles as well.

Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Matheus Tavares <matheus.bernardino@usp.br>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agot5512: don't use `test_must_fail test_cmp`
Denton Liu [Wed, 25 Mar 2020 05:54:48 +0000 (01:54 -0400)] 
t5512: don't use `test_must_fail test_cmp`

The test_must_fail function should only be used for git commands since
we should assume that external commands work sanely. Since test_cmp() just
wraps an external command, replace `test_must_fail test_cmp` with
`! test_cmp`.

Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoimport-tars: ignore the global PAX header
Johannes Schindelin [Tue, 24 Mar 2020 19:35:45 +0000 (19:35 +0000)] 
import-tars: ignore the global PAX header

The tar importer in `contrib/fast-import/import-tars.perl` has a very
convenient feature: if _all_ paths stored in the imported `.tar` start
with a common prefix, e.g. `git-2.26.0/` in the tar at
https://github.com/git/git/archive/v2.26.0.tar.gz, then this prefix is
stripped.

This feature makes a ton of sense because it is relatively common to
import two or more revisions of the same project into Git, and obviously
we don't want all files to live in a tree whose name changes from
revision to revision.

Now, the problem with that feature is that it breaks down if there is a
`pax_global_header` "file" located outside of said prefix, at the top of
the tree. This is the case for `.tar` files generated by Git's very own
`git archive` command: it inserts that header, and `git archive` allows
specifying a common prefix (that the header does _not_ share with the
other files contained in the archive) via `--prefix=my-project-1.0.0/`.

Let's just skip any global header when importing `.tar` files into Git.

Note: this global header might contain useful information. For example,
in the output of `git archive`, it lists the original commit, which _is_
useful information. A future improvement to the `import-tars.perl`
script might be to include that information in the commit message, or do
other things with the information (e.g. use `mtime` information
contained in the global header as date of the commit). This patch does
not prevent any future patch from making that happen, it only prevents
the header from being treated as if it was a regular file.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agotrace2: teach Git to log environment variables
Josh Steadmon [Fri, 20 Mar 2020 21:06:15 +0000 (14:06 -0700)] 
trace2: teach Git to log environment variables

Via trace2, Git can already log interesting config parameters (see the
trace2_cmd_list_config() function). However, this can grant an
incomplete picture because many config parameters also allow overrides
via environment variables.

To allow for more complete logs, we add a new trace2_cmd_list_env_vars()
function and supporting implementation, modeled after the pre-existing
config param logging implementation.

Signed-off-by: Josh Steadmon <steadmon@google.com>
Acked-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agotests(junit-xml): avoid invalid XML
Johannes Schindelin [Mon, 23 Mar 2020 12:44:35 +0000 (12:44 +0000)] 
tests(junit-xml): avoid invalid XML

When a test case is run in a subshell, we finalize the JUnit-style XML
when said subshell exits. But then we continue to write into that XML as
if nothing had happened.

This leads to Azure Pipelines' Publish Test Results task complaining:

Failed to read /home/vsts/work/1/s/t/out/TEST-t0000-basic.xml.
Error : Unexpected end tag. Line 110, position 5.

And indeed, the resulting XML is incorrect.

Let's "re-open" the XML in such a case, i.e. remove the previously added
closing tags.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoGit 2.26 v2.26.0
Junio C Hamano [Sun, 22 Mar 2020 23:50:46 +0000 (16:50 -0700)] 
Git 2.26

Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agot: fix whitespace around &&
Andrei Rybak [Sun, 22 Mar 2020 21:14:22 +0000 (22:14 +0100)] 
t: fix whitespace around &&

Add missing spaces before '&&' and switch tabs around '&&' to spaces.
Also fix the space after redirection operator in t3701 while we're here.

These issues were found using `git grep '[^ ]&&$'` and
`git grep -P '&&\t' t/`.

Signed-off-by: Andrei Rybak <rybak.a.v@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agot9500: remove spaces after redirect operators
Andrei Rybak [Sun, 22 Mar 2020 21:14:21 +0000 (22:14 +0100)] 
t9500: remove spaces after redirect operators

For shell scripts, the usual convention is for there to be no space
after redirection operators, (e.g. `>file`, not `> file`). Remove these
spaces wherever they appear.

Signed-off-by: Andrei Rybak <rybak.a.v@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoclone: document --filter options
Derrick Stolee [Sun, 22 Mar 2020 19:50:06 +0000 (19:50 +0000)] 
clone: document --filter options

It turns out that the "--filter=<filter-spec>" option is not
documented anywhere in the "git clone" page, and instead is
detailed carefully in "git rev-list" where it serves a
different purpose.

Add a small bit about this option in the documentation. It
would be worth some time to create a subsection in the "git clone"
documentation about partial clone as a concept and how it can be
a surprising experience. For example, "git checkout" will likely
trigger a pack download.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agot3419: drop EXPENSIVE tests
Jeff King [Sun, 22 Mar 2020 07:51:40 +0000 (03:51 -0400)] 
t3419: drop EXPENSIVE tests

When t3419 was originally written, it was designed to run a smaller test
for correctness, and then the same test with a larger number of patches
for performance. But it seems unlikely the latter was helping us:

 - it was marked with EXPENSIVE, so hardly anybody ran it anyway

 - there's no indication that it was more likely to find bugs than the
   smaller case (the commit message isn't very helpful, but the original
   cover letter describes it as: "The first patch adds correctness and
   (optional) performance tests".

 - the timing results are shown only via test_debug(). So also not run
   unless the user says "-d", and then not provided in any
   machine-readable form.

If we're interested in performance regressions, a script in t/perf would
be more appropriate. I didn't add one here, because it's not at all
clear to me that what the script is timing is even all that interesting.

Let's simplify the script by dropping the EXPENSIVE run. That in turn
lets us drop the do_tests() wrapper, which lets us consistently use
single-quotes for our test snippets. And we can drop the useless
test_debug() timings, as well as their run() helper. And finally, while
we're here, we can replace the count() helper with the standard
test_seq().

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoMerge branch 'en/rebase-backend'
Junio C Hamano [Sat, 21 Mar 2020 20:48:54 +0000 (13:48 -0700)] 
Merge branch 'en/rebase-backend'

Test fix.

* en/rebase-backend:
  t3419: prevent failure when run with EXPENSIVE

4 years agoMerge tag 'l10n-2.26.0-rnd2.1' of git://github.com/git-l10n/git-po.git
Junio C Hamano [Sat, 21 Mar 2020 19:12:28 +0000 (12:12 -0700)] 
Merge tag 'l10n-2.26.0-rnd2.1' of git://github.com/git-l10n/git-po.git

l10n-2.26.0-rnd2.1

* tag 'l10n-2.26.0-rnd2.1' of https://github.com/git-l10n/git-po: (28 commits)
  l10n: tr.po: change file mode to 644
  l10n: de.po: Update German translation for Git 2.26.0
  l10n: de.po: add missing space
  l10n: tr: Fix a couple of ambiguities
  l10n: Update Catalan translation
  l10n: sv.po: Update Swedish translation (4839t0f0u)
  l10n: zh_CN: Revise v2.26.0 translation
  l10n: zh_CN: for git v2.26.0 l10n round 1 and 2
  l10n: vi(4839t): Updated Vietnamese translation for v2.26.0
  l10n: vi: fix translation + grammar
  l10n: zh_TW.po: v2.26.0 round 2 (0 untranslated)
  l10n: zh_TW.po: v2.26.0 round 1 (11 untranslated)
  l10n: it.po: update the Italian translation for Git 2.26.0 round 2
  l10n: es: 2.26.0 round#2
  l10n: bg.po: Updated Bulgarian translation (4839t)
  l10n: tr: v2.26.0 round 2
  l10n: fr : v2.26.0 rnd 2
  l10n: git.pot: v2.26.0 round 2 (7 new, 2 removed)
  l10n: tr: Add glossary for Turkish translations
  l10n: sv.po: Update Swedish translation (4835t0f0u)
  ...

4 years agol10n: tr.po: change file mode to 644
Jiang Xin [Sat, 21 Mar 2020 10:26:56 +0000 (18:26 +0800)] 
l10n: tr.po: change file mode to 644

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
4 years agot3419: prevent failure when run with EXPENSIVE
brian m. carlson [Fri, 20 Mar 2020 21:52:41 +0000 (21:52 +0000)] 
t3419: prevent failure when run with EXPENSIVE

This test runs a function which itself runs several assertions.  The
last of these assertions cleans up the .git/rebase-apply directory,
since when run with EXPENSIVE set, the function is invoked a second time
to run the same tests with a larger data set.

However, as of 2ac0d6273f ("rebase: change the default backend from "am"
to "merge"", 2020-02-15), the default backend of rebase has changed, and
cleaning up the rebase-apply directory has no effect: it no longer
exists, since we're using rebase-merge instead.

Since we don't really care which rebase backend is in use, let's just
use the command "git rebase --quit", which will do the right thing
regardless.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agopack-objects: flip the use of GIT_TEST_PACK_SPARSE
Derrick Stolee [Fri, 20 Mar 2020 12:38:10 +0000 (12:38 +0000)] 
pack-objects: flip the use of GIT_TEST_PACK_SPARSE

The environment variable GIT_TEST_PACK_SPARSE was previously used
to allow testing the --sparse option for "git pack-objects" in
the test suite. This allowed interesting cases of "git push" to
also test this algorithm.

Since pack.useSparse is now true by default, we do not need this
variable to _enable_ the --sparse option, but instead to _disable_
it. This flips how we work with the variable a bit.

When checking for the variable, default to a value of -1 for
"unset". If unset, then take the default from the repo settings,
which is currently 1. Then, the --[no-]sparse command-line option
will override either of these settings.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoconfig: set pack.useSparse=true by default
Derrick Stolee [Fri, 20 Mar 2020 12:38:09 +0000 (12:38 +0000)] 
config: set pack.useSparse=true by default

The pack.useSparse config option was introduced by 3d036eb0
(pack-objects: create pack.useSparse setting, 2019-01-19) and was
first available in v2.21.0. When enabled, the pack-objects process
during 'git push' will use a sparse tree walk when deciding which
trees and blobs to send to the remote. The algorithm was introduced
by d5d2e93 (revision: implement sparse algorithm, 2019-01-16) and
has been in production use by VFS for Git since around that time.
The features.experimental config option also enabled pack.useSparse,
so hopefully that has also increased exposure.

It is worth noting that pack.useSparse has a possibility of
sending more objects across a push, but requires a special
arrangement of exact _copies_ across directories. There is a test
in t5322-pack-objects-sparse.sh that demonstrates this possibility.
This test uses the --sparse option to "git pack-objects" but we
can make it implied by the config value to demonstrate that the
default value has changed.

While updating that test, I noticed that the documentation did not
include an option for --no-sparse, which is now more important than
it was before.

Since the downside is unlikely but the upside is significant, set
the default value of pack.useSparse to true. Remove it from the
set of options implied by features.experimental.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agol10n: de.po: Update German translation for Git 2.26.0
Matthias Rüster [Sat, 14 Mar 2020 21:10:16 +0000 (22:10 +0100)] 
l10n: de.po: Update German translation for Git 2.26.0

Signed-off-by: Matthias Rüster <matthias.ruester@gmail.com>
Reviewed-by: Ralf Thielow <ralf.thielow@gmail.com>
Reviewed-by: Phillip Szelat <phillip.szelat@gmail.com>
4 years agol10n: de.po: add missing space
Ralf Thielow [Tue, 21 Jan 2020 16:30:48 +0000 (17:30 +0100)] 
l10n: de.po: add missing space

Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
4 years agoMerge https://github.com/prati0100/git-gui
Junio C Hamano [Thu, 19 Mar 2020 23:06:51 +0000 (16:06 -0700)] 
Merge https://github.com/prati0100/git-gui

* 'master' of https://github.com/prati0100/git-gui:
  git-gui: create a new namespace for chord script evaluation
  git-gui: reduce Tcl version requirement from 8.6 to 8.5
  git-gui--askpass: coerce answers to UTF-8 on Windows
  git-gui: fix error popup when doing blame -> "Show History Context"
  git-gui: add missing close bracket
  git-gui: update German translation
  git-gui: extend translation glossary template with more terms
  git-gui: update pot template and German translation to current source code

4 years agol10n: tr: Fix a couple of ambiguities
Emir Sarı [Thu, 19 Mar 2020 22:36:24 +0000 (01:36 +0300)] 
l10n: tr: Fix a couple of ambiguities

Signed-off-by: Emir Sarı <bitigchi@me.com>
4 years agoMerge branch 'py/remove-tcloo'
Pratyush Yadav [Thu, 19 Mar 2020 15:59:19 +0000 (21:29 +0530)] 
Merge branch 'py/remove-tcloo'

Reduce the Tcl version requirement to 8.5 to allow git-gui to run on
MacOS distributions like High Sierra. While here, fix a potential
variable name collision.

* py/remove-tcloo:
  git-gui: create a new namespace for chord script evaluation
  git-gui: reduce Tcl version requirement from 8.6 to 8.5

4 years agoRelNotes/2.26.0: fix various typos
Elijah Newren [Wed, 18 Mar 2020 21:18:26 +0000 (21:18 +0000)] 
RelNotes/2.26.0: fix various typos

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>