]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
2 years agohttp: correct curl version check for CURLOPT_PINNEDPUBLICKEY
Ævar Arnfjörð Bjarmason [Mon, 13 Sep 2021 14:51:27 +0000 (16:51 +0200)] 
http: correct curl version check for CURLOPT_PINNEDPUBLICKEY

In aeff8a61216 (http: implement public key pinning, 2016-02-15) a
dependency and warning() was added if curl older than 7.44.0 was used,
but the relevant code depended on CURLOPT_PINNEDPUBLICKEY, introduced
in 7.39.0.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agohttp: correct version check for CURL_HTTP_VERSION_2
Ævar Arnfjörð Bjarmason [Mon, 13 Sep 2021 14:51:26 +0000 (16:51 +0200)] 
http: correct version check for CURL_HTTP_VERSION_2

In d73019feb44 (http: add support selecting http version, 2018-11-08)
a dependency was added on CURL_HTTP_VERSION_2, but this feature was
introduced in curl version 7.43.0, not 7.47.0, as the incorrect
version check led us to believe.

As looking through the history of that commit on the mailing list will
reveal[1], the reason for this is that an earlier version of it
depended on CURL_HTTP_VERSION_2TLS, which was introduced in libcurl
7.47.0.

But the version that made it in in d73019feb44 had dropped the
dependency on CURL_HTTP_VERSION_2TLS, but the corresponding version
check was not corrected.

The newest symbol we depend on is CURL_HTTP_VERSION_2. It was added in
7.33.0, but the CURL_HTTP_VERSION_2 alias we used was added in
7.47.0. So we could support an even older version here, but let's just
correct the checked version.

1. https://lore.kernel.org/git/pull.69.git.gitgitgadget@gmail.com/

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agohttp: drop support for curl < 7.18.0 (again)
Ævar Arnfjörð Bjarmason [Mon, 13 Sep 2021 14:51:25 +0000 (16:51 +0200)] 
http: drop support for curl < 7.18.0 (again)

In 644de29e220 (http: drop support for curl < 7.19.4, 2021-07-30) we
dropped support for curl < 7.19.4, so we can drop support for this
non-obvious dependency on curl < 7.18.0.

It's non-obvious because in curl's hex version notation 0x071800 is
version 7.24.0, *not* 7.18.0, so at a glance this patch looks
incorrect.

But it's correct, because the existing version check being removed
here is wrong. The check guards use of the following curl defines:

    CURLPROXY_SOCKS4                7.10
    CURLPROXY_SOCKS4A               7.18.0
    CURLPROXY_SOCKS5                7.10
    CURLPROXY_SOCKS5_HOSTNAME       7.18.0

I.e. the oldest version that has these is in fact 7.18.0, not
7.24.0. That we were checking 7.24.0 is just an mistake in
6d7afe07f29 (remote-http(s): support SOCKS proxies, 2015-10-26),
i.e. its author confusing base 10 and base 16.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMakefile: drop support for curl < 7.9.8 (again)
Ævar Arnfjörð Bjarmason [Mon, 13 Sep 2021 14:51:24 +0000 (16:51 +0200)] 
Makefile: drop support for curl < 7.9.8 (again)

In 1119a15b5c8 (http: drop support for curl < 7.11.1, 2021-07-30)
support for curl versions older than 7.11.1 was removed, and we
currently require at least version 7.19.4, see 644de29e220 (http: drop
support for curl < 7.19.4, 2021-07-30).

In those changes this Makefile-specific check added in
0890098780f (Decide whether to build http-push in the Makefile,
2005-11-18) was missed, now that we're never going to use such an
ancient curl version we don't need to check that we have at least
7.9.8 here. I have no idea what in http-push.c broke on versions older
than that.

This does not impact "NO_CURL" setups, as this is in the "else" branch
after that check.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoINSTALL: mention that we need libcurl 7.19.4 or newer to build
Ævar Arnfjörð Bjarmason [Mon, 13 Sep 2021 14:51:23 +0000 (16:51 +0200)] 
INSTALL: mention that we need libcurl 7.19.4 or newer to build

Without NO_CURL=Y we require at least version "7.19.4" of libcurl, see
644de29e220 (http: drop support for curl < 7.19.4, 2021-07-30). Let's
document this in the "INSTALL" document.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoINSTALL: reword and copy-edit the "libcurl" section
Ævar Arnfjörð Bjarmason [Sat, 11 Sep 2021 09:34:16 +0000 (11:34 +0200)] 
INSTALL: reword and copy-edit the "libcurl" section

Make the "libcurl" section shorter and more to the point, this is
mostly based on suggestions from [1].

1. https://lore.kernel.org/git/YTtxcBdF2VQdWp5C@coredump.intra.peff.net/

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoINSTALL: don't mention the "curl" executable at all
Ævar Arnfjörð Bjarmason [Sat, 11 Sep 2021 09:34:15 +0000 (11:34 +0200)] 
INSTALL: don't mention the "curl" executable at all

In 1d53f90ed97 (The "curl" executable is no longer required,
2008-06-15) the wording for requiring curl(1) was changed to the
current "you might also want...".

Mentioning the "curl" executable at all is just confusing, someone
building git might want to use it to debug things, but they might also
just use wget(1) or some other http client. The "curl" executable has
the advantage that you might be able to e.g. reproduce a bug in git's
usage of libcurl with it, but anyone going to those extents is
unlikely to be aided by this note in INSTALL.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoThe fourth batch
Junio C Hamano [Wed, 8 Sep 2021 00:47:04 +0000 (17:47 -0700)] 
The fourth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge branch 'sg/column-nl'
Junio C Hamano [Wed, 8 Sep 2021 20:30:34 +0000 (13:30 -0700)] 
Merge branch 'sg/column-nl'

The parser for the "--nl" option of "git column" has been
corrected.

* sg/column-nl:
  column: fix parsing of the '--nl' option

2 years agoMerge branch 'cb/makefile-apple-clang'
Junio C Hamano [Wed, 8 Sep 2021 20:30:33 +0000 (13:30 -0700)] 
Merge branch 'cb/makefile-apple-clang'

Build update for Apple clang.

* cb/makefile-apple-clang:
  build: catch clang that identifies itself as "$VENDOR clang"
  build: clang version may not be followed by extra words
  build: update detect-compiler for newer Xcode version

2 years agoMerge branch 'ps/ls-refs-strbuf-optim'
Junio C Hamano [Wed, 8 Sep 2021 20:30:33 +0000 (13:30 -0700)] 
Merge branch 'ps/ls-refs-strbuf-optim'

Micro-optimization for the wire protocol driver.

* ps/ls-refs-strbuf-optim:
  ls-refs: reuse buffer when sending refs

2 years agoMerge branch 'rs/branch-allow-deleting-dangling'
Junio C Hamano [Wed, 8 Sep 2021 20:30:32 +0000 (13:30 -0700)] 
Merge branch 'rs/branch-allow-deleting-dangling'

"git branch -D <branch>" used to refuse to remove a broken branch
ref that points at a missing commit, which has been corrected.

* rs/branch-allow-deleting-dangling:
  branch: allow deleting dangling branches with --force

2 years agoMerge branch 'mt/quiet-with-delayed-checkout'
Junio C Hamano [Wed, 8 Sep 2021 20:30:32 +0000 (13:30 -0700)] 
Merge branch 'mt/quiet-with-delayed-checkout'

The delayed checkout code path in "git checkout" etc. were chatty
even when --quiet and/or --no-progress options were given.

* mt/quiet-with-delayed-checkout:
  checkout: make delayed checkout respect --quiet and --no-progress

2 years agoMerge branch 'rs/xopen-reports-open-failures'
Junio C Hamano [Wed, 8 Sep 2021 20:30:32 +0000 (13:30 -0700)] 
Merge branch 'rs/xopen-reports-open-failures'

Error diagnostics improvement.

* rs/xopen-reports-open-failures:
  use xopen() to handle fatal open(2) failures
  xopen: explicitly report creation failures

2 years agoMerge branch 'dd/diff-files-unmerged-fix'
Junio C Hamano [Wed, 8 Sep 2021 20:30:31 +0000 (13:30 -0700)] 
Merge branch 'dd/diff-files-unmerged-fix'

"git diff --relative" segfaulted and/or produced incorrect result
when there are unmerged paths.

* dd/diff-files-unmerged-fix:
  diff-lib: ignore paths that are outside $cwd if --relative asked

2 years agoMerge branch 'dd/t6300-wo-gpg-fix'
Junio C Hamano [Wed, 8 Sep 2021 20:30:31 +0000 (13:30 -0700)] 
Merge branch 'dd/t6300-wo-gpg-fix'

Test fix.

* dd/t6300-wo-gpg-fix:
  t6300: check for cat-file exit status code
  t6300: don't run cat-file on non-existent object

2 years agoMerge branch 'mh/credential-leakfix'
Junio C Hamano [Wed, 8 Sep 2021 20:30:30 +0000 (13:30 -0700)] 
Merge branch 'mh/credential-leakfix'

Leak fix.

* mh/credential-leakfix:
  credential: fix leak in credential_apply_config()

2 years agoMerge branch 'jk/t5323-no-pack-test-fix'
Junio C Hamano [Wed, 8 Sep 2021 20:30:30 +0000 (13:30 -0700)] 
Merge branch 'jk/t5323-no-pack-test-fix'

Test fix.

* jk/t5323-no-pack-test-fix:
  t5323: drop mentions of "master"

2 years agoMerge branch 'js/maintenance-launchctl-fix'
Junio C Hamano [Wed, 8 Sep 2021 20:30:29 +0000 (13:30 -0700)] 
Merge branch 'js/maintenance-launchctl-fix'

"git maintenance" scheduler fix for macOS.

* js/maintenance-launchctl-fix:
  maintenance: skip bootout/bootstrap when plist is registered
  maintenance: create `launchctl` configuration using a lock file

2 years agoMerge branch 'ab/rebase-fatal-fatal-fix'
Junio C Hamano [Wed, 8 Sep 2021 20:30:29 +0000 (13:30 -0700)] 
Merge branch 'ab/rebase-fatal-fatal-fix'

Error message fix.

* ab/rebase-fatal-fatal-fix:
  rebase: emit one "fatal" in "fatal: fatal: <error>"

2 years agoMerge branch 'ab/ls-remote-packet-trace'
Junio C Hamano [Wed, 8 Sep 2021 20:30:28 +0000 (13:30 -0700)] 
Merge branch 'ab/ls-remote-packet-trace'

Debugging aid fix.

* ab/ls-remote-packet-trace:
  ls-remote: set packet_trace_identity(<name>)

2 years agoMerge branch 'rs/git-mmap-uses-malloc'
Junio C Hamano [Wed, 8 Sep 2021 20:30:27 +0000 (13:30 -0700)] 
Merge branch 'rs/git-mmap-uses-malloc'

mmap() imitation used to call xmalloc() that dies upon malloc()
failure, which has been corrected to just return an error to the
caller to be handled.

* rs/git-mmap-uses-malloc:
  compat: let git_mmap use malloc(3) directly

2 years agoMerge branch 'ga/send-email-sendmail-cmd'
Junio C Hamano [Wed, 8 Sep 2021 20:30:27 +0000 (13:30 -0700)] 
Merge branch 'ga/send-email-sendmail-cmd'

Test fix.

* ga/send-email-sendmail-cmd:
  t9001: PATH must not use Windows-style paths

2 years agoMerge branch 'me/t5582-cleanup'
Junio C Hamano [Wed, 8 Sep 2021 20:30:26 +0000 (13:30 -0700)] 
Merge branch 'me/t5582-cleanup'

Test fix.

* me/t5582-cleanup:
  t5582: remove spurious 'cd "$D"' line

2 years agoThe third batch
Junio C Hamano [Fri, 3 Sep 2021 20:37:47 +0000 (13:37 -0700)] 
The third batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge branch 'sg/make-fix-ar-invocation'
Junio C Hamano [Fri, 3 Sep 2021 20:49:30 +0000 (13:49 -0700)] 
Merge branch 'sg/make-fix-ar-invocation'

Build fix.

* sg/make-fix-ar-invocation:
  Makefile: remove archives before manipulating them with 'ar'

2 years agoMerge branch 'ti/tcsh-completion-regression-fix'
Junio C Hamano [Fri, 3 Sep 2021 20:49:29 +0000 (13:49 -0700)] 
Merge branch 'ti/tcsh-completion-regression-fix'

Update to the command line completion (in contrib/) for tcsh.

* ti/tcsh-completion-regression-fix:
  completion: tcsh: Fix regression by drop of wrapper functions

2 years agoMerge branch 'fc/completion-updates'
Junio C Hamano [Fri, 3 Sep 2021 20:49:29 +0000 (13:49 -0700)] 
Merge branch 'fc/completion-updates'

Command line completion updates.

* fc/completion-updates:
  completion: bash: add correct suffix in variables
  completion: bash: fix for multiple dash commands
  completion: bash: fix for suboptions with value
  completion: bash: fix prefix detection in branch.*

2 years agoMerge branch 'pw/rebase-r-fixes'
Junio C Hamano [Fri, 3 Sep 2021 20:49:28 +0000 (13:49 -0700)] 
Merge branch 'pw/rebase-r-fixes'

Various bugs in "git rebase -r" have been fixed.

* pw/rebase-r-fixes:
  rebase -r: fix merge -c with a merge strategy
  rebase -r: don't write .git/MERGE_MSG when fast-forwarding
  rebase -i: add another reword test
  rebase -r: make 'merge -c' behave like reword

2 years agoMerge branch 'pw/rebase-skip-final-fix'
Junio C Hamano [Fri, 3 Sep 2021 20:49:28 +0000 (13:49 -0700)] 
Merge branch 'pw/rebase-skip-final-fix'

Checking out all the paths from HEAD during the last conflicted
step in "git rebase" and continuing would cause the step to be
skipped (which is expected), but leaves MERGE_MSG file behind in
$GIT_DIR and confuses the next "git commit", which has been
corrected.

* pw/rebase-skip-final-fix:
  rebase --continue: remove .git/MERGE_MSG
  rebase --apply: restore some tests
  t3403: fix commit authorship

2 years agoMerge branch 'cb/ci-use-upload-artifacts-v1'
Junio C Hamano [Fri, 3 Sep 2021 20:49:28 +0000 (13:49 -0700)] 
Merge branch 'cb/ci-use-upload-artifacts-v1'

Use upload-artifacts v1 (instead of v2) for 32-bit linux, as the
new version has a blocker bug for that architecture.

* cb/ci-use-upload-artifacts-v1:
  ci: use upload-artifacts v1 for dockerized jobs

2 years agoMerge branch 'jk/commit-edit-fixup-fix'
Junio C Hamano [Fri, 3 Sep 2021 20:49:27 +0000 (13:49 -0700)] 
Merge branch 'jk/commit-edit-fixup-fix'

"git commit --fixup" now works with "--edit" again, after it was
broken in v2.32.

* jk/commit-edit-fixup-fix:
  commit: restore --edit when combined with --fixup

2 years agoMerge branch 'ps/connectivity-optim'
Junio C Hamano [Fri, 3 Sep 2021 20:49:27 +0000 (13:49 -0700)] 
Merge branch 'ps/connectivity-optim'

The revision traversal API has been optimized by taking advantage
of the commit-graph, when available, to determine if a commit is
reachable from any of the existing refs.

* ps/connectivity-optim:
  revision: avoid hitting packfiles when commits are in commit-graph
  commit-graph: split out function to search commit position
  revision: stop retrieving reference twice
  connected: do not sort input revisions
  revision: separate walk and unsorted flags

2 years agoThe second batch
Junio C Hamano [Mon, 30 Aug 2021 23:06:22 +0000 (16:06 -0700)] 
The second batch

The most significant of this batch is of course "merge -sort".
Thanks, Elijah and everybody who helped the topic.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge branch 'cb/ci-freebsd-update'
Junio C Hamano [Mon, 30 Aug 2021 23:06:06 +0000 (16:06 -0700)] 
Merge branch 'cb/ci-freebsd-update'

Update FreeBSD CI job

* cb/ci-freebsd-update:
  ci: update freebsd 12 cirrus job

2 years agoMerge branch 'tl/traverse-non-commits-rename'
Junio C Hamano [Mon, 30 Aug 2021 23:06:06 +0000 (16:06 -0700)] 
Merge branch 'tl/traverse-non-commits-rename'

Meh.

* tl/traverse-non-commits-rename:
  list-objects.c: rename "traverse_trees_and_blobs" to "traverse_non_commits"

2 years agoMerge branch 'bc/t5607-avoid-broken-test-fail-prereqs'
Junio C Hamano [Mon, 30 Aug 2021 23:06:05 +0000 (16:06 -0700)] 
Merge branch 'bc/t5607-avoid-broken-test-fail-prereqs'

The current implementation of GIT_TEST_FAIL_PREREQS is broken in
that checking for the lack of a prerequisite would not work.  Avoid
the use of "if ! test_have_prereq X" in a test script.

* bc/t5607-avoid-broken-test-fail-prereqs:
  t5607: avoid using prerequisites to select algorithm

2 years agoMerge branch 'th/userdiff-more-java'
Junio C Hamano [Mon, 30 Aug 2021 23:06:05 +0000 (16:06 -0700)] 
Merge branch 'th/userdiff-more-java'

The userdiff pattern for "java" language has been updated.

* th/userdiff-more-java:
  userdiff: improve java hunk header regex

2 years agoMerge branch 'jk/range-diff-fixes'
Junio C Hamano [Mon, 30 Aug 2021 23:06:05 +0000 (16:06 -0700)] 
Merge branch 'jk/range-diff-fixes'

"git range-diff" code clean-up.

* jk/range-diff-fixes:
  range-diff: use ssize_t for parsed "len" in read_patches()
  range-diff: handle unterminated lines in read_patches()
  range-diff: drop useless "offset" variable from read_patches()

2 years agoMerge branch 'jk/apply-binary-hunk-parsing-fix'
Junio C Hamano [Mon, 30 Aug 2021 23:06:04 +0000 (16:06 -0700)] 
Merge branch 'jk/apply-binary-hunk-parsing-fix'

"git apply" miscounted the bytes and failed to read to the end of
binary hunks.

* jk/apply-binary-hunk-parsing-fix:
  apply: keep buffer/size pair in sync when parsing binary hunks

2 years agoMerge branch 'jc/userdiff-pattern-hint'
Junio C Hamano [Mon, 30 Aug 2021 23:06:03 +0000 (16:06 -0700)] 
Merge branch 'jc/userdiff-pattern-hint'

Remind developers that the userdiff patterns should be kept simple
and permissive, assuming that the contents they apply are always
syntactically correct.

* jc/userdiff-pattern-hint:
  userdiff: comment on the builtin patterns

2 years agoMerge branch 'cb/builtin-merge-format-string-fix'
Junio C Hamano [Mon, 30 Aug 2021 23:06:02 +0000 (16:06 -0700)] 
Merge branch 'cb/builtin-merge-format-string-fix'

Code clean-up.

* cb/builtin-merge-format-string-fix:
  builtin/merge: avoid -Wformat-extra-args from ancient Xcode

2 years agoMerge branch 'js/log-protocol-version'
Junio C Hamano [Mon, 30 Aug 2021 23:06:02 +0000 (16:06 -0700)] 
Merge branch 'js/log-protocol-version'

Debugging aid.

* js/log-protocol-version:
  connect, protocol: log negotiated protocol version

2 years agoMerge branch 'en/ort-becomes-the-default'
Junio C Hamano [Mon, 30 Aug 2021 23:06:01 +0000 (16:06 -0700)] 
Merge branch 'en/ort-becomes-the-default'

Use `ort` instead of `recursive` as the default merge strategy.

* en/ort-becomes-the-default:
  Update docs for change of default merge backend
  Change default merge backend from recursive to ort

2 years agoMerge branch 'en/merge-strategy-docs'
Junio C Hamano [Mon, 30 Aug 2021 23:06:01 +0000 (16:06 -0700)] 
Merge branch 'en/merge-strategy-docs'

Documentation updates.

* en/merge-strategy-docs:
  Update error message and code comment
  merge-strategies.txt: add coverage of the `ort` merge strategy
  git-rebase.txt: correct out-of-date and misleading text about renames
  merge-strategies.txt: fix simple capitalization error
  merge-strategies.txt: avoid giving special preference to patience algorithm
  merge-strategies.txt: do not imply using copy detection is desired
  merge-strategies.txt: update wording for the resolve strategy
  Documentation: edit awkward references to `git merge-recursive`
  directory-rename-detection.txt: small updates due to merge-ort optimizations
  git-rebase.txt: correct antiquated claims about --rebase-merges

2 years agoMerge branch 'en/pull-conflicting-options'
Junio C Hamano [Mon, 30 Aug 2021 23:06:01 +0000 (16:06 -0700)] 
Merge branch 'en/pull-conflicting-options'

"git pull" had various corner cases that were not well thought out
around its --rebase backend, e.g. "git pull --ff-only" did not stop
but went ahead and rebased when the history on other side is not a
descendant of our history.  The series tries to fix them up.

* en/pull-conflicting-options:
  pull: fix handling of multiple heads
  pull: update docs & code for option compatibility with rebasing
  pull: abort by default when fast-forwarding is not possible
  pull: make --rebase and --no-rebase override pull.ff=only
  pull: since --ff-only overrides, handle it first
  pull: abort if --ff-only is given and fast-forwarding is impossible
  t7601: add tests of interactions with multiple merge heads and config
  t7601: test interaction of merge/rebase/fast-forward flags and options

2 years agobranch: allow deleting dangling branches with --force
René Scharfe [Fri, 27 Aug 2021 18:35:35 +0000 (20:35 +0200)] 
branch: allow deleting dangling branches with --force

git branch only allows deleting branches that point to valid commits.
Skip that check if --force is given, as the caller is indicating with
it that they know what they are doing and accept the consequences.
This allows deleting dangling branches, which previously had to be
reset to a valid start-point using --force first.

Reported-by: Ulrich Windl <Ulrich.Windl@rz.uni-regensburg.de>
Helped-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agocheckout: make delayed checkout respect --quiet and --no-progress
Matheus Tavares [Thu, 26 Aug 2021 19:10:06 +0000 (16:10 -0300)] 
checkout: make delayed checkout respect --quiet and --no-progress

The 'Filtering contents...' progress report from delayed checkout is
displayed even when checkout and clone are invoked with --quiet or
--no-progress. Furthermore, it is displayed unconditionally, without
first checking whether stdout is a tty. Let's fix these issues and also
add some regression tests for the two code paths that currently use
delayed checkout: unpack_trees.c:check_updates() and
builtin/checkout.c:checkout_worktree().

Signed-off-by: Matheus Tavares <matheus.bernardino@usp.br>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agocolumn: fix parsing of the '--nl' option
SZEDER Gábor [Wed, 18 Aug 2021 09:24:56 +0000 (11:24 +0200)] 
column: fix parsing of the '--nl' option

'git column's '--nl' option can be used to specify a "string to be
printed at the end of each line" (quoting the man page), but this
option and its mandatory argument has been parsed as OPT_INTEGER since
the introduction of the command in 7e29b8254f (Add column layout
skeleton and git-column, 2012-04-21).  Consequently, any non-number
argument is rejected by parse-options, and any number other than 0
leads to segfault:

  $ printf "%s\n" one two |git column --mode=plain --nl=foo
  error: option `nl' expects a numerical value
  $ printf "%s\n" one two |git column --mode=plain --nl=42
  Segmentation fault (core dumped)
  $ printf "%s\n" one two |git column --mode=plain --nl=0
  one
  two

Parse this option as OPT_STRING.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agols-refs: reuse buffer when sending refs
Patrick Steinhardt [Wed, 25 Aug 2021 13:49:51 +0000 (15:49 +0200)] 
ls-refs: reuse buffer when sending refs

In the initial reference advertisement, the Git server will first
announce all of its references to the client. The logic is handled in
`send_ref()`, which will allocate a new buffer for each refline it is
about to send. This is quite wasteful: instead of allocating a new
buffer each time, we can just reuse a buffer.

Improve this by passing in a buffer via the `ls_refs_data` struct which
is then reused on each reference.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agouse xopen() to handle fatal open(2) failures
René Scharfe [Wed, 25 Aug 2021 20:16:46 +0000 (22:16 +0200)] 
use xopen() to handle fatal open(2) failures

Add and apply a semantic patch for using xopen() instead of calling
open(2) and die() or die_errno() explicitly.  This makes the error
messages more consistent and shortens the code.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoxopen: explicitly report creation failures
René Scharfe [Wed, 25 Aug 2021 20:14:09 +0000 (22:14 +0200)] 
xopen: explicitly report creation failures

If the flags O_CREAT and O_EXCL are both given then open(2) is supposed
to create the file and error out if it already exists.  The error
message in that case looks like this:

fatal: could not open 'foo' for writing: File exists

Without further context this is confusing: Why should the existence of
the file pose a problem?  Isn't that a requirement for writing to it?

Add a more specific error message for that case to tell the user that we
actually don't expect the file to preexist, so the example becomes:

fatal: unable to create 'foo': File exists

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agodiff-lib: ignore paths that are outside $cwd if --relative asked
Đoàn Trần Công Danh [Sun, 22 Aug 2021 08:49:08 +0000 (15:49 +0700)] 
diff-lib: ignore paths that are outside $cwd if --relative asked

For diff family commands, we can tell them to exclude changes outside
of some directories if --relative is requested.

In diff_unmerge(), NULL will be returned if the requested path is
outside of the interesting directories, thus we'll run into NULL
pointer dereference in run_diff_files when trying to dereference
its return value.

Checking for return value of diff_unmerge before dereferencing
is not sufficient, though. Since, diff engine will try to work on such
pathspec later.

Let's not run diff on those unintesting entries, instead.
As a side effect, by skipping like that, we can save some CPU cycles.

Reported-by: Thomas De Zeeuw <thomas@slight.dev>
Tested-by: Carlo Arenas <carenas@gmail.com>
Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agot6300: check for cat-file exit status code
Đoàn Trần Công Danh [Sat, 21 Aug 2021 01:36:34 +0000 (08:36 +0700)] 
t6300: check for cat-file exit status code

In test_atom(), we're piping the output of cat-file to tail(1),
thus, losing its exit status.

Let's use a temporary file to preserve git exit status code.

Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agot6300: don't run cat-file on non-existent object
Đoàn Trần Công Danh [Sat, 21 Aug 2021 01:36:33 +0000 (08:36 +0700)] 
t6300: don't run cat-file on non-existent object

In t6300, some tests are guarded behind some prerequisites.
Thus, objects created by those tests ain't available if those
prerequisites are unsatistified.  Attempting to run "cat-file"
on those objects will run into failure.

In fact, running t6300 in an environment without gpg(1),
we'll see those warnings:

fatal: Not a valid object name refs/tags/signed-empty
fatal: Not a valid object name refs/tags/signed-short
fatal: Not a valid object name refs/tags/signed-long

Let's put those commands into the real tests, in order to:

* skip their execution if prerequisites aren't satistified.
* check their exit status code

The expected value for objects with type: commit needs to be
computed outside the test because we can't rely on "$3" there.
Furthermore, to prevent the accidental usage of that computed
expected value, BUG out on unknown object's type.

Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agocredential: fix leak in credential_apply_config()
Mike Hommey [Fri, 20 Aug 2021 08:44:13 +0000 (17:44 +0900)] 
credential: fix leak in credential_apply_config()

Signed-off-by: Mike Hommey <mh@glandium.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agot5323: drop mentions of "master"
Jeff King [Wed, 25 Aug 2021 01:35:52 +0000 (21:35 -0400)] 
t5323: drop mentions of "master"

Commit 0696232390 (pack-redundant: fix crash when one packfile in repo,
2020-12-16) added one some new tests to t5323. At the time, the sub-repo
we used was called "master". But in a parallel branch, this was switched
to "main".

When the latter branch was merged in 27d7c8599b (Merge branch
'js/default-branch-name-tests-final-stretch', 2021-01-25), some of those
spots caused textual conflicts, but some (for tests that were far enough
away from other changed code) were just semantic. The merge resolution
fixed up most spots, but missed this one.

Even though this did impact actual code, it turned out not to fail the
tests. Running 'cd "$master_repo"' ended up staying in the same
directory, running the test in the main trash repo instead of the
sub-repo. But because the point of the test is checking behavior when
there are no packfiles, it worked in either repo (since both are empty
at this point in the script).

Reported-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoThe first batch post 2.33
Junio C Hamano [Tue, 24 Aug 2021 22:33:23 +0000 (15:33 -0700)] 
The first batch post 2.33

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge branch 'ps/fetch-pack-load-refs-optim'
Junio C Hamano [Tue, 24 Aug 2021 22:32:41 +0000 (15:32 -0700)] 
Merge branch 'ps/fetch-pack-load-refs-optim'

Loading of ref tips to prepare for common ancestry negotiation in
"git fetch-pack" has been optimized by taking advantage of the
commit graph when available.

* ps/fetch-pack-load-refs-optim:
  fetch-pack: speed up loading of refs via commit graph

2 years agoMerge branch 'jt/push-negotiation-fixes'
Junio C Hamano [Tue, 24 Aug 2021 22:32:40 +0000 (15:32 -0700)] 
Merge branch 'jt/push-negotiation-fixes'

Bugfix for common ancestor negotiation recently introduced in "git
push" code path.

* jt/push-negotiation-fixes:
  fetch: die on invalid --negotiation-tip hash
  send-pack: fix push nego. when remote has refs
  send-pack: fix push.negotiate with remote helper

2 years agoMerge branch 'es/trace2-log-parent-process-name'
Junio C Hamano [Tue, 24 Aug 2021 22:32:40 +0000 (15:32 -0700)] 
Merge branch 'es/trace2-log-parent-process-name'

trace2 logs learned to show parent process name to see in what
context Git was invoked.

* es/trace2-log-parent-process-name:
  tr2: log parent process name
  tr2: make process info collection platform-generic

2 years agoMerge branch 'hn/refs-test-cleanup'
Junio C Hamano [Tue, 24 Aug 2021 22:32:39 +0000 (15:32 -0700)] 
Merge branch 'hn/refs-test-cleanup'

A handful of tests that assumed implementation details of files
backend for refs have been cleaned up.

* hn/refs-test-cleanup:
  t6001: avoid direct file system access
  t6500: use "ls -1" to snapshot ref database state
  t7064: use update-ref -d to remove upstream branch
  t1410: mark test as REFFILES
  t1405: mark test for 'git pack-refs' as REFFILES
  t1405: use 'git reflog exists' to check reflog existence
  t2402: use ref-store test helper to create broken symlink
  t3320: use git-symbolic-ref rather than filesystem access
  t6120: use git-update-ref rather than filesystem access
  t1503: mark symlink test as REFFILES
  t6050: use git-update-ref rather than filesystem access

2 years agoMerge branch 'en/ort-perf-batch-15'
Junio C Hamano [Tue, 24 Aug 2021 22:32:39 +0000 (15:32 -0700)] 
Merge branch 'en/ort-perf-batch-15'

Final batch for "merge -sort" optimization.

* en/ort-perf-batch-15:
  merge-ort: remove compile-time ability to turn off usage of memory pools
  merge-ort: reuse path strings in pool_alloc_filespec
  merge-ort: store filepairs and filespecs in our mem_pool
  diffcore-rename, merge-ort: add wrapper functions for filepair alloc/dealloc
  merge-ort: switch our strmaps over to using memory pools
  merge-ort: set up a memory pool
  merge-ort: add pool_alloc, pool_calloc, and pool_strndup wrappers
  diffcore-rename: use a mem_pool for exact rename detection's hashmap
  merge-ort: rename str{map,intmap,set}_func()

2 years agoMerge branch 'js/expand-runtime-prefix'
Junio C Hamano [Tue, 24 Aug 2021 22:32:38 +0000 (15:32 -0700)] 
Merge branch 'js/expand-runtime-prefix'

Pathname expansion (like "~username/") learned a way to specify a
location relative to Git installation (e.g. its $sharedir which is
$(prefix)/share), with "%(prefix)".

* js/expand-runtime-prefix:
  expand_user_path: allow in-flight topics to keep using the old name
  interpolate_path(): allow specifying paths relative to the runtime prefix
  Use a better name for the function interpolating paths
  expand_user_path(): clarify the role of the `real_home` parameter
  expand_user_path(): remove stale part of the comment
  tests: exercise the RUNTIME_PREFIX feature

2 years agoMerge branch 'ab/bundle-doc'
Junio C Hamano [Tue, 24 Aug 2021 22:32:37 +0000 (15:32 -0700)] 
Merge branch 'ab/bundle-doc'

Doc update.

* ab/bundle-doc:
  bundle doc: replace "basis" with "prerequsite(s)"
  bundle doc: elaborate on rev<->ref restriction
  bundle doc: elaborate on object prerequisites
  bundle doc: rewrite the "DESCRIPTION" section

2 years agoMerge branch 'zh/ref-filter-raw-data'
Junio C Hamano [Tue, 24 Aug 2021 22:32:37 +0000 (15:32 -0700)] 
Merge branch 'zh/ref-filter-raw-data'

Prepare the "ref-filter" machinery that drives the "--format"
option of "git for-each-ref" and its friends to be used in "git
cat-file --batch".

* zh/ref-filter-raw-data:
  ref-filter: add %(rest) atom
  ref-filter: use non-const ref_format in *_atom_parser()
  ref-filter: --format=%(raw) support --perl
  ref-filter: add %(raw) atom
  ref-filter: add obj-type check in grab contents

2 years agoMerge branch 'ab/pack-stdin-packs-fix'
Junio C Hamano [Tue, 24 Aug 2021 22:32:36 +0000 (15:32 -0700)] 
Merge branch 'ab/pack-stdin-packs-fix'

Input validation of "git pack-objects --stdin-packs" has been
corrected.

* ab/pack-stdin-packs-fix:
  pack-objects: fix segfault in --stdin-packs option
  pack-objects tests: cover blindspots in stdin handling

2 years agoMerge branch 'ab/http-drop-old-curl'
Junio C Hamano [Tue, 24 Aug 2021 22:32:36 +0000 (15:32 -0700)] 
Merge branch 'ab/http-drop-old-curl'

Support for ancient versions of cURL library (pre 7.19.4) has been
dropped.

* ab/http-drop-old-curl:
  http: rename CURLOPT_FILE to CURLOPT_WRITEDATA
  http: drop support for curl < 7.19.3 and < 7.17.0 (again)
  http: drop support for curl < 7.19.4
  http: drop support for curl < 7.16.0
  http: drop support for curl < 7.11.1

2 years agoMerge branch 'ds/add-with-sparse-index'
Junio C Hamano [Tue, 24 Aug 2021 22:32:35 +0000 (15:32 -0700)] 
Merge branch 'ds/add-with-sparse-index'

"git add" can work better with the sparse index.

* ds/add-with-sparse-index:
  add: remove ensure_full_index() with --renormalize
  add: ignore outside the sparse-checkout in refresh()
  pathspec: stop calling ensure_full_index
  add: allow operating on a sparse-only index
  t1092: test merge conflicts outside cone

2 years agoMerge branch 'jc/bisect-sans-show-branch'
Junio C Hamano [Tue, 24 Aug 2021 22:32:35 +0000 (15:32 -0700)] 
Merge branch 'jc/bisect-sans-show-branch'

"git bisect" spawned "git show-branch" only to pretty-print the
title of the commit after checking out the next version to be
tested; this has been rewritten in C.

* jc/bisect-sans-show-branch:
  bisect: simplify return code from bisect_checkout()
  bisect: do not run show-branch just to show the current commit

2 years agorebase: emit one "fatal" in "fatal: fatal: <error>"
Ævar Arnfjörð Bjarmason [Mon, 23 Aug 2021 13:07:41 +0000 (15:07 +0200)] 
rebase: emit one "fatal" in "fatal: fatal: <error>"

The die() routine adds a "fatal: " prefix, there is no reason to add
another one. Fixes code added in e65123a71d0 (builtin rebase: support
`git rebase <upstream> <switch-to>`, 2018-09-04).

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agols-remote: set packet_trace_identity(<name>)
Ævar Arnfjörð Bjarmason [Mon, 23 Aug 2021 13:17:49 +0000 (15:17 +0200)] 
ls-remote: set packet_trace_identity(<name>)

Set packet_trace_identity() for ls-remote. This replaces the generic
"git" identity in GIT_TRACE_PACKET=<file> traces to "ls-remote", e.g.:

    [...] packet:  upload-pack> version 2
    [...] packet:  upload-pack> agent=git/2.32.0-dev
    [...] packet:    ls-remote< version 2
    [...] packet:    ls-remote< agent=git/2.32.0-dev

Where in an "git ls-remote file://<path>" dialog ">" is the sender (or
"to the server") and "<" is the recipient (or "received by the
client").

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agocompat: let git_mmap use malloc(3) directly
René Scharfe [Sat, 21 Aug 2021 12:52:40 +0000 (14:52 +0200)] 
compat: let git_mmap use malloc(3) directly

xmalloc() dies on error, allows zero-sized allocations and enforces
GIT_ALLOC_LIMIT for testing.  Our mmap replacement doesn't need any of
that.  Let's cut out the wrapper, reject zero-sized requests as required
by POSIX and use malloc(3) directly.  Allocation errors were needlessly
handled by git_mmap() before; this code becomes reachable now.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agomaintenance: skip bootout/bootstrap when plist is registered
Derrick Stolee [Tue, 24 Aug 2021 15:44:00 +0000 (15:44 +0000)] 
maintenance: skip bootout/bootstrap when plist is registered

On macOS, we use launchctl to manage the background maintenance
schedule. This uses a set of .plist files to describe the schedule, but
these files are also registered with 'launchctl bootstrap'. If multiple
'git maintenance start' commands run concurrently, then they can collide
replacing these schedule files and registering them with launchctl.

To avoid extra launchctl commands, do a check for the .plist files on
disk and check if they are registered using 'launchctl list <name>'.
This command will return with exit code 0 if it exists, or exit code 113
if it does not.

We can test this behavior using the GIT_TEST_MAINT_SCHEDULER environment
variable.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agomaintenance: create `launchctl` configuration using a lock file
Johannes Schindelin [Tue, 24 Aug 2021 15:43:59 +0000 (15:43 +0000)] 
maintenance: create `launchctl` configuration using a lock file

When two `git maintenance` processes try to write the `.plist` file, we
need to help them with serializing their efforts.

The 150ms time-out value was determined from thin air.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agot9001: PATH must not use Windows-style paths
Johannes Sixt [Tue, 24 Aug 2021 18:01:29 +0000 (20:01 +0200)] 
t9001: PATH must not use Windows-style paths

On Windows, $(pwd) returns a drive-letter style path C:/foo, while $PWD
contains a POSIX style /c/foo path. When we want to interpolate the
current directory in the PATH variable, we must not use the C:/foo style,
because the meaning of the colon is ambiguous. Use the POSIX style.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agot5582: remove spurious 'cd "$D"' line
Mickey Endito [Mon, 23 Aug 2021 20:12:40 +0000 (20:12 +0000)] 
t5582: remove spurious 'cd "$D"' line

The variable D is never defined in test t5582, more severely the test
fails if D is defined by something outside the test suite, so remove
this spurious line.

Signed-off-by: Mickey Endito <mickey.endito.2323@protonmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agorebase -r: fix merge -c with a merge strategy
Phillip Wood [Fri, 20 Aug 2021 15:40:38 +0000 (15:40 +0000)] 
rebase -r: fix merge -c with a merge strategy

If a rebase is started with a --strategy option other than "ort" or
"recursive" then "merge -c" does not allow the user to reword the
commit message.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agorebase -r: don't write .git/MERGE_MSG when fast-forwarding
Phillip Wood [Fri, 20 Aug 2021 15:40:37 +0000 (15:40 +0000)] 
rebase -r: don't write .git/MERGE_MSG when fast-forwarding

When fast-forwarding we do not create a new commit so .git/MERGE_MSG
is not removed and can end up seeding the message of a commit made
after the rebase has finished. Avoid writing .git/MERGE_MSG when we
are fast-forwarding by writing the file after the fast-forward
checks. Note that there are no changes to the fast-forward code, it is
simply moved.

Note that the way this change is implemented means we no longer write
the author script when fast-forwarding either. I believe this is safe
for the reasons below but it is a departure from what we do when
fast-forwarding a non-merge commit. If we reword the merge then 'git
commit --amend' will keep the authorship of the commit we're rewording
as it ignores GIT_AUTHOR_* unless --reset-author is passed. It will
also export the correct GIT_AUTHOR_* variables to any hooks and we
already test the authorship of the reworded commit. If we are not
rewording then we no longer call spilt_ident() which means we are no
longer checking the commit author header looks sane. However this is
what we already do when fast-forwarding non-merge commits in
skip_unnecessary_picks() so I don't think we're breaking any promises
by not checking the author here.

Reported-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agorebase -i: add another reword test
Phillip Wood [Fri, 20 Aug 2021 15:40:36 +0000 (15:40 +0000)] 
rebase -i: add another reword test

None of the existing reword tests check that there are no uncommitted
changes when the editor is opened. Reuse the editor script from the
last commit to fix this omission.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agorebase -r: make 'merge -c' behave like reword
Phillip Wood [Fri, 20 Aug 2021 15:40:35 +0000 (15:40 +0000)] 
rebase -r: make 'merge -c' behave like reword

If the user runs git log while rewording a commit it is confusing if
sometimes we're amending the commit that's being reworded and at other
times we're creating a new commit depending on whether we could
fast-forward or not[1]. For this reason the reword command ensures
that there are no uncommitted changes when rewording. The reword
command also allows the user to edit the todo list while the rebase is
paused. As 'merge -c' also rewords commits make it behave like reword
and add a test.

[1] https://lore.kernel.org/git/xmqqlfvu4be3.fsf@gitster-ct.c.googlers.com/T/#m133009cb91cf0917bcf667300f061178be56680a

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMakefile: remove archives before manipulating them with 'ar'
SZEDER Gábor [Wed, 18 Aug 2021 21:36:11 +0000 (23:36 +0200)] 
Makefile: remove archives before manipulating them with 'ar'

The rules creating the $(LIB_FILE) and $(XDIFF_LIB) archives used to
be:

  $(QUIET_AR)$(RM) $@ && $(AR) $(ARFLAGS) $@ $^

until commit 7b76d6bf22 (Makefile: add and use the ".DELETE_ON_ERROR"
flag, 2021-06-29) removed the '$(RM) $@' part, claiming that "we can
rely on the "c" (create) being present in ARFLAGS", and (I presume)
assuming that it means that the named archive is created from scratch.

Unfortunately, that's not what the 'c' flag does, it merely "Suppress
the diagnostic message that is written to standard error by default
when the archive is created" [1].  Consequently, all object files that
are already present in an existing archive and are not replaced will
remain there.  This leads to linker errors in back-to-back builds of
different revisions without a 'make clean' between them if source
files going into these archives are renamed in between:

  # The last commit renaming files that go into 'libgit.a':
  # bc62692757 (hash-lookup: rename from sha1-lookup, 2020-12-31)
  #  sha1-lookup.c => hash-lookup.c | 14 +++++++-------
  #  sha1-lookup.h => hash-lookup.h | 12 ++++++------
  $ git checkout bc62692757^
  HEAD is now at 7a7d992d0d sha1-lookup: rename `sha1_pos()` as `hash_pos()`
  $ make
  [...]
  $ git checkout 7b76d6bf22
  HEAD is now at 7b76d6bf22 Makefile: add and use the ".DELETE_ON_ERROR" flag
  $ make
  [...]
      AR libgit.a
      LINK git
  /usr/bin/ld: libgit.a(hash-lookup.o): in function `bsearch_hash':
  /home/szeder/src/git/hash-lookup.c:105: multiple definition of `bsearch_hash'; libgit.a(sha1-lookup.o):/home/szeder/src/git/sha1-lookup.c:105: first defined here
  collect2: error: ld returned 1 exit status
  make: *** [Makefile:2213: git] Error 1

Restore the original make rules to first remove $(LIB_FILE) and
$(XDIFF_LIB) and then create them from scratch to avoid these build
errors.

[1] Quoting POSIX at:
    https://pubs.opengroup.org/onlinepubs/9699919799/utilities/ar.html

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agocompletion: tcsh: Fix regression by drop of wrapper functions
Takashi Iwai [Wed, 18 Aug 2021 13:27:29 +0000 (15:27 +0200)] 
completion: tcsh: Fix regression by drop of wrapper functions

The cleanup of old compat wrappers in bash completion caused a
regression on tcsh completion that still uses them.
Let's update the tcsh call site as well for addressing it.

Fixes: 441ecdab37fe ("completion: bash: remove old compat wrappers")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agocompletion: bash: add correct suffix in variables
Felipe Contreras [Mon, 16 Aug 2021 09:10:25 +0000 (04:10 -0500)] 
completion: bash: add correct suffix in variables

__gitcomp automatically adds a suffix, but __gitcomp_nl and others
don't, we need to specify a space by default.

Can be tested with:

  git config branch.autoSetupMe<tab>

This fix only works for versions of bash greater than 4.0, before that
"local sfx" creates an empty string, therefore the unset expansion
doesn't work. The same happens in zsh.

Therefore we don't add the test for that for now.

The correct fix for all shells requires semantic changes in __gitcomp,
but that can be done later.

Cc: SZEDER Gábor <szeder.dev@gmail.com>
Tested-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agocompletion: bash: fix for multiple dash commands
Felipe Contreras [Mon, 16 Aug 2021 09:10:24 +0000 (04:10 -0500)] 
completion: bash: fix for multiple dash commands

Otherwise options of commands like 'for-each-ref' are not completed.

Tested-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agocompletion: bash: fix for suboptions with value
Felipe Contreras [Mon, 16 Aug 2021 09:10:23 +0000 (04:10 -0500)] 
completion: bash: fix for suboptions with value

We need to ignore options that don't start with -- as well.

Depending on the value of COMP_WORDBREAKS the last word could be
duplicated otherwise.

Can be tested with:

  git merge -X diff-algorithm=<tab>

Tested-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agocompletion: bash: fix prefix detection in branch.*
Felipe Contreras [Mon, 16 Aug 2021 09:10:22 +0000 (04:10 -0500)] 
completion: bash: fix prefix detection in branch.*

Otherwise we are completely ignoring the --cur argument.

The issue can be tested with:

  git clone --config=branch.<tab>

Reviewed-by: SZEDER Gábor <szeder.dev@gmail.com>
Tested-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoGit 2.33 v2.33.0
Junio C Hamano [Mon, 16 Aug 2021 19:15:44 +0000 (12:15 -0700)] 
Git 2.33

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge branch 'rs/oidtree-alignment-fix'
Junio C Hamano [Mon, 16 Aug 2021 19:14:35 +0000 (12:14 -0700)] 
Merge branch 'rs/oidtree-alignment-fix'

Codepath to access recently added oidtree data structure had
to make unaligned accesses to oids, which has been corrected.

* rs/oidtree-alignment-fix:
  oidtree: avoid unaligned access to crit-bit tree

2 years agoMerge tag 'l10n-2.33.0-rnd2' of git://github.com/git-l10n/git-po
Junio C Hamano [Mon, 16 Aug 2021 16:38:57 +0000 (09:38 -0700)] 
Merge tag 'l10n-2.33.0-rnd2' of git://github.com/git-l10n/git-po

l10n-2.33.0-rnd2

* tag 'l10n-2.33.0-rnd2' of git://github.com/git-l10n/git-po: (46 commits)
  l10n: sv.po: Update Swedish translation (5230t0f0u)
  l10n: TEAMS: change Simplified Chinese team leader
  l10n: tr: v2.33 (round 2)
  l10n: es: 2.33.0 round 2
  l10n: zh_CN: for git v2.33.0 l10n round 2
  l10n: zh_CN: Revision for git v2.32.0 l10n round 1
  l10n: README: refactor to use GFM syntax
  l10n: update German translation for Git v2.33.0 (rnd2)
  l10n: pt_PT: v2.33.0 round 2
  l10n: pt_PT: git-po-helper update
  l10n: pt_PT: update translation table
  l10n: zh_TW.po: remove the obsolete glossary
  l10n: vi.po(5230t): Updated translation for v2.32.0 round 2
  l10n: fr.po v2.33 rnd 2
  l10n: id: po-id for 2.33.0 round 2
  l10n: zh_TW.po: update for v2.33.0 rnd 2
  l10n: git.pot: v2.33.0 round 2 (11 new, 8 removed)
  l10n: de.po: fix typos
  l10n: update German translation for Git v2.33.0
  l10n: fr.po fix typos in commands and variables
  ...

2 years agol10n: sv.po: Update Swedish translation (5230t0f0u)
Peter Krefting [Sat, 14 Aug 2021 20:15:58 +0000 (21:15 +0100)] 
l10n: sv.po: Update Swedish translation (5230t0f0u)

Also fixed some typos reported by "git-po-helper".

Signed-off-by: Peter Krefting <peter@softwolves.pp.se>
Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
2 years agol10n: TEAMS: change Simplified Chinese team leader
Jiang Xin [Sun, 15 Aug 2021 22:39:30 +0000 (06:39 +0800)] 
l10n: TEAMS: change Simplified Chinese team leader

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
2 years agooidtree: avoid unaligned access to crit-bit tree
René Scharfe [Sat, 14 Aug 2021 20:00:38 +0000 (22:00 +0200)] 
oidtree: avoid unaligned access to crit-bit tree

The flexible array member "k" of struct cb_node is used to store the key
of the crit-bit tree node.  It offers no alignment guarantees -- in fact
the current struct layout puts it one byte after a 4-byte aligned
address, i.e. guaranteed to be misaligned.

oidtree uses a struct object_id as cb_node key.  Since cf0983213c (hash:
add an algo member to struct object_id, 2021-04-26) it requires 4-byte
alignment.  The mismatch is reported by UndefinedBehaviorSanitizer at
runtime like this:

hash.h:277:2: runtime error: member access within misaligned address 0x00015000802d for type 'struct object_id', which requires 4 byte alignment
0x00015000802d: note: pointer points here
 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00
             ^
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior hash.h:277:2 in

We can fix that by:

1. eliminating the alignment requirement of struct object_id,
2. providing the alignment in struct cb_node, or
3. avoiding the issue by only using memcpy to access "k".

Currently we only store one of two values in "algo" in struct object_id.
We could use a uint8_t for that instead and widen it only once we add
support for our twohundredth algorithm or so.  That would not only avoid
alignment issues, but also reduce the memory requirements for each
instance of struct object_id by ca. 9%.

Supporting keys with alignment requirements might be useful to spread
the use of crit-bit trees.  It can be achieved by using a wider type for
"k" (e.g. uintmax_t), using different types for the members "byte" and
"otherbits" (e.g. uint16_t or uint32_t for each), or by avoiding the use
of flexible arrays like khash.h does.

This patch implements the third option, though, because it has the least
potential for causing side-effects and we're close to the next release.
If one of the other options is implemented later as well to get their
additional benefits we can get rid of the extra copies introduced here.

Reported-by: Andrzej Hunt <andrzej@ahunt.org>
Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoci: use upload-artifacts v1 for dockerized jobs
Carlo Marcelo Arenas Belón [Fri, 13 Aug 2021 09:13:49 +0000 (02:13 -0700)] 
ci: use upload-artifacts v1 for dockerized jobs

e9f79acb28 (ci: upgrade to using actions/{up,down}load-artifacts v2,
2021-06-23) changed all calls to that action from v1 to v2, but there
is still an open bug[1] that affects all nodejs actions and prevents
its use in 32-bit linux (as used by the Linux32 container)

move all dockerized jobs to use v1 that was built in C# and therefore
doesn't have this problem, which will otherwise manifest with confusing
messages like:

  /usr/bin/docker exec  0285adacc4536b7cd962079c46f85fa05a71e66d7905b5e4b9b1a0e8b305722a sh -c "cat /etc/*release | grep ^ID"
  OCI runtime exec failed: exec failed: container_linux.go:380: starting container process caused: no such file or directory: unknown

[1] https://github.com/actions/runner/issues/1011

Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
Acked-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agocommit: restore --edit when combined with --fixup
Joel Klinghed [Sat, 14 Aug 2021 21:40:30 +0000 (21:40 +0000)] 
commit: restore --edit when combined with --fixup

Recent changes to --fixup, adding amend suboption, caused the
--edit flag to be ignored as use_editor was always set to zero.

Restore edit_flag having higher priority than fixup_message when
deciding the value of use_editor by moving the edit flag condition
later in the method.

Signed-off-by: Joel Klinghed <the_jk@spawned.biz>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge branch 'next' of github.com:ChrisADR/git-po
Jiang Xin [Sun, 15 Aug 2021 10:32:20 +0000 (18:32 +0800)] 
Merge branch 'next' of github.com:ChrisADR/git-po

* 'next' of github.com:ChrisADR/git-po:
  l10n: es: 2.33.0 round 2

2 years agol10n: tr: v2.33 (round 2)
Emir Sarı [Sun, 15 Aug 2021 07:17:15 +0000 (10:17 +0300)] 
l10n: tr: v2.33 (round 2)

Signed-off-by: Emir Sarı <bitigchi@me.com>
2 years agol10n: es: 2.33.0 round 2
Christopher Diaz Riveros [Sat, 14 Aug 2021 16:13:11 +0000 (11:13 -0500)] 
l10n: es: 2.33.0 round 2

Signed-off-by: Christopher Diaz Riveros <christopher.diaz.riv@gmail.com>
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Javier Spagnoletti phansys@gmail.com
Signed-off-by: Cleydyr Albuquerque <cleydyr@gmail.com>
Signed-off-by: Andrei Rybak <rybak.a.v@gmail.com>
Signed-off-by: Guillermo Ramos <gramosg>
2 years agol10n: zh_CN: for git v2.33.0 l10n round 2
Jiang Xin [Mon, 2 Aug 2021 00:25:39 +0000 (08:25 +0800)] 
l10n: zh_CN: for git v2.33.0 l10n round 2

Translate 48 new messages (5230t0f0u) for git 2.33.0, and also fixed
typos found by "git-po-helper".

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
Signed-off-by: Fangyi Zhou <me@fangyi.io>
2 years agol10n: zh_CN: Revision for git v2.32.0 l10n round 1
Fangyi Zhou [Mon, 7 Jun 2021 04:59:56 +0000 (12:59 +0800)] 
l10n: zh_CN: Revision for git v2.32.0 l10n round 1

Signed-off-by: Fangyi Zhou <me@fangyi.io>