]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
9 months agoavoid SHA-1 functions deprecated in OpenSSL 3+
Eric Wong [Tue, 1 Aug 2023 02:54:54 +0000 (02:54 +0000)] 
avoid SHA-1 functions deprecated in OpenSSL 3+

OpenSSL 3+ deprecates the SHA1_Init, SHA1_Update, and SHA1_Final
functions, leading to errors when building with `DEVELOPER=1'.

Use the newer EVP_* API with OpenSSL 3+ (only) despite being more
error-prone and less efficient due to heap allocations.

Signed-off-by: Eric Wong <e@80x24.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agosha256: avoid functions deprecated in OpenSSL 3+
Eric Wong [Tue, 1 Aug 2023 02:54:53 +0000 (02:54 +0000)] 
sha256: avoid functions deprecated in OpenSSL 3+

OpenSSL 3+ deprecates the SHA256_Init, SHA256_Update, and SHA256_Final
functions, leading to errors when building with `DEVELOPER=1'.

Use the newer EVP_* API with OpenSSL 3+ despite being more
error-prone and less efficient due to heap allocations.

Signed-off-by: Eric Wong <e@80x24.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 months agoMerge branch 'jk/redact-h2h3-headers-fix' into maint-2.41
Junio C Hamano [Sat, 24 Jun 2023 22:04:48 +0000 (15:04 -0700)] 
Merge branch 'jk/redact-h2h3-headers-fix' into maint-2.41

* jk/redact-h2h3-headers-fix:
  http: handle both "h2" and "h2h3" in curl info lines

11 months agohttp: handle both "h2" and "h2h3" in curl info lines
Jeff King [Sat, 17 Jun 2023 05:15:59 +0000 (01:15 -0400)] 
http: handle both "h2" and "h2h3" in curl info lines

When redacting auth tokens in trace output from curl, we look for http/2
headers of the form "h2h3 [header: value]". This comes from b637a41ebe
(http: redact curl h2h3 headers in info, 2022-11-11).

But the "h2h3" prefix changed to just "h2" in curl's fc2f1e547 (http2:
support HTTP/2 to forward proxies, non-tunneling, 2023-04-14). That's in
released version curl 8.1.0; linking against that version means we'll
fail to correctly redact the trace. Our t5559.17 notices and fails.

We can fix this by matching either prefix, which should handle both old
and new versions.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 months agoGit 2.41 v2.41.0
Junio C Hamano [Thu, 1 Jun 2023 06:28:26 +0000 (15:28 +0900)] 
Git 2.41

Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 months agoMerge tag 'l10n-2.41.0-2' of https://github.com/git-l10n/git-po
Junio C Hamano [Thu, 1 Jun 2023 06:27:43 +0000 (15:27 +0900)] 
Merge tag 'l10n-2.41.0-2' of https://github.com/git-l10n/git-po

l10n-2.41.0-2

* tag 'l10n-2.41.0-2' of https://github.com/git-l10n/git-po:
  l10n: zh_TW.po: Git 2.41.0
  l10n: sv.po: Update Swedish translation (5515t0f0u)
  l10n: Update Catalan translation
  l10n: Update German translation
  l10n: po-id for 2.41 (round 1)
  l10n: Update Catalan translation
  l10n: tr: Update Turkish translations for 2.41.0
  l10n: fr.po v2.41.0 rnd2
  l10n: fr.po v2.41.0 rnd1
  l10n: fr: fix translation of stash save help
  l10n: zh_CN: Git 2.41.0 round #1
  l10n: bg.po: Updated Bulgarian translation (5515t)
  l10n: update uk localization
  l10n: uk: remove stale lines
  l10n: uk: add initial translation
  l10n: TEAMS: Update pt_PT repo link

11 months agol10n: zh_TW.po: Git 2.41.0
Yi-Jyun Pan [Wed, 31 May 2023 16:53:09 +0000 (00:53 +0800)] 
l10n: zh_TW.po: Git 2.41.0

Co-authored-by: Peter Dave Hello <hsu@peterdavehello.org>
Signed-off-by: Yi-Jyun Pan <pan93412@gmail.com>
11 months agoMerge branch 'add-uk-initial-l10n' of github.com:arkid15r/git-ukrainian-l10n
Jiang Xin [Wed, 31 May 2023 13:11:25 +0000 (21:11 +0800)] 
Merge branch 'add-uk-initial-l10n' of github.com:arkid15r/git-ukrainian-l10n

* 'add-uk-initial-l10n' of github.com:arkid15r/git-ukrainian-l10n:
  l10n: update uk localization
  l10n: uk: remove stale lines
  l10n: uk: add initial translation

11 months agol10n: sv.po: Update Swedish translation (5515t0f0u)
Peter Krefting [Wed, 31 May 2023 12:16:21 +0000 (13:16 +0100)] 
l10n: sv.po: Update Swedish translation (5515t0f0u)

Signed-off-by: Peter Krefting <peter@softwolves.pp.se>
11 months agol10n: Update Catalan translation
Jordi Mas [Fri, 26 May 2023 18:02:14 +0000 (20:02 +0200)] 
l10n: Update Catalan translation

Signed-off-by: Jordi Mas <jmas@softcatala.org>
11 months agoMerge branch 'l10n-de-2.41' of github.com:ralfth/git
Jiang Xin [Thu, 25 May 2023 06:06:01 +0000 (14:06 +0800)] 
Merge branch 'l10n-de-2.41' of github.com:ralfth/git

* 'l10n-de-2.41' of github.com:ralfth/git:
  l10n: Update German translation

11 months agoMerge branch 'catalan' of github.com:Softcatala/git-po
Jiang Xin [Thu, 25 May 2023 06:05:21 +0000 (14:05 +0800)] 
Merge branch 'catalan' of github.com:Softcatala/git-po

* 'catalan' of github.com:Softcatala/git-po:
  l10n: Update Catalan translation

11 months agoMerge branch 'tr' of github.com:bitigchi/git-po
Jiang Xin [Thu, 25 May 2023 06:04:42 +0000 (14:04 +0800)] 
Merge branch 'tr' of github.com:bitigchi/git-po

* 'tr' of github.com:bitigchi/git-po:
  l10n: tr: Update Turkish translations for 2.41.0

11 months agoMerge branch 'main' of github.com:alshopov/git-po
Jiang Xin [Thu, 25 May 2023 06:03:58 +0000 (14:03 +0800)] 
Merge branch 'main' of github.com:alshopov/git-po

* 'main' of github.com:alshopov/git-po:
  l10n: bg.po: Updated Bulgarian translation (5515t)

11 months agoMerge branch 'fr_2.41.0_rnd1' of github.com:jnavila/git
Jiang Xin [Thu, 25 May 2023 06:03:22 +0000 (14:03 +0800)] 
Merge branch 'fr_2.41.0_rnd1' of github.com:jnavila/git

* 'fr_2.41.0_rnd1' of github.com:jnavila/git:
  l10n: fr.po v2.41.0 rnd2
  l10n: fr.po v2.41.0 rnd1
  l10n: fr: fix translation of stash save help

11 months agoMerge branch 'po-id' of github.com:bagasme/git-po
Jiang Xin [Thu, 25 May 2023 06:01:59 +0000 (14:01 +0800)] 
Merge branch 'po-id' of github.com:bagasme/git-po

* 'po-id' of github.com:bagasme/git-po:
  l10n: po-id for 2.41 (round 1)

11 months agoMerge branch 'tl/zh_CN_2.41.0_rnd1' of github.com:dyrone/git
Jiang Xin [Thu, 25 May 2023 05:58:10 +0000 (13:58 +0800)] 
Merge branch 'tl/zh_CN_2.41.0_rnd1' of github.com:dyrone/git

* 'tl/zh_CN_2.41.0_rnd1' of github.com:dyrone/git:
  l10n: zh_CN: Git 2.41.0 round #1

11 months agoGit 2.41-rc2 v2.41.0-rc2
Junio C Hamano [Wed, 24 May 2023 20:55:19 +0000 (05:55 +0900)] 
Git 2.41-rc2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 months agoMerge branch 'sl/sparse-write-tree-part-2'
Junio C Hamano [Wed, 24 May 2023 20:53:55 +0000 (05:53 +0900)] 
Merge branch 'sl/sparse-write-tree-part-2'

Fix-up to a topic already graduated to 'master'.

* sl/sparse-write-tree-part-2:
  t1092: update a write-tree test

11 months agol10n: Update German translation
Ralf Thielow [Mon, 22 May 2023 15:17:49 +0000 (17:17 +0200)] 
l10n: Update German translation

Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
Reviewed-by: Matthias Rüster <matthias.ruester@gmail.com>
11 months agol10n: po-id for 2.41 (round 1)
Bagas Sanjaya [Sun, 23 Apr 2023 09:15:06 +0000 (16:15 +0700)] 
l10n: po-id for 2.41 (round 1)

Update following components:

  * advice.c
  * archive.c
  * attr.c
  * config.c
  * pack-revindex.c
  * builtin/branch.c
  * builtin/bundle.c
  * builtin/pack-redundant.c
  * builtin/rebase.c
  * builtin/sparse-checkout.c

Signed-off-by: Bagas Sanjaya <bagasdotme@gmail.com>
11 months agol10n: Update Catalan translation
Jordi Mas [Sat, 20 May 2023 12:09:46 +0000 (14:09 +0200)] 
l10n: Update Catalan translation

Signed-off-by: Jordi Mas <jmas@softcatala.org>
11 months agol10n: tr: Update Turkish translations for 2.41.0
Emir SARI [Sat, 20 May 2023 10:57:05 +0000 (13:57 +0300)] 
l10n: tr: Update Turkish translations for 2.41.0

Signed-off-by: Emir SARI <emir_sari@icloud.com>
11 months agol10n: fr.po v2.41.0 rnd2
Jean-Noël Avila [Sat, 20 May 2023 10:43:10 +0000 (12:43 +0200)] 
l10n: fr.po v2.41.0 rnd2

Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
11 months agol10n: fr.po v2.41.0 rnd1
Jean-Noël Avila [Thu, 18 May 2023 16:52:00 +0000 (18:52 +0200)] 
l10n: fr.po v2.41.0 rnd1

Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
11 months agol10n: fr: fix translation of stash save help
Benjamin Jorand [Fri, 24 Mar 2023 09:16:43 +0000 (10:16 +0100)] 
l10n: fr: fix translation of stash save help

Signed-off-by: Benjamin Jorand <benjamin.jorand@doctolib.com>
11 months agol10n: zh_CN: Git 2.41.0 round #1
Teng Long [Sun, 30 Apr 2023 08:16:02 +0000 (16:16 +0800)] 
l10n: zh_CN: Git 2.41.0 round #1

Signed-off-by: Teng Long <dyroneteng@gmail.com>
Reviewed-by: Jiang Xin <zhiyou.jx@alibaba-inc.com>
Reviewed-by: 依云 <lilydjwg@gmail.com>
Reviewed-by: pan93412 <pan93412@gmail.com>
Reviewed0by: Fangyi Zhou <me@fangyi.io>

11 months agoMerge branch 'master' of github.com:git/git
Jiang Xin [Sat, 20 May 2023 00:44:08 +0000 (08:44 +0800)] 
Merge branch 'master' of github.com:git/git

* 'master' of github.com:git/git:
  A few more topics after 2.41-rc1
  Git 2.41-rc1
  t/lib-httpd: make CGIPassAuth support conditional
  t9001: mark the script as no longer leak checker clean
  send-email: clear the $message_id after validation
  upload-pack: advertise capabilities when cloning empty repos
  A bit more before -rc1
  imap-send: include strbuf.h
  run-command.c: fix missing include under `NO_PTHREADS`
  test: do not negate test_path_is_* to assert absense
  t2021: do not negate test_path_is_dir
  tests: do not negate test_path_exists
  doc/git-config: add unit for http.lowSpeedLimit
  rebase -r: fix the total number shown in the progress
  rebase --update-refs: fix loops
  attr: teach "--attr-source=<tree>" global option to "git"

11 months agoA few more topics after 2.41-rc1
Junio C Hamano [Fri, 19 May 2023 20:35:44 +0000 (05:35 +0900)] 
A few more topics after 2.41-rc1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 months agoMerge branch 'js/rebase-count-fixes'
Junio C Hamano [Fri, 19 May 2023 20:35:56 +0000 (05:35 +0900)] 
Merge branch 'js/rebase-count-fixes'

A few bugs in the sequencer machinery that results in miscounting
the steps have been corrected.

* js/rebase-count-fixes:
  rebase -r: fix the total number shown in the progress
  rebase --update-refs: fix loops

11 months agoMerge branch 'jc/do-not-negate-test-helpers'
Junio C Hamano [Fri, 19 May 2023 20:35:56 +0000 (05:35 +0900)] 
Merge branch 'jc/do-not-negate-test-helpers'

Small fixes.

* jc/do-not-negate-test-helpers:
  test: do not negate test_path_is_* to assert absense
  t2021: do not negate test_path_is_dir
  tests: do not negate test_path_exists

11 months agoMerge branch 'cg/doc-http-lowspeed-limit'
Junio C Hamano [Fri, 19 May 2023 20:35:56 +0000 (05:35 +0900)] 
Merge branch 'cg/doc-http-lowspeed-limit'

Doc update.

* cg/doc-http-lowspeed-limit:
  doc/git-config: add unit for http.lowSpeedLimit

12 months agol10n: bg.po: Updated Bulgarian translation (5515t)
Alexander Shopov [Tue, 16 May 2023 15:25:45 +0000 (17:25 +0200)] 
l10n: bg.po: Updated Bulgarian translation (5515t)

Signed-off-by: Alexander Shopov <ash@kambanaria.org>
12 months agoGit 2.41-rc1 v2.41.0-rc1
Junio C Hamano [Fri, 19 May 2023 15:33:18 +0000 (08:33 -0700)] 
Git 2.41-rc1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 months agoMerge branch 'jk/http-test-cgipassauth-unavailable-in-older-apache'
Junio C Hamano [Fri, 19 May 2023 16:27:07 +0000 (09:27 -0700)] 
Merge branch 'jk/http-test-cgipassauth-unavailable-in-older-apache'

We started unconditionally testing with CGIPassAuth directive but
it is unavailable in older Apache that ships with CentOS 7 that has
about a year of shelf-life still left.  The test has conditionally
been disabled when running with an ancient Apache.  This was a fix
for a recent regression caught before the release, so no need to
mention it in the release notes.

* jk/http-test-cgipassauth-unavailable-in-older-apache:
  t/lib-httpd: make CGIPassAuth support conditional

12 months agoMerge branch 'bc/clone-empty-repo-via-protocol-v0'
Junio C Hamano [Fri, 19 May 2023 16:27:06 +0000 (09:27 -0700)] 
Merge branch 'bc/clone-empty-repo-via-protocol-v0'

The server side of "git clone" now advertises the necessary hints
to clients to help them to clone from an empty repository and learn
object hash algorithm and the (unborn) branch pointed at by HEAD,
even over the older v0/v1 protocol.

* bc/clone-empty-repo-via-protocol-v0:
  upload-pack: advertise capabilities when cloning empty repos

12 months agoMerge branch 'jc/send-email-pre-process-fix'
Junio C Hamano [Fri, 19 May 2023 16:27:06 +0000 (09:27 -0700)] 
Merge branch 'jc/send-email-pre-process-fix'

When "git send-email" that uses the validate hook is fed a message
without and then with Message-ID, it failed to auto-assign a unique
Message-ID to the former and instead reused the Message-ID from the
latter, which has been corrected.  This was a fix for a recent
regression caught before the release, so no need to mention it in
the release notes.

* jc/send-email-pre-process-fix:
  t9001: mark the script as no longer leak checker clean
  send-email: clear the $message_id after validation

12 months agoMerge branch 'tb/run-command-needs-alloc-h'
Junio C Hamano [Fri, 19 May 2023 16:27:06 +0000 (09:27 -0700)] 
Merge branch 'tb/run-command-needs-alloc-h'

Fix the build problem with NO_PTHREADS defined, a fallout from
recent header file shuffling.

* tb/run-command-needs-alloc-h:
  run-command.c: fix missing include under `NO_PTHREADS`

12 months agot/lib-httpd: make CGIPassAuth support conditional
Jeff King [Thu, 18 May 2023 19:21:02 +0000 (15:21 -0400)] 
t/lib-httpd: make CGIPassAuth support conditional

Commit 988aad99b4 (t5563: add tests for basic and anoymous HTTP access,
2023-02-27) added tests that require Apache to support the CGIPassAuth
directive, which was added in Apache 2.4.13. This is fairly old (~8
years), but recent enough that we still encounter it in the wild (e.g.,
RHEL/CentOS 7, which is not EOL until June 2024).

We can live with skipping the new tests on such a platform. But
unfortunately, since the directive is used unconditionally in our
apache.conf, it means the web server fails to start entirely, and we
cannot run other HTTP tests at all (e.g., the basic ones in t5551).

We can fix that by making the config conditional, and only triggering it
for t5563. That solves the problem for t5551 (which then ignores the
directive entirely). For t5563, we'd see apache complain in start_httpd;
with the default setting of GIT_TEST_HTTPD, we'd then skip the whole
script.

But that leaves one small problem: people may set GIT_TEST_HTTPD=1
explicitly, which instructs the tests to fail (rather than skip) when we
can't start the webserver (to avoid accidentally missing some tests).

This could be worked around by having the user manually set
GIT_SKIP_TESTS on a platform with an older Apache. But we can be a bit
friendlier by doing the version check ourselves and setting an
appropriate prereq. We'll use the (lack of) prereq to then skip the rest
of t5563. In theory we could use the prereq to skip individual tests, but
in practice this whole script depends on it.

Reported-by: Todd Zullinger <tmz@pobox.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 months agot9001: mark the script as no longer leak checker clean
Junio C Hamano [Wed, 17 May 2023 21:10:39 +0000 (14:10 -0700)] 
t9001: mark the script as no longer leak checker clean

The test uses "format-patch --thread" which is known to leak the
generated message ID list.

Plugging these leaks involves straightening out the memory ownership
rules around rev_info.message_id and rev_info.ref_message_ids, and
is beyond the scope of send-email fix, so for now mark the test as
leaky to unblock the topic before the release.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 months agol10n: update uk localization
Arkadii Yakovets [Wed, 17 May 2023 21:51:29 +0000 (14:51 -0700)] 
l10n: update uk localization

Co-authored-by: Kate Golovanova <kate@kgthreads.com>
Signed-off-by: Arkadii Yakovets <ark@cho.red>
Signed-off-by: Kate Golovanova <kate@kgthreads.com>
12 months agosend-email: clear the $message_id after validation
Junio C Hamano [Wed, 17 May 2023 21:10:39 +0000 (14:10 -0700)] 
send-email: clear the $message_id after validation

Recently git-send-email started parsing the same message twice, once
to validate _all_ the message before sending even the first one, and
then after the validation hook is happy and each message gets sent,
to read the contents to find out where to send to etc.

Unfortunately, the effect of reading the messages for validation
lingered even after the validation is done.  Namely $message_id gets
assigned if exists in the input files but the variable is global,
and it is not cleared before pre_process_file runs.  This causes
reading a message without a message-id followed by reading a message
with a message-id to misbehave---the sub reports as if the message
had the same id as the previously written one.

Clear the variable before starting to read the headers in
pre_process_file.

Tested-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 months agoupload-pack: advertise capabilities when cloning empty repos
brian m. carlson [Wed, 17 May 2023 19:24:43 +0000 (19:24 +0000)] 
upload-pack: advertise capabilities when cloning empty repos

When cloning an empty repository, protocol versions 0 and 1 currently
offer nothing but the header and flush packets for the /info/refs
endpoint. This means that no capabilities are provided, so the client
side doesn't know what capabilities are present.

However, this does pose a problem when working with SHA-256
repositories, since we use the capabilities to know the remote side's
object format (hash algorithm).  As of 8b214c2e9d ("clone: propagate
object-format when cloning from void", 2023-04-05), this has been fixed
for protocol v2, since there we always read the hash algorithm from the
remote.

Fortunately, the push version of the protocol already indicates a clue
for how to solve this.  When the /info/refs endpoint is accessed for a
push and the remote is empty, we include a dummy "capabilities^{}" ref
pointing to the all-zeros object ID.  The protocol documentation already
indicates this should _always_ be sent, even for fetches and clones, so
let's just do that, which means we'll properly announce the hash
algorithm as part of the capabilities.  This just works with the
existing code because we share the same ref code for fetches and clones,
and libgit2, JGit, and dulwich do as well.

There is one minor issue to fix, though.  If we called send_ref with
namespaces, we would return NULL with the capabilities entry, which
would cause a crash.  Instead, let's refactor out a function to print
just the ref itself without stripping the namespace and use it for our
special capabilities entry.

Add several sets of tests for HTTP as well as for local clones.  The
behavior can be slightly different for HTTP versus a local or SSH clone
because of the stateless-rpc functionality, so it's worth testing both.

Signed-off-by: brian m. carlson <bk2204@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 months agoA bit more before -rc1
Junio C Hamano [Wed, 17 May 2023 17:13:09 +0000 (10:13 -0700)] 
A bit more before -rc1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 months agoMerge branch 'jc/attr-source-tree'
Junio C Hamano [Wed, 17 May 2023 17:11:41 +0000 (10:11 -0700)] 
Merge branch 'jc/attr-source-tree'

"git --attr-source=<tree> cmd $args" is a new way to have any
command to read attributes not from the working tree but from the
given tree object.

* jc/attr-source-tree:
  attr: teach "--attr-source=<tree>" global option to "git"

12 months agoimap-send: include strbuf.h
Christian Hesse [Wed, 17 May 2023 07:06:32 +0000 (09:06 +0200)] 
imap-send: include strbuf.h

We make liberal use of the strbuf API functions and types, but the
inclusion of <strbuf.h> comes indirectly by including <http.h>,
which does not happen if you build with NO_CURL.

Signed-off-by: Christian Hesse <mail@eworm.de>
Helped-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 months agorun-command.c: fix missing include under `NO_PTHREADS`
Taylor Blau [Tue, 16 May 2023 21:33:43 +0000 (17:33 -0400)] 
run-command.c: fix missing include under `NO_PTHREADS`

Git 2.41-rc0 fails to compile run-command.c with `NO_PTHREADS` defined,
i.e.

  $ make NO_PTHREADS=1 run-command.o

as `ALLOC_GROW()` macro is used in the `atexit()` emulation but the
macro definition is not available.

This bisects to 36bf195890 (alloc.h: move ALLOC_GROW() functions from
cache.h, 2023-02-24), which replaced includes of <cache.h> with
<alloc.h>, which is the new home of `ALLOC_GROW()` (and
`ALLOC_GROW_BY()`).

We can see that run-command.c is the only one that try to use these
macros without including <alloc.h>.

  $ git grep -l -e '[^_]ALLOC_GROW(' -e 'ALLOC_GROW_BY(' \*.c | sort >/tmp/1
  $ git grep -l 'alloc\.h' \*.c | sort >/tmp/2
  $ comm -23 /tmp/[12]
  compat/simple-ipc/ipc-unix-socket.c
  run-command.c

The "compat/" file only talks about the macro in the comment,
and is not broken.

We could fix this by conditionally including "alloc.h" when
`NO_PTHREADS` is defined.  But we have relatively few examples of
conditional includes throughout the tree[^1].

Instead, include "alloc.h" unconditionally in run-command.c to allow it
to successfully compile even when NO_PTHREADS is defined.

[^1]: With `git grep -E -A1 '#if(n)?def' -- **/*.c | grep '#include' -B1`.

Reported-by: Randall S. Becker <randall.becker@nexbridge.ca>
Co-authored-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 months agotest: do not negate test_path_is_* to assert absense
Junio C Hamano [Tue, 16 May 2023 02:26:46 +0000 (19:26 -0700)] 
test: do not negate test_path_is_* to assert absense

These tests use "! test_path_is_dir" or "! test_path_is_file" to
ensure that the path is not recursively checked out or "submodule
update" did not touch the working tree.

Use "test_path_is_missing" to assert that the path does not exist,
instead of negating test_path_is_* helpers; they are designed to be
loud in wrong occasions.  Besides, negating "test_path_is_dir" would
mean we would be happy if a file exists there, which is not the case
for these tests.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 months agot2021: do not negate test_path_is_dir
Junio C Hamano [Tue, 16 May 2023 02:26:45 +0000 (19:26 -0700)] 
t2021: do not negate test_path_is_dir

In this test, a path (some_dir) that is originally a directory is to
be removed and then to be replaced with a file of the same name.
The expectation is that the path becomes a file at the end.
However, "!  test_path_is_dir some_dir" is used to catch a breakage
that leaves the path as a directory.

But as with all the "test_path_is..." helpers, this use of the
helper makes it loud when the expectation (i.e. it is a directory)
is met, and otherwise is silent when it is not---this does not help
debugging.

Be more explicit and state that we expect the path to become a file.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 months agotests: do not negate test_path_exists
Junio C Hamano [Tue, 16 May 2023 02:26:44 +0000 (19:26 -0700)] 
tests: do not negate test_path_exists

As a way to assert the path 'foo' is missing, "! test_path_exists
foo" is a poor way to do so, as the helper is designed to complain
when 'foo' is missing, but the intention of the author who used
negated form was to make sure it does not exist.  This does not
help debugging the tests.

Use test_path_is_missing instead, which is a more appropriate helper.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 months agoMerge tag 'v2.41.0-rc0'
Jiang Xin [Tue, 16 May 2023 02:19:48 +0000 (10:19 +0800)] 
Merge tag 'v2.41.0-rc0'

Git 2.41-rc0

* tag 'v2.41.0-rc0': (508 commits)
  Git 2.41-rc0
  t5583: fix shebang line
  merge-tree: load default git config
  fetch: introduce machine-parseable "porcelain" output format
  fetch: move option related variables into main function
  fetch: lift up parsing of "fetch.output" config variable
  fetch: introduce `display_format` enum
  fetch: refactor calculation of the display table width
  fetch: print left-hand side when fetching HEAD:foo
  fetch: add a test to exercise invalid output formats
  fetch: split out tests for output format
  fetch: fix `--no-recurse-submodules` with multi-remote fetches
  The eighteenth batch
  The seventeenth batch
  diff-files: integrate with sparse index
  t1092: add tests for `git diff-files`
  test: rev-parse-upstream: add missing cmp
  t: drop "verbose" helper function
  t7001: use "ls-files --format" instead of "cut"
  t7001: avoid git on upstream of pipe
  ...

12 months agoGit 2.41-rc0 v2.41.0-rc0
Junio C Hamano [Mon, 15 May 2023 20:58:34 +0000 (13:58 -0700)] 
Git 2.41-rc0

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 months agoMerge branch 'ps/fetch-output-format'
Junio C Hamano [Mon, 15 May 2023 20:59:07 +0000 (13:59 -0700)] 
Merge branch 'ps/fetch-output-format'

"git fetch" learned the "--porcelain" option that emits what it did
in a machine-parseable format.

* ps/fetch-output-format:
  fetch: introduce machine-parseable "porcelain" output format
  fetch: move option related variables into main function
  fetch: lift up parsing of "fetch.output" config variable
  fetch: introduce `display_format` enum
  fetch: refactor calculation of the display table width
  fetch: print left-hand side when fetching HEAD:foo
  fetch: add a test to exercise invalid output formats
  fetch: split out tests for output format
  fetch: fix `--no-recurse-submodules` with multi-remote fetches

12 months agoMerge branch 'sg/retire-unused-cocci'
Junio C Hamano [Mon, 15 May 2023 20:59:06 +0000 (13:59 -0700)] 
Merge branch 'sg/retire-unused-cocci'

Retire a rather expensive-to-run Coccinelle check patch.

* sg/retire-unused-cocci:
  cocci: remove 'unused.cocci'

12 months agoMerge branch 'sl/diff-files-sparse'
Junio C Hamano [Mon, 15 May 2023 20:59:06 +0000 (13:59 -0700)] 
Merge branch 'sl/diff-files-sparse'

Teach "diff-files" not to expand sparse-index unless needed.

* sl/diff-files-sparse:
  diff-files: integrate with sparse index
  t1092: add tests for `git diff-files`

12 months agoMerge branch 'ds/merge-tree-use-config'
Junio C Hamano [Mon, 15 May 2023 20:59:06 +0000 (13:59 -0700)] 
Merge branch 'ds/merge-tree-use-config'

Allow git forges to disable replace-refs feature while running "git
merge-tree".

* ds/merge-tree-use-config:
  merge-tree: load default git config

12 months agoMerge branch 'js/subtree-fully-spelt-quiet-and-debug-options'
Junio C Hamano [Mon, 15 May 2023 20:59:06 +0000 (13:59 -0700)] 
Merge branch 'js/subtree-fully-spelt-quiet-and-debug-options'

"git subtree" (in contrib/) update.

* js/subtree-fully-spelt-quiet-and-debug-options:
  subtree: support long global flags

12 months agoMerge branch 'ar/test-cleanup-unused-file-creation'
Junio C Hamano [Mon, 15 May 2023 20:59:06 +0000 (13:59 -0700)] 
Merge branch 'ar/test-cleanup-unused-file-creation'

Test fix.

* ar/test-cleanup-unused-file-creation:
  test: rev-parse-upstream: add missing cmp

12 months agoMerge branch 'jk/test-verbose-no-more'
Junio C Hamano [Mon, 15 May 2023 20:59:05 +0000 (13:59 -0700)] 
Merge branch 'jk/test-verbose-no-more'

Retire "verbose" helper function from the test framework.

* jk/test-verbose-no-more:
  t: drop "verbose" helper function
  t7001: use "ls-files --format" instead of "cut"
  t7001: avoid git on upstream of pipe

12 months agoMerge branch 'tl/push-branches-is-an-alias-for-all'
Junio C Hamano [Mon, 15 May 2023 20:59:05 +0000 (13:59 -0700)] 
Merge branch 'tl/push-branches-is-an-alias-for-all'

"git push --all" gained an alias "git push --branches".

* tl/push-branches-is-an-alias-for-all:
  t5583: fix shebang line
  push: introduce '--branches' option

12 months agoMerge branch 'jc/name-rev-deprecate-stdin-further'
Junio C Hamano [Mon, 15 May 2023 20:59:05 +0000 (13:59 -0700)] 
Merge branch 'jc/name-rev-deprecate-stdin-further'

The "--stdin" option of "git name-rev" has been replaced with
the "--annotate-stdin" option more than a year ago.  We stop
advertising it in the "git name-rev -h" output.

* jc/name-rev-deprecate-stdin-further:
  name-rev: make --stdin hidden

12 months agoMerge branch 'jc/t9800-fix-use-of-show-s-raw'
Junio C Hamano [Mon, 15 May 2023 20:59:05 +0000 (13:59 -0700)] 
Merge branch 'jc/t9800-fix-use-of-show-s-raw'

A test fix.

* jc/t9800-fix-use-of-show-s-raw:
  t9800: correct misuse of 'show -s --raw' in a test

12 months agoMerge branch 'jc/dirstat-plug-leaks'
Junio C Hamano [Mon, 15 May 2023 20:59:04 +0000 (13:59 -0700)] 
Merge branch 'jc/dirstat-plug-leaks'

"git diff --dirstat" leaked memory, which has been plugged.

* jc/dirstat-plug-leaks:
  diff: plug leaks in dirstat
  diff: refactor common tail part of dirstat computation

12 months agoMerge branch 'ds/fsck-bitmap'
Junio C Hamano [Mon, 15 May 2023 20:59:04 +0000 (13:59 -0700)] 
Merge branch 'ds/fsck-bitmap'

"git fsck" learned to detect bit-flip breakages in the reachability
bitmap files.

* ds/fsck-bitmap:
  fsck: use local repository
  fsck: verify checksums of all .bitmap files

12 months agoMerge branch 'js/gitk-fixes-from-gfw'
Junio C Hamano [Mon, 15 May 2023 20:59:04 +0000 (13:59 -0700)] 
Merge branch 'js/gitk-fixes-from-gfw'

Gitk updates from GfW project.

* js/gitk-fixes-from-gfw:
  gitk: escape file paths before piping to git log
  gitk: prevent overly long command lines

12 months agoMerge branch 'fc/doc-use-datestamp-in-commit'
Junio C Hamano [Mon, 15 May 2023 20:59:04 +0000 (13:59 -0700)] 
Merge branch 'fc/doc-use-datestamp-in-commit'

An earlier change broke "doc-diff", which has been corrected.

* fc/doc-use-datestamp-in-commit:
  doc-diff: drop SOURCE_DATE_EPOCH override
  doc: doc-diff: specify date

12 months agoMerge branch 'ar/config-count-tests-updates'
Junio C Hamano [Mon, 15 May 2023 20:59:04 +0000 (13:59 -0700)] 
Merge branch 'ar/config-count-tests-updates'

Test updates.

* ar/config-count-tests-updates:
  t1300: add tests for missing keys
  t1300: check stderr for "ignores pairs" tests
  t1300: drop duplicate test

12 months agoMerge branch 'kh/doc-interpret-trailers-updates'
Junio C Hamano [Mon, 15 May 2023 20:59:03 +0000 (13:59 -0700)] 
Merge branch 'kh/doc-interpret-trailers-updates'

Doc update.

* kh/doc-interpret-trailers-updates:
  doc: interpret-trailers: fix example
  doc: interpret-trailers: don’t use deprecated config
  doc: interpret-trailers: use input redirection
  doc: interpret-trailers: don’t use heredoc in examples

12 months agoMerge branch 'gc/trace-bare-repo-setup'
Junio C Hamano [Mon, 15 May 2023 20:59:03 +0000 (13:59 -0700)] 
Merge branch 'gc/trace-bare-repo-setup'

The tracing mechanism learned to notice and report when
auto-discovered bare repositories are being used, as allowing so
without explicitly stating the user intends to do so (with setting
GIT_DIR for example) can be used with social engineering as an
attack vector.

* gc/trace-bare-repo-setup:
  setup: trace bare repository setups

12 months agoMerge branch 'mc/send-email-header-cmd'
Junio C Hamano [Mon, 15 May 2023 20:59:03 +0000 (13:59 -0700)] 
Merge branch 'mc/send-email-header-cmd'

"git send-email" learned "--header-cmd=<cmd>" that can inject
arbitrary e-mail header lines to the outgoing messages.

* mc/send-email-header-cmd:
  send-email: detect empty blank lines in command output
  send-email: add --header-cmd, --no-header-cmd options
  send-email: extract execute_cmd from recipients_cmd

12 months agoMerge branch 'jc/doc-clarify-git-default-hash-variable'
Junio C Hamano [Mon, 15 May 2023 20:59:03 +0000 (13:59 -0700)] 
Merge branch 'jc/doc-clarify-git-default-hash-variable'

The documentation was misleading about the interaction between
GIT_DEFAULT_HASH and "git clone", which has been clarified to
stress that the variable is to be ignored by the command.

* jc/doc-clarify-git-default-hash-variable:
  doc: GIT_DEFAULT_HASH is and will be ignored during "clone"

12 months agoMerge branch 'rj/branch-unborn-in-other-worktrees'
Junio C Hamano [Mon, 15 May 2023 20:59:02 +0000 (13:59 -0700)] 
Merge branch 'rj/branch-unborn-in-other-worktrees'

Error messages given when working on an unborn branch that is
checked out in another worktree have been improved.

* rj/branch-unborn-in-other-worktrees:
  branch: avoid unnecessary worktrees traversals
  branch: rename orphan branches in any worktree
  branch: description for orphan branch errors
  branch: use get_worktrees() in copy_or_rename_branch()
  branch: test for failures while renaming branches

12 months agodoc/git-config: add unit for http.lowSpeedLimit
Corentin Garcia [Sat, 13 May 2023 09:30:02 +0000 (09:30 +0000)] 
doc/git-config: add unit for http.lowSpeedLimit

Add the unit (bytes per second) for http.lowSpeedLimit
in the documentation.

Signed-off-by: Corentin Garcia <corenting@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 months agorebase -r: fix the total number shown in the progress
Johannes Schindelin [Sat, 13 May 2023 08:11:26 +0000 (08:11 +0000)] 
rebase -r: fix the total number shown in the progress

For regular, non-`--rebase-merges` runs, there is very little work to do
for the parser when determining the total number of commands in a rebase
script: it is simply the number of lines after stripping the commented
lines and then trimming the trailing empty line, if any.

The `--rebase-merges` mode complicates things by introducing empty lines
and comments in the middle of the script. These should _not_ be counted
as commands, and indeed, when an interactive rebase is interrupted and
subsequently resumed, the total number of commands can magically shrink,
sometimes dramatically.

The reason for this strange behavior is that empty lines _are_ counted
in `edit_todo_list()` (but not the comments, as they are stripped via
`strbuf_stripspace(..., 1)`, which is a bug.

Let's fix this so that the correct total number is shown from the
get-go, by carefully adjusting it according to what's in the rebase
script. Extra care needs to be taken in case the user edits the script:
the number of commands might be different after the user edited than
beforehand.

Note: Even though commented lines are skipped in `edit_todo_list()`, we
still need to handle `TODO_COMMENT` items by decrementing the
already-incremented `total_nr` again: empty lines are also marked as
`TODO_COMMENT`.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Acked-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 months agorebase --update-refs: fix loops
Johannes Schindelin [Sat, 13 May 2023 08:11:25 +0000 (08:11 +0000)] 
rebase --update-refs: fix loops

The `total_nr` field in the `todo_list` structure merely serves display
purposes, and should only be used when generating the progress message.

In these two instances, however, we want to loop over all of the
commands in the parsed rebase script. The loop limit therefore needs to
be `nr`, which refers to the count of commands in the current
`todo_list`.

This is important because the two numbers, `nr` and `total_nr` can
differ wildly, e.g. due to `total_nr` _not_ counting comments or empty
lines, while `nr` skips any commands that already moved from the
`git-rebase-todo` file to the `done` file.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Acked-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 months agot5583: fix shebang line
Elijah Newren [Fri, 12 May 2023 15:09:16 +0000 (15:09 +0000)] 
t5583: fix shebang line

The shebang was missing the leading `/` character, resulting in:

    $ ./t5583-push-branches.sh
    bash: ./t5583-push-branches.sh: cannot execute: required file not found

Add the missing character so the test can run.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 months agoMerge branch 'mh/credential-password-expiry-wincred'
Junio C Hamano [Thu, 11 May 2023 19:16:16 +0000 (12:16 -0700)] 
Merge branch 'mh/credential-password-expiry-wincred'

Teach the recently invented "password expiry time" trait to the
wincred credential helper.

* mh/credential-password-expiry-wincred:
  credential/wincred: store password_expiry_utc

12 months agoMerge branch 'mh/use-wincred-from-system'
Junio C Hamano [Thu, 11 May 2023 19:16:15 +0000 (12:16 -0700)] 
Merge branch 'mh/use-wincred-from-system'

Code clean-up.

* mh/use-wincred-from-system:
  credential/wincred: include wincred.h

12 months agomerge-tree: load default git config
Derrick Stolee [Wed, 10 May 2023 19:07:34 +0000 (19:07 +0000)] 
merge-tree: load default git config

The 'git merge-tree' command handles creating root trees for merges
without using the worktree. This is a critical operation in many Git
hosts, as they typically store bare repositories.

This builtin does not load the default Git config, which can have
several important ramifications.

In particular, one config that is loaded by default is
core.useReplaceRefs. This is typically disabled in Git hosts due to
the ability to spoof commits in strange ways.

Since this config is not loaded specifically during merge-tree, users
were previously able to use refs/replace/ references to make pull
requests that looked valid but introduced malicious content. The
resulting merge commit would have the correct commit history, but the
malicious content would exist in the root tree of the merge.

The fix is simple: load the default Git config in cmd_merge_tree().
This may also fix other behaviors that are effected by reading default
config. The only possible downside is a little extra computation time
spent reading config. The config parsing is placed after basic argument
parsing so it does not slow down usage errors.

Helped-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Derrick Stolee <derrickstolee@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 months agofetch: introduce machine-parseable "porcelain" output format
Patrick Steinhardt [Wed, 10 May 2023 12:34:36 +0000 (14:34 +0200)] 
fetch: introduce machine-parseable "porcelain" output format

The output of git-fetch(1) is obviously designed for consumption by
users, only: we neatly columnize data, we abbreviate reference names, we
print neat arrows and we don't provide information about actual object
IDs that have changed. This makes the output format basically unusable
in the context of scripted invocations of git-fetch(1) that want to
learn about the exact changes that the command performs.

Introduce a new machine-parseable "porcelain" output format that is
supposed to fix this shortcoming. This output format is intended to
provide information about every reference that is about to be updated,
the old object ID that the reference has been pointing to and the new
object ID it will be updated to. Furthermore, the output format provides
the same flags as the human-readable format to indicate basic conditions
for each reference update like whether it was a fast-forward update, a
branch deletion, a rejected update or others.

The output format is quite simple:

```
<flag> <old-object-id> <new-object-id> <local-reference>\n
```

We assume two conditions which are generally true:

    - The old and new object IDs have fixed known widths and cannot
      contain spaces.

    - References cannot contain newlines.

With these assumptions, the output format becomes unambiguously
parseable. Furthermore, given that this output is designed to be
consumed by scripts, the machine-readable data is printed to stdout
instead of stderr like the human-readable output is. This is mostly done
so that other data printed to stderr, like error messages or progress
meters, don't interfere with the parseable data.

A notable ommission here is that the output format does not include the
remote from which a reference was fetched, which might be important
information especially in the context of multi-remote fetches. But as
such a format would require us to print the remote for every single
reference update due to parallelizable fetches it feels wasteful for the
most likely usecase, which is when fetching from a single remote.

In a similar spirit, a second restriction is that this cannot be used
with `--recurse-submodules`. This is because any reference updates would
be ambiguous without also printing the repository in which the update
happens.

Considering that both multi-remote and submodule fetches are user-facing
features, using them in conjunction with `--porcelain` that is intended
for scripting purposes is likely not going to be useful in the majority
of cases. With that in mind these restrictions feel acceptable. If
usecases for either of these come up in the future though it is easy
enough to add a new "porcelain-v2" format that adds this information.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 months agofetch: move option related variables into main function
Patrick Steinhardt [Wed, 10 May 2023 12:34:32 +0000 (14:34 +0200)] 
fetch: move option related variables into main function

The options of git-fetch(1) which we pass to `parse_options()` are
declared globally in `builtin/fetch.c`. This means we're forced to use
global variables for all the options, which is more likely to cause
confusion than explicitly passing state around.

Refactor the code to move the options into `cmd_fetch()`. Move variables
that were previously forced to be declared globally and which are only
used by `cmd_fetch()` into function-local scope.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 months agofetch: lift up parsing of "fetch.output" config variable
Patrick Steinhardt [Wed, 10 May 2023 12:34:28 +0000 (14:34 +0200)] 
fetch: lift up parsing of "fetch.output" config variable

Parsing the display format happens inside of `display_state_init()`. As
we only need to check for a simple config entry, this is a natural
location to put this code as it means that display-state logic is neatly
contained in a single location.

We're about to introduce a new "porcelain" output format though that is
intended to be parseable by machines, for example inside of a script.
This format can be enabled by passing the `--porcelain` switch to
git-fetch(1). As a consequence, we'll have to add a second callsite that
influences the output format, which will become awkward to handle.

Refactor the code such that callers are expected to pass the display
format that is to be used into `display_state_init()`. This allows us to
lift up the code into the main function, where we can then hook it into
command line options parser in a follow-up commit.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 months agofetch: introduce `display_format` enum
Patrick Steinhardt [Wed, 10 May 2023 12:34:24 +0000 (14:34 +0200)] 
fetch: introduce `display_format` enum

We currently have two different display formats in git-fetch(1) with the
"full" and "compact" formats. This is tracked with a boolean value that
simply denotes whether the display format is supposed to be compacted
or not. This works reasonably well while there are only two formats, but
we're about to introduce another format that will make this a bit more
awkward to use.

Introduce a `enum display_format` that is more readily extensible.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 months agofetch: refactor calculation of the display table width
Patrick Steinhardt [Wed, 10 May 2023 12:34:20 +0000 (14:34 +0200)] 
fetch: refactor calculation of the display table width

When displaying reference updates, we try to print the references in a
neat table. As the table's width is determined its contents we thus need
to precalculate the overall width before we can start printing updated
references.

The calculation is driven by `display_state_init()`, which invokes
`refcol_width()` for every reference that is to be printed. This split
is somewhat confusing. For one, we filter references that shall be
attributed to the overall width in both places. And second, we
needlessly recalculate the maximum line length based on the terminal
columns and display format for every reference.

Refactor the code so that the complete width calculations are neatly
contained in `refcol_width()`.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 months agofetch: print left-hand side when fetching HEAD:foo
Patrick Steinhardt [Wed, 10 May 2023 12:34:15 +0000 (14:34 +0200)] 
fetch: print left-hand side when fetching HEAD:foo

`store_updated_refs()` parses the remote reference for two purposes:

    - It gets used as a note when writing FETCH_HEAD.

    - It is passed through to `display_ref_update()` to display
      updated references in the following format:

      ```
       * branch               master          -> master
      ```

In most cases, the parsed remote reference is the prettified reference
name and can thus be used for both cases. But if the remote reference is
HEAD, the parsed remote reference becomes empty. This is intended when
we write the FETCH_HEAD, where we skip writing the note in that case.
But when displaying the updated references this leads to inconsistent
output where the left-hand side of reference updates is missing in some
cases:

```
$ git fetch origin HEAD HEAD:explicit-head :implicit-head main
From https://github.com/git/git
 * branch                  HEAD       -> FETCH_HEAD
 * [new ref]                          -> explicit-head
 * [new ref]                          -> implicit-head
 * branch                  main       -> FETCH_HEAD
```

This behaviour has existed ever since the table-based output has been
introduced for git-fetch(1) via 165f390250 (git-fetch: more terse fetch
output, 2007-11-03) and was never explicitly documented either in the
commit message or in any of our tests. So while it may not be a bug per
se, it feels like a weird inconsistency and not like it was a concious
design decision.

The logic of how we compute the remote reference name that we ultimately
pass to `display_ref_update()` is not easy to follow. There are three
different cases here:

    - When the remote reference name is "HEAD" we set the remote
      reference name to the empty string. This is the case that causes
      the left-hand side to go missing, where we would indeed want to
      print "HEAD" instead of the empty string. This is what
      `prettify_refname()` would return.

    - When the remote reference name has a well-known prefix then we
      strip this prefix. This matches what `prettify_refname()` does.

    - Otherwise, we keep the fully qualified reference name. This also
      matches what `prettify_refname()` does.

As the return value of `prettify_refname()` would do the correct thing
for us in all three cases, we can thus fix the inconsistency by passing
through the full remote reference name to `display_ref_update()`, which
learns to call `prettify_refname()`. At the same time, this also
simplifies the code a bit.

Note that this patch also changes formatting of the block that computes
the "kind" (which is the category like "branch" or "tag") and "what"
(which is the prettified reference name like "master" or "v1.0")
variables. This is done on purpose so that it is part of the diff,
hopefully making the change easier to comprehend.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 months agofetch: add a test to exercise invalid output formats
Patrick Steinhardt [Wed, 10 May 2023 12:34:11 +0000 (14:34 +0200)] 
fetch: add a test to exercise invalid output formats

Add a testcase that exercises the logic when an invalid output format is
passed via the `fetch.output` configuration.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 months agofetch: split out tests for output format
Patrick Steinhardt [Wed, 10 May 2023 12:34:07 +0000 (14:34 +0200)] 
fetch: split out tests for output format

We're about to introduce a new porcelain mode for the output of
git-fetch(1). As part of that we'll be introducing a set of new tests
that only relate to the output of this command.

Split out tests that exercise the output format of git-fetch(1) so that
it becomes easier to verify this functionality as a standalone unit. As
the tests assume that the default branch is called "main" we set up the
corresponding GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME environment variable
accordingly.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 months agofetch: fix `--no-recurse-submodules` with multi-remote fetches
Patrick Steinhardt [Wed, 10 May 2023 12:34:02 +0000 (14:34 +0200)] 
fetch: fix `--no-recurse-submodules` with multi-remote fetches

When running `git fetch --no-recurse-submodules`, the exectation is that
we don't fetch any submodules. And while this works for fetches of a
single remote, it doesn't when fetching multiple remotes at once. The
result is that we do recurse into submodules even though the user has
explicitly asked us not to.

This is because while we pass on `--recurse-submodules={yes,on-demand}`
if specified by the user, we don't pass on `--no-recurse-submodules` to
the subprocess spawned to perform the submodule fetch.

Fix this by also forwarding this flag as expected.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 months agoThe eighteenth batch
Junio C Hamano [Wed, 10 May 2023 16:14:45 +0000 (09:14 -0700)] 
The eighteenth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 months agoMerge branch 'sd/doc-gitignore-and-rm-cached'
Junio C Hamano [Wed, 10 May 2023 17:23:29 +0000 (10:23 -0700)] 
Merge branch 'sd/doc-gitignore-and-rm-cached'

Doc update.

* sd/doc-gitignore-and-rm-cached:
  docs: clarify git rm --cached function in gitignore note

12 months agoMerge branch 'fc/doc-man-lift-title-length-limit'
Junio C Hamano [Wed, 10 May 2023 17:23:29 +0000 (10:23 -0700)] 
Merge branch 'fc/doc-man-lift-title-length-limit'

The titles of manual pages used to be chomped at an unreasonably
short limit, which has been removed.

* fc/doc-man-lift-title-length-limit:
  doc: manpage: remove maximum title length

12 months agoMerge branch 'fc/doc-drop-custom-callout-format'
Junio C Hamano [Wed, 10 May 2023 17:23:29 +0000 (10:23 -0700)] 
Merge branch 'fc/doc-drop-custom-callout-format'

Our custom callout formatter is no longer used in the documentation
formatting toolchain, as the upstream default ones give better
output these days.

* fc/doc-drop-custom-callout-format:
  doc: remove custom callouts format

12 months agoMerge branch 'mh/credential-oauth-refresh-token'
Junio C Hamano [Wed, 10 May 2023 17:23:28 +0000 (10:23 -0700)] 
Merge branch 'mh/credential-oauth-refresh-token'

The credential subsystem learns to help OAuth framework.

* mh/credential-oauth-refresh-token:
  credential: new attribute oauth_refresh_token

12 months agoMerge branch 'ah/doc-attributes-text'
Junio C Hamano [Wed, 10 May 2023 17:23:28 +0000 (10:23 -0700)] 
Merge branch 'ah/doc-attributes-text'

Doc update to clarify how text and eol attributes interact to
specify the end-of-line conversion.

* ah/doc-attributes-text:
  docs: rewrite the documentation of the text and eol attributes

12 months agoMerge branch 'ar/test-cleanup-unused-file-creation-part2'
Junio C Hamano [Wed, 10 May 2023 17:23:28 +0000 (10:23 -0700)] 
Merge branch 'ar/test-cleanup-unused-file-creation-part2'

Test cleanup.

* ar/test-cleanup-unused-file-creation-part2:
  t2019: don't create unused files
  t1502: don't create unused files
  t1450: don't create unused files
  t1300: don't create unused files
  t1300: fix config file syntax error descriptions
  t0300: don't create unused file

12 months agoMerge branch 'ms/send-email-feed-header-to-validate-hook'
Junio C Hamano [Wed, 10 May 2023 17:23:28 +0000 (10:23 -0700)] 
Merge branch 'ms/send-email-feed-header-to-validate-hook'

"git send-email" learned to give the e-mail headers to the validate
hook by passing an extra argument from the command line.

* ms/send-email-feed-header-to-validate-hook:
  send-email: expose header information to git-send-email's sendemail-validate hook
  send-email: refactor header generation functions

12 months agoMerge branch 'hx/negotiator-non-recursive'
Junio C Hamano [Wed, 10 May 2023 17:23:27 +0000 (10:23 -0700)] 
Merge branch 'hx/negotiator-non-recursive'

The implementation of the default "negotiator", used to find common
ancestor over the network for object tranfer, used to be recursive;
it was updated to be iterative to conserve stackspace usage.

* hx/negotiator-non-recursive:
  negotiator/skipping: fix some problems in mark_common()
  negotiator/default: avoid stack overflow

12 months agoMerge branch 'ma/gittutorial-fixes'
Junio C Hamano [Wed, 10 May 2023 17:23:27 +0000 (10:23 -0700)] 
Merge branch 'ma/gittutorial-fixes'

Doc fixes.

* ma/gittutorial-fixes:
  gittutorial: wrap literal examples in backticks
  gittutorial: drop early mention of origin

12 months agoMerge branch 'tb/credential-long-lines'
Junio C Hamano [Wed, 10 May 2023 17:23:27 +0000 (10:23 -0700)] 
Merge branch 'tb/credential-long-lines'

The implementation of credential helpers used fgets() over fixed
size buffers to read protocol messages, causing the remainder of
the folded long line to trigger unexpected behaviour, which has
been corrected.

* tb/credential-long-lines:
  contrib/credential: embiggen fixed-size buffer in wincred
  contrib/credential: avoid fixed-size buffer in libsecret
  contrib/credential: .gitignore libsecret build artifacts
  contrib/credential: remove 'gnome-keyring' credential helper
  contrib/credential: avoid fixed-size buffer in osxkeychain
  t/lib-credential.sh: ensure credential helpers handle long headers
  credential.c: store "wwwauth[]" values in `credential_read()`

12 months agoMerge branch 'rs/test-ctype-eof'
Junio C Hamano [Wed, 10 May 2023 17:23:27 +0000 (10:23 -0700)] 
Merge branch 'rs/test-ctype-eof'

ctype tests have been taught to test EOF, too.

* rs/test-ctype-eof:
  test-ctype: check EOF