]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
2 months agoMerge branch 'ty/mktree-wo-the-repository' into next
Junio C Hamano [Mon, 16 Mar 2026 17:50:38 +0000 (10:50 -0700)] 
Merge branch 'ty/mktree-wo-the-repository' into next

Code clean-up.

* ty/mktree-wo-the-repository:
  builtin/mktree: remove USE_THE_REPOSITORY_VARIABLE

2 months agoMerge branch 'bb/imap-send-openssl-4.0-prep' into next
Junio C Hamano [Mon, 16 Mar 2026 17:50:38 +0000 (10:50 -0700)] 
Merge branch 'bb/imap-send-openssl-4.0-prep' into next

"imap-send" used to use functions whose use is going to be removed
with OpenSSL 4.0; rewrite them using public API that has been
available since OpenSSL 1.1 since 2016 or so.

* bb/imap-send-openssl-4.0-prep:
  imap-send: move common code into function host_matches()
  imap-send: use the OpenSSL API to access the subject common name
  imap-send: use the OpenSSL API to access the subject alternative names

2 months agoMerge branch 'ac/help-sort-correctly' into next
Junio C Hamano [Mon, 16 Mar 2026 17:50:38 +0000 (10:50 -0700)] 
Merge branch 'ac/help-sort-correctly' into next

The code in "git help" that shows configuration items in sorted
order was awkwardly organized and prone to bugs.

* ac/help-sort-correctly:
  help: cleanup the contruction of keys_uniq

2 months agoMerge branch 'jc/test-allow-sed-with-ere' into next
Junio C Hamano [Mon, 16 Mar 2026 17:50:37 +0000 (10:50 -0700)] 
Merge branch 'jc/test-allow-sed-with-ere' into next

Adjust test-lint to allow "sed -E" to use ERE in the patterns.

* jc/test-allow-sed-with-ere:
  t: allow use of "sed -E"

2 months agoMerge branch 'ng/submodule-default-remote' into next
Junio C Hamano [Mon, 16 Mar 2026 17:50:37 +0000 (10:50 -0700)] 
Merge branch 'ng/submodule-default-remote' into next

Instead of hardcoded 'origin', use the configured default remote
when fetching from submodules.

* ng/submodule-default-remote:
  submodule: fetch missing objects from default remote

2 months agoMerge branch 'ms/t7605-test-path-is-helpers' into next
Junio C Hamano [Mon, 16 Mar 2026 17:50:37 +0000 (10:50 -0700)] 
Merge branch 'ms/t7605-test-path-is-helpers' into next

Test updates.

* ms/t7605-test-path-is-helpers:
  t7605: use test_path_is_file instead of test -f

2 months agoSync with 'master'
Junio C Hamano [Fri, 13 Mar 2026 20:34:29 +0000 (13:34 -0700)] 
Sync with 'master'

2 months agoMerge branch 'ss/submodule--helper-use-xmalloc' into next
Junio C Hamano [Fri, 13 Mar 2026 20:34:22 +0000 (13:34 -0700)] 
Merge branch 'ss/submodule--helper-use-xmalloc' into next

Code clean-up.

* ss/submodule--helper-use-xmalloc:
  submodule--helper: replace malloc with xmalloc

2 months agoMerge branch 'ps/unit-test-c-escape-names.txt' into next
Junio C Hamano [Fri, 13 Mar 2026 20:34:21 +0000 (13:34 -0700)] 
Merge branch 'ps/unit-test-c-escape-names.txt' into next

The unit test helper function was taught to use backslash +
mneomnic notation for certain control characters like "\t", instead
of octal notation like "\011".

* ps/unit-test-c-escape-names.txt:
  test-lib: print escape sequence names

2 months agoMerge branch 'jc/doc-wholesale-replace-before-next' into next
Junio C Hamano [Fri, 13 Mar 2026 20:34:21 +0000 (13:34 -0700)] 
Merge branch 'jc/doc-wholesale-replace-before-next' into next

Doc update.

* jc/doc-wholesale-replace-before-next:
  SubmittingPatches: spell out "replace fully to pretend to be perfect"

2 months agoMerge branch 'cf/constness-fixes' into next
Junio C Hamano [Fri, 13 Mar 2026 20:34:21 +0000 (13:34 -0700)] 
Merge branch 'cf/constness-fixes' into next

Small code clean-up around constness area.

* cf/constness-fixes:
  dir: avoid -Wdiscarded-qualifiers in remove_path()
  bloom: remove a misleading const qualifier

2 months agoMerge branch 'lc/rebase-trailer' into next
Junio C Hamano [Fri, 13 Mar 2026 20:34:21 +0000 (13:34 -0700)] 
Merge branch 'lc/rebase-trailer' into next

"git rebase" learns "--trailer" command to drive the
interpret-trailers machinery.

* lc/rebase-trailer:
  rebase: support --trailer
  commit, tag: parse --trailer with OPT_STRVEC
  trailer: append trailers without fork/exec
  trailer: libify a couple of functions
  interpret-trailers: refactor create_in_place_tempfile()
  interpret-trailers: factor trailer rewriting

2 months agoMerge branch 'jc/neuter-sideband-fixup' into next
Junio C Hamano [Fri, 13 Mar 2026 20:34:20 +0000 (13:34 -0700)] 
Merge branch 'jc/neuter-sideband-fixup' into next

Try to resurrect and reboot a stalled "avoid sending risky escape
sequences taken from sideband to the terminal" topic by Dscho.  The
plan is to keep it in 'next' long enough to see if anybody screams
with the "everything dropped except for ANSI color escape sequence"
default.

* jc/neuter-sideband-fixup:
  sideband: drop 'default' configuration
  sideband: offer to configure sanitizing on a per-URL basis
  sideband: add options to allow more control sequences to be passed through
  sideband: do allow ANSI color sequences by default
  sideband: introduce an "escape hatch" to allow control characters
  sideband: mask control characters

2 months agoThe 16th batch
Junio C Hamano [Thu, 12 Mar 2026 21:08:20 +0000 (14:08 -0700)] 
The 16th batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agoMerge branch 'ps/odb-sources'
Junio C Hamano [Thu, 12 Mar 2026 21:09:06 +0000 (14:09 -0700)] 
Merge branch 'ps/odb-sources'

The object source API is getting restructured to allow plugging new
backends.

* ps/odb-sources:
  odb/source: make `begin_transaction()` function pluggable
  odb/source: make `write_alternate()` function pluggable
  odb/source: make `read_alternates()` function pluggable
  odb/source: make `write_object_stream()` function pluggable
  odb/source: make `write_object()` function pluggable
  odb/source: make `freshen_object()` function pluggable
  odb/source: make `for_each_object()` function pluggable
  odb/source: make `read_object_stream()` function pluggable
  odb/source: make `read_object_info()` function pluggable
  odb/source: make `close()` function pluggable
  odb/source: make `reprepare()` function pluggable
  odb/source: make `free()` function pluggable
  odb/source: introduce source type for robustness
  odb: move reparenting logic into respective subsystems
  odb: embed base source in the "files" backend
  odb: introduce "files" source
  odb: split `struct odb_source` into separate header

2 months agoMerge branch 'hn/status-compare-with-push'
Junio C Hamano [Thu, 12 Mar 2026 21:09:06 +0000 (14:09 -0700)] 
Merge branch 'hn/status-compare-with-push'

"git status" learned to show comparison between the current branch
and various other branches listed on status.compareBranches
configuration.

* hn/status-compare-with-push:
  status: clarify how status.compareBranches deduplicates
  status: add status.compareBranches config for multiple branch comparisons
  refactor format_branch_comparison in preparation

2 months agoMerge branch 'ds/for-each-repo-w-worktree'
Junio C Hamano [Thu, 12 Mar 2026 21:09:05 +0000 (14:09 -0700)] 
Merge branch 'ds/for-each-repo-w-worktree'

"git for-each-repo" started from a secondary worktree did not work
as expected, which has been corrected.

* ds/for-each-repo-w-worktree:
  for-each-repo: simplify passing of parameters
  for-each-repo: work correctly in a worktree
  run-command: extract sanitize_repo_env helper
  for-each-repo: test outside of repo context

2 months agoSync with 'master'
Junio C Hamano [Thu, 12 Mar 2026 17:59:13 +0000 (10:59 -0700)] 
Sync with 'master'

2 months agoMerge branch 'bk/run-command-wo-the-repository' into next
Junio C Hamano [Thu, 12 Mar 2026 17:59:00 +0000 (10:59 -0700)] 
Merge branch 'bk/run-command-wo-the-repository' into next

The run_command() API lost its implicit dependence on the singleton
the_repository instance.

* bk/run-command-wo-the-repository:
  run-command: wean auto_maintenance() functions off the_repository
  run-command: wean start_command() off the_repository

2 months agoMerge branch 'ps/editorconfig-unanchor' into next
Junio C Hamano [Thu, 12 Mar 2026 17:58:59 +0000 (10:58 -0700)] 
Merge branch 'ps/editorconfig-unanchor' into next

Editorconfig filename patterns were specified incorrectly, making
many source files inside subdirectories uncovered, which has been
corrected.

* ps/editorconfig-unanchor:
  editorconfig: fix style not applying to subdirs anymore

2 months agoMerge branch 'ss/t3200-test-zero-oid' into next
Junio C Hamano [Thu, 12 Mar 2026 17:58:57 +0000 (10:58 -0700)] 
Merge branch 'ss/t3200-test-zero-oid' into next

A test now use symbolic constant $ZERO_OID instead of 40 "0" to
work better with SHA-256 as well as SHA-1.

* ss/t3200-test-zero-oid:
  t3200: replace hardcoded null OID with $ZERO_OID

2 months agoMerge branch 'dd/list-objects-filter-options-wo-strbuf-split' into next
Junio C Hamano [Thu, 12 Mar 2026 17:58:56 +0000 (10:58 -0700)] 
Merge branch 'dd/list-objects-filter-options-wo-strbuf-split' into next

Revamp the way combined option filter is parsed.

* dd/list-objects-filter-options-wo-strbuf-split:
  list-objects-filter-options: avoid strbuf_split_str()
  worktree: do not pass strbuf by value

2 months agoMerge branch 'ps/t9200-test-path-is-helpers' into next
Junio C Hamano [Thu, 12 Mar 2026 17:58:54 +0000 (10:58 -0700)] 
Merge branch 'ps/t9200-test-path-is-helpers' into next

Test update.

* ps/t9200-test-path-is-helpers:
  t9200: replace test -f with modern path helper
  t9200: handle missing CVS with skip_all

2 months agoThe 15th batch
Junio C Hamano [Thu, 12 Mar 2026 17:55:41 +0000 (10:55 -0700)] 
The 15th batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agoMerge branch 'sp/send-email-validate-charset'
Junio C Hamano [Thu, 12 Mar 2026 17:56:05 +0000 (10:56 -0700)] 
Merge branch 'sp/send-email-validate-charset'

"git send-email" has learned to be a bit more careful when it
accepts charset to use from the end-user, to avoid 'y' (mistaken
'yes' when expecting a charset like 'UTF-8') and other nonsense.

* sp/send-email-validate-charset:
  send-email: validate charset name in 8bit encoding prompt

2 months agoMerge branch 'dt/send-email-client-cert'
Junio C Hamano [Thu, 12 Mar 2026 17:56:04 +0000 (10:56 -0700)] 
Merge branch 'dt/send-email-client-cert'

"git send-email" learns to support use of client-side certificates.

* dt/send-email-client-cert:
  send-email: add client certificate options

2 months agoMerge branch 'ps/ci-gitlab-prepare-for-macos-14-deprecation'
Junio C Hamano [Thu, 12 Mar 2026 17:56:04 +0000 (10:56 -0700)] 
Merge branch 'ps/ci-gitlab-prepare-for-macos-14-deprecation'

Move gitlab CI from macOS 14 images that are being deprecated.

* ps/ci-gitlab-prepare-for-macos-14-deprecation:
  gitlab-ci: update to macOS 15 images
  meson: detect broken iconv that requires ICONV_RESTART_RESET
  meson: simplify iconv-emits-BOM check

2 months agoMerge branch 'ag/send-email-sasl-with-host-port'
Junio C Hamano [Thu, 12 Mar 2026 17:56:04 +0000 (10:56 -0700)] 
Merge branch 'ag/send-email-sasl-with-host-port'

"git send-email" learns to pass hostname/port to Authen::SASL
module.

* ag/send-email-sasl-with-host-port:
  send-email: pass smtp hostname and port to Authen::SASL

2 months agoMerge branch 'ss/t9123-setup-inside-test-expect-success'
Junio C Hamano [Thu, 12 Mar 2026 17:56:04 +0000 (10:56 -0700)] 
Merge branch 'ss/t9123-setup-inside-test-expect-success'

Test clean-up.

* ss/t9123-setup-inside-test-expect-success:
  t9123: use test_when_finished for cleanup

2 months agoMerge branch 'sk/oidmap-clear-with-custom-free-func'
Junio C Hamano [Thu, 12 Mar 2026 17:56:04 +0000 (10:56 -0700)] 
Merge branch 'sk/oidmap-clear-with-custom-free-func'

A bit of OIDmap API enhancement and cleanup.

* sk/oidmap-clear-with-custom-free-func:
  builtin/rev-list: migrate missing_objects cleanup to oidmap_clear_with_free()
  oidmap: make entry cleanup explicit in oidmap_clear

2 months agoMerge branch 'jt/doc-submitting-patches-study-before-sending'
Junio C Hamano [Thu, 12 Mar 2026 17:56:03 +0000 (10:56 -0700)] 
Merge branch 'jt/doc-submitting-patches-study-before-sending'

Doc update for our contributors.

* jt/doc-submitting-patches-study-before-sending:
  Documentation: extend guidance for submitting patches

2 months agoMerge branch 'os/doc-custom-subcommand-on-path'
Junio C Hamano [Thu, 12 Mar 2026 17:56:03 +0000 (10:56 -0700)] 
Merge branch 'os/doc-custom-subcommand-on-path'

The way end-users can add their own "git <cmd>" subcommand by
storing "git-<cmd>" in a directory on their $PATH has not been
documented clearly, which has been corrected.

* os/doc-custom-subcommand-on-path:
  doc: add information regarding external commands

2 months agoMerge branch 'ss/t3700-modernize'
Junio C Hamano [Thu, 12 Mar 2026 17:56:03 +0000 (10:56 -0700)] 
Merge branch 'ss/t3700-modernize'

Test clean-up.

* ss/t3700-modernize:
  t3700: use test_grep helper for better diagnostics
  t3700: avoid suppressing git's exit code

2 months agoMerge branch 'lp/doc-gitprotocol-pack-fixes'
Junio C Hamano [Thu, 12 Mar 2026 17:56:03 +0000 (10:56 -0700)] 
Merge branch 'lp/doc-gitprotocol-pack-fixes'

Doc update.

* lp/doc-gitprotocol-pack-fixes:
  doc: gitprotocol-pack: normalize italic formatting
  doc: gitprotocol-pack: improve paragraphs structure
  doc: gitprotocol-pack: fix pronoun-antecedent agreement

2 months agoMerge branch 'kj/path-micro-code-cleanup'
Junio C Hamano [Thu, 12 Mar 2026 17:56:02 +0000 (10:56 -0700)] 
Merge branch 'kj/path-micro-code-cleanup'

Code clean-up.

* kj/path-micro-code-cleanup:
  path: remove redundant function calls
  path: use size_t for dir_prefix length
  path: remove unused header

2 months agoMerge branch 'bc/sha1-256-interop-02'
Junio C Hamano [Thu, 12 Mar 2026 17:56:02 +0000 (10:56 -0700)] 
Merge branch 'bc/sha1-256-interop-02'

The code to maintain mapping between object names in multiple hash
functions is being added, written in Rust.

* bc/sha1-256-interop-02:
  object-file-convert: always make sure object ID algo is valid
  rust: add a small wrapper around the hashfile code
  rust: add a new binary object map format
  rust: add functionality to hash an object
  rust: add a build.rs script for tests
  rust: fix linking binaries with cargo
  hash: expose hash context functions to Rust
  write-or-die: add an fsync component for the object map
  csum-file: define hashwrite's count as a uint32_t
  rust: add additional helpers for ObjectID
  hash: add a function to look up hash algo structs
  rust: add a hash algorithm abstraction
  rust: add a ObjectID struct
  hash: use uint32_t for object_id algorithm
  conversion: don't crash when no destination algo
  repository: require Rust support for interoperability

2 months agot9200: replace test -f with modern path helper
Pablo Sabater [Thu, 12 Mar 2026 17:33:05 +0000 (18:33 +0100)] 
t9200: replace test -f with modern path helper

Replace old style 'test -f' with helper
'test_path_is_file', which make debugging
a failing test easier by loudly reporting
what expectation was not met.

Signed-off-by: Pablo Sabater <pabloosabaterr@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agobuiltin/mktree: remove USE_THE_REPOSITORY_VARIABLE
Tian Yuchen [Thu, 12 Mar 2026 16:42:03 +0000 (00:42 +0800)] 
builtin/mktree: remove USE_THE_REPOSITORY_VARIABLE

The 'cmd_mktree()' function already receives a 'struct repository *repo'
pointer, but it was previously marked as UNUSED.

Pass the 'repo' pointer down to 'mktree_line()' and 'write_tree()'.
Consequently, remove the 'USE_THE_REPOSITORY_VARIABLE' macro, replace
usages of 'the_repository', and swap 'parse_oid_hex()' with its context-aware
version 'parse_oid_hex_algop()'.

This refactoring is safe because 'cmd_mktree()' is registered with the
'RUN_SETUP' flag in 'git.c', which guarantees that the command is
executed within a initialized repository, ensuring that the passed 'repo'
pointer is never 'NULL'.

Signed-off-by: Tian Yuchen <cat@malon.dev>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agorun-command: wean auto_maintenance() functions off the_repository
Burak Kaan Karaçay [Thu, 12 Mar 2026 14:44:37 +0000 (17:44 +0300)] 
run-command: wean auto_maintenance() functions off the_repository

The prepare_auto_maintenance() relies on the_repository to read
configurations. Since run_auto_maintenance() calls
prepare_auto_maintenance(), it also implicitly depends the_repository.

Add 'struct repository *' as a parameter to both functions and update
all callers to pass the_repository.

With no global repository dependencies left in this file, remove the
USE_THE_REPOSITORY_VARIABLE macro.

Suggested-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Burak Kaan Karaçay <bkkaracay@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agorun-command: wean start_command() off the_repository
Burak Kaan Karaçay [Thu, 12 Mar 2026 14:44:36 +0000 (17:44 +0300)] 
run-command: wean start_command() off the_repository

The start_command() relies on the_repository due to the
close_object_store flag in 'struct child_process'. When this flag is
set, start_command() closes the object store associated with
the_repository before spawning a child process.

To eliminate this dependency, replace the 'close_object_store' with the
new 'struct object_database *odb_to_close' field. This allows callers to
specify the object store that needs to be closed.

Suggested-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Burak Kaan Karaçay <bkkaracay@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agoimap-send: move common code into function host_matches()
Beat Bolli [Wed, 11 Mar 2026 22:10:27 +0000 (23:10 +0100)] 
imap-send: move common code into function host_matches()

Move the ASN1_STRING access, the associated cast and the check for
embedded NUL bytes into host_matches() to simplify both callers.

Reformulate the NUL check using memchr() and add a comment to make it
more obvious what it is about.

Signed-off-by: Beat Bolli <dev+git@drbeat.li>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agoimap-send: use the OpenSSL API to access the subject common name
Beat Bolli [Wed, 11 Mar 2026 22:10:26 +0000 (23:10 +0100)] 
imap-send: use the OpenSSL API to access the subject common name

The OpenSSL 4.0 master branch has deprecated the
X509_NAME_get_text_by_NID function. Use the recommended replacement APIs
instead. They have existed since OpenSSL v1.1.0.

Take care to get the constness right for pre-4.0 versions.

Signed-off-by: Beat Bolli <dev+git@drbeat.li>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agoimap-send: use the OpenSSL API to access the subject alternative names
Beat Bolli [Wed, 11 Mar 2026 22:10:25 +0000 (23:10 +0100)] 
imap-send: use the OpenSSL API to access the subject alternative names

The OpenSSL 4.0 master branch has made the ASN1_STRING structure opaque,
forbidding access to its internal fields. Use the official accessor
functions instead. They have existed since OpenSSL v1.1.0.

Signed-off-by: Beat Bolli <dev+git@drbeat.li>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agot: allow use of "sed -E"
Junio C Hamano [Wed, 11 Mar 2026 21:35:41 +0000 (14:35 -0700)] 
t: allow use of "sed -E"

Since early 2019 with e62e225f (test-lint: only use only sed [-n]
[-e command] [-f command_file], 2019-01-20), we have been trying to
limit the options of "sed" we use in our tests to "-e <pattern>",
"-n", and "-f <file>".

Before the commit, we were trying to reject only "-i" (which is one
of the really-not-portable options), but the commit explicitly
wanted to reject use of "-E" (use ERE instead of BRE).  The commit
cites the then-current POSIX.1 (Issue 7, 2018 edition) to show that
"even recent POSIX does not have it!", but the latest edition (Issue
8) documents "-E" as an option to use ERE.

But that was 7 years ago, and that is a long time for many things to
happen.

Besides, we have been using "sed -E" without the check in question
triggering in one of the scripts since 2022, with 461fec41 (bisect
run: keep some of the post-v2.30.0 output, 2022-11-10).  It was
hidden because the 'E' was squished with another single letter
option.

t/t6030-bisect-porcelain.sh: sed -En 's/.*(bisect...

This escaped the rather simple pattern used in the checker

    /\bsed\s+-[^efn]\s+/ and err 'sed option not portable...';

because -E did not appear as a singleton.

Let's change the rule to allow the "-E" option, which nobody has
complained against for the past 3 years.  We rewrite our first use
of the "-E" option so that it is caught by the old rule, primarily
because we do not want to teach our mischievous developers how to
smuggle in an unwanted option undetected by the test lint.  And at
the same time, loosen the pattern to allow "-E" the same way we
allow "-n" and friends.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agot9200: handle missing CVS with skip_all
Pablo Sabater [Wed, 11 Mar 2026 19:40:02 +0000 (20:40 +0100)] 
t9200: handle missing CVS with skip_all

CVS initialization runs outside a test_expect_success and when it
fails, the error report isn't good.

Wrap CVS initialization in a skip_all check so when CVS initialization
fails, the error report becomes clearer.

Move the Git repo initialization into its own test_expect_success instead
of being in the same CVS check.

Signed-off-by: Pablo Sabater <pabloosabaterr@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agohelp: cleanup the contruction of keys_uniq
Amisha Chhajed [Wed, 11 Mar 2026 19:24:53 +0000 (00:54 +0530)] 
help: cleanup the contruction of keys_uniq

construction of keys_uniq depends on sort operation
executed on keys before processing, which does not
gurantee that keys_uniq will be sorted.

refactor the code to shift the sort operation after
the processing to remove dependency on key's sort operation
and strictly maintain the sorted order of keys_uniq.

move strbuf init and release out of loop to reuse same buffer.

dedent sort -u and sed in tests and replace grep with sed, to
avoid piping grep's output to sed.

Suggested-by: Siddharth Shrimali <r.siddharth.shrimali@gmail.com>
Signed-off-by: Amisha Chhajed <amishhhaaaa@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agotest-lib: print escape sequence names
Pablo Sabater [Wed, 11 Mar 2026 03:14:42 +0000 (04:14 +0100)] 
test-lib: print escape sequence names

When printing expected/actual characters in failed checks, use
their names (\a, \b, \n, ...) instead of their octal representation,
making it easier to read.

Add tests to test-example-tap.c
Update t0080-unit-test-output.sh to match the desired output

Teach 'print_one_char()' the equivalent name

Signed-off-by: Pablo Sabater <pabloosabaterr@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agosubmodule--helper: replace malloc with xmalloc
Siddharth Shrimali [Tue, 10 Mar 2026 16:44:12 +0000 (22:14 +0530)] 
submodule--helper: replace malloc with xmalloc

The submodule_summary_callback() function currently uses a raw malloc()
which could lead to a NULL pointer dereference.

Standardize this by replacing malloc() with xmalloc() for error handling.
To improve maintainability, use sizeof(*temp) instead of the struct name,
and drop the typecast of void pointer assignment.

Signed-off-by: Siddharth Shrimali <r.siddharth.shrimali@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agot3200: replace hardcoded null OID with $ZERO_OID
Siddharth Shrimali [Wed, 11 Mar 2026 17:41:20 +0000 (23:11 +0530)] 
t3200: replace hardcoded null OID with $ZERO_OID

To support the SHA-256 transition, replace the hardcoded 40-zero string
in 'git branch --merged' with '$ZERO_OID'. The current 40-character
string causes the test to fail prematurely in SHA-256 environments
because Git identifies a "malformed object name" (due to the 40 vs 64
character mismatch) before it even validates the object type.

By using '$ZERO_OID', we ensure the hash length is always correct for
the active algorithm. Additionally, use 'test_grep' to verify the
"must point to a commit" error message, ensuring the test validates
the object type logic rather than just string syntax.

Suggested-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Siddharth Shrimali <r.siddharth.shrimali@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agolist-objects-filter-options: avoid strbuf_split_str()
Deveshi Dwivedi [Wed, 11 Mar 2026 17:33:36 +0000 (17:33 +0000)] 
list-objects-filter-options: avoid strbuf_split_str()

parse_combine_filter() splits a combine: filter spec at '+' using
strbuf_split_str(), which yields an array of strbufs with the
delimiter left at the end of each non-final piece.  The code then
mutates each non-final piece to strip the trailing '+' before parsing.

Allocating an array of strbufs is unnecessary.  The function processes
one sub-spec at a time and does not use strbuf editing on the pieces.
The two helpers it calls, has_reserved_character() and
parse_combine_subfilter(), only read the string content of the strbuf
they receive.

Walk the input string directly with strchrnul() to find each '+',
copying each sub-spec into a reusable temporary buffer.  The '+'
delimiter is naturally excluded.  Empty sub-specs (e.g. from a
trailing '+') are silently skipped for consistency.  Change the
helpers to take const char * instead of struct strbuf *.

The test that expected an error on a trailing '+' is removed, since
that behavior was incorrect.

Signed-off-by: Deveshi Dwivedi <deveshigurgaon@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agoworktree: do not pass strbuf by value
Deveshi Dwivedi [Wed, 11 Mar 2026 17:33:35 +0000 (17:33 +0000)] 
worktree: do not pass strbuf by value

write_worktree_linking_files() takes two struct strbuf parameters by
value, even though it only reads path strings from them.

Passing a strbuf by value is misleading and dangerous. The structure
carries a pointer to its underlying character array; caller and callee
end up sharing that storage.  If the callee ever causes the strbuf to
be reallocated, the caller's copy becomes a dangling pointer, which
results in a double-free when the caller does strbuf_release().

The function only needs the string values, not the strbuf machinery.
Switch it to take const char * and update all callers to pass .buf.

Signed-off-by: Deveshi Dwivedi <deveshigurgaon@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agoeditorconfig: fix style not applying to subdirs anymore
Patrick Steinhardt [Wed, 11 Mar 2026 07:09:18 +0000 (08:09 +0100)] 
editorconfig: fix style not applying to subdirs anymore

In 046e1117d5 (templates: add .gitattributes entry for sample hooks,
2026-02-13) we have added another pattern to our EditorConfig that sets
the style for our hook templates. As our templates are located in
"templates/hooks/", we explicitly specify that subdirectory as part of
the globbing pattern.

This change causes files in other subdirectories, like for example
"builtin/add.c", to not be configured properly anymore. This seems to
stem from a subtlety in the EditorConfig specification [1]:

  If the glob contains a path separator (a / not inside square
  brackets), then the glob is relative to the directory level of the
  particular .editorconfig file itself. Otherwise the pattern may also
  match at any level below the .editorconfig level.

What's interesting is that the _whole_ expression is considered to be
the glob. So when the expression used is for example "{*.c,foo/*.h}",
then it will be considered a single glob, and because it contains a path
separator we will now anchor "*.c" matches to the same directory as the
".editorconfig" file.

Fix this issue by splitting out the configuration for hook templates
into a separate section. It leads to a tiny bit of duplication, but the
alternative would be something like the following (note the "{,**/}"):

  [{{,**/}*.{c,h,sh,bash,perl,pl,pm,txt,adoc},config.mak.*,{,**/}Makefile,templates/hooks/*.sample}]
  indent_style = tab
  tab_width = 8

This starts to become somewhat hard to read, so the duplication feels
like the better tradeoff.

[1]: https://spec.editorconfig.org/#glob-expressions

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Acked-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agot7605: use test_path_is_file instead of test -f
Mansi Singh [Tue, 10 Mar 2026 22:50:22 +0000 (22:50 +0000)] 
t7605: use test_path_is_file instead of test -f

Replace old-style 'test -f' path checks with the modern
test_path_is_file helper in the merge_c1_to_c2_cmds block.

The helper provides clearer failure messages and is the
established convention in Git's test suite.

Signed-off-by: Mansi Singh <mansimaanu8627@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agoSync with 'master'
Junio C Hamano [Tue, 10 Mar 2026 21:24:49 +0000 (14:24 -0700)] 
Sync with 'master'

2 months agoMerge branch 'ty/patch-ids-document-lazy-eval' into next
Junio C Hamano [Tue, 10 Mar 2026 21:24:39 +0000 (14:24 -0700)] 
Merge branch 'ty/patch-ids-document-lazy-eval' into next

In-code comment update to record a design decision to allow lazy
computation of patch IDs.

* ty/patch-ids-document-lazy-eval:
  patch-ids: document intentional const-casting in patch_id_neq()

2 months agoMerge branch 'rs/history-ergonomics-updates-fix' into next
Junio C Hamano [Tue, 10 Mar 2026 21:24:39 +0000 (14:24 -0700)] 
Merge branch 'rs/history-ergonomics-updates-fix' into next

Fix use of uninitialized variable.

* rs/history-ergonomics-updates-fix:
  history: initialize rev_info in cmd_history_reword()

2 months agoMerge branch 'jk/unleak-mmap' into next
Junio C Hamano [Tue, 10 Mar 2026 21:24:38 +0000 (14:24 -0700)] 
Merge branch 'jk/unleak-mmap' into next

Plug a few leaks where mmap'ed memory regions are not unmapped.

* jk/unleak-mmap:
  meson: turn on NO_MMAP when building with LSan
  Makefile: turn on NO_MMAP when building with LSan
  object-file: fix mmap() leak in odb_source_loose_read_object_stream()
  pack-revindex: avoid double-loading .rev files
  check_connected(): fix leak of pack-index mmap
  check_connected(): delay opening new_pack

2 months agoMerge branch 'ty/setup-error-tightening' into next
Junio C Hamano [Tue, 10 Mar 2026 21:24:38 +0000 (14:24 -0700)] 
Merge branch 'ty/setup-error-tightening' into next

While discovering a ".git" directory, the code treats any stat()
failure as a sign that a filesystem entity .git does not exist
there, and ignores ".git" that is not a "gitdir" file or a
directory.  The code has been tightened to notice and report
filesystem corruption better.

* ty/setup-error-tightening:
  setup: improve error diagnosis for invalid .git files

2 months agoThe 14th batch
Junio C Hamano [Tue, 10 Mar 2026 20:56:16 +0000 (13:56 -0700)] 
The 14th batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agoMerge branch 'jh/alias-i18n-fixes'
Junio C Hamano [Tue, 10 Mar 2026 21:23:23 +0000 (14:23 -0700)] 
Merge branch 'jh/alias-i18n-fixes'

Further update to the i18n alias support to avoid regressions.

* jh/alias-i18n-fixes:
  doc: fix list continuation in alias.adoc
  git, help: fix memory leaks in alias listing
  alias: treat empty subsection [alias ""] as plain [alias]
  doc: fix list continuation in alias subsection example

2 months agoMerge branch 'pt/fsmonitor-watchman-sample-fix'
Junio C Hamano [Tue, 10 Mar 2026 21:23:22 +0000 (14:23 -0700)] 
Merge branch 'pt/fsmonitor-watchman-sample-fix'

Fix typo-induced breakages in fsmonitor-watchman sample hook.

* pt/fsmonitor-watchman-sample-fix:
  fsmonitor-watchman: fix variable reference and remove redundant code

2 months agoMerge branch 'mm/diff-no-index-find-object'
Junio C Hamano [Tue, 10 Mar 2026 21:23:22 +0000 (14:23 -0700)] 
Merge branch 'mm/diff-no-index-find-object'

"git diff --no-index --find-object=<object-name>" outside a
repository of course wouldn't be able to find the object and died
while parsing the command line, which is made to die in a bit more
user-friendly way.

* mm/diff-no-index-find-object:
  diff: fix crash with --find-object outside repository

2 months agoMerge branch 'ps/ci-reduce-gitlab-envsize'
Junio C Hamano [Tue, 10 Mar 2026 21:23:21 +0000 (14:23 -0700)] 
Merge branch 'ps/ci-reduce-gitlab-envsize'

CI fix.

* ps/ci-reduce-gitlab-envsize:
  ci: unset GITLAB_FEATURES envvar to not bust xargs(1) limits

2 months agoMerge branch 'fp/t3310-test-path-is-helpers'
Junio C Hamano [Tue, 10 Mar 2026 21:23:20 +0000 (14:23 -0700)] 
Merge branch 'fp/t3310-test-path-is-helpers'

Test clean-up.

* fp/t3310-test-path-is-helpers:
  t3310: replace test -f/-d with test_path_is_file/test_path_is_dir

2 months agoMerge branch 'ss/test-that-that-typofix'
Junio C Hamano [Tue, 10 Mar 2026 21:23:19 +0000 (14:23 -0700)] 
Merge branch 'ss/test-that-that-typofix'

Typofix in t/.

* ss/test-that-that-typofix:
  t: fix "that that" typo in lib-unicode-nfc-nfd.sh

2 months agoMerge branch 'rs/parse-options-duplicated-long-options'
Junio C Hamano [Tue, 10 Mar 2026 21:23:18 +0000 (14:23 -0700)] 
Merge branch 'rs/parse-options-duplicated-long-options'

The parse-options API learned to notice an options[] array with
duplicated long options.

* rs/parse-options-duplicated-long-options:
  parseopt: check for duplicate long names and numerical options
  pack-objects: remove duplicate --stdin-packs definition

2 months agoMerge branch 'ar/config-hooks'
Junio C Hamano [Tue, 10 Mar 2026 21:23:18 +0000 (14:23 -0700)] 
Merge branch 'ar/config-hooks'

Allow hook commands to be defined (possibly centrally) in the
configuration files, and run multiple of them for the same hook
event.

* ar/config-hooks:
  hook: add -z option to "git hook list"
  hook: allow out-of-repo 'git hook' invocations
  hook: allow event = "" to overwrite previous values
  hook: allow disabling config hooks
  hook: include hooks from the config
  hook: add "git hook list" command
  hook: run a list of hooks to prepare for multihook support
  hook: add internal state alloc/free callbacks

2 months agoMerge branch 'kh/format-patch-noprefix-is-boolean'
Junio C Hamano [Tue, 10 Mar 2026 21:23:17 +0000 (14:23 -0700)] 
Merge branch 'kh/format-patch-noprefix-is-boolean'

The configuration variable format.noprefix did not behave as a
proper boolean variable, which has now been fixed and documented.

* kh/format-patch-noprefix-is-boolean:
  doc: diff-options.adoc: make *.noprefix split translatable
  doc: diff-options.adoc: show format.noprefix for format-patch
  format-patch: make format.noprefix a boolean

2 months agodir: avoid -Wdiscarded-qualifiers in remove_path()
Collin Funk [Mon, 9 Mar 2026 03:23:06 +0000 (20:23 -0700)] 
dir: avoid -Wdiscarded-qualifiers in remove_path()

When building with glibc-2.43 there is the following warning:

    dir.c:3526:15: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
     3526 |         slash = strrchr(name, '/');
          |               ^

In this case we use a non-const pointer to get the last slash of the
unwritable file name, and then use it again to write in the strdup'd
file name.

We can avoid this warning and make the code a bit more clear by using a
separate variable to access the original argument and its strdup'd
copy.

Signed-off-by: Collin Funk <collin.funk1@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agoSubmittingPatches: spell out "replace fully to pretend to be perfect"
Junio C Hamano [Mon, 9 Mar 2026 22:15:05 +0000 (15:15 -0700)] 
SubmittingPatches: spell out "replace fully to pretend to be perfect"

It unfortunately is a recurring theme that new developers tend to
pile more "fixup" patches on top of the already reviewed patches,
making the topic longer and keeping the history of all wrong turns,
which interests nobody in the larger picture.  Even picking a narrow
search in the list archive for "pretend to be a perfect " substring,
we find these:

    https://lore.kernel.org/git/xmqqk29bsz2o.fsf@gitster.mtv.corp.google.com/
    https://lore.kernel.org/git/xmqqd0ds5ysq.fsf@gitster-ct.c.googlers.com/
    https://lore.kernel.org/git/xmqqr173faez.fsf@gitster.g/

The SubmittingPatches guide does talk about going incremental once a
topic hits the 'next' branch, but it does not say much about how a
new iteration of the topic should be prepared before that happens,
and it does not mention that the developers are encouraged to seize
the opportunity to pretend to be perfect with a full replacement set
of patches.

Add a new paragraph to stress this point in the section that
describes the life-cycle of a patch series.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agoSync with 'master'
Junio C Hamano [Mon, 9 Mar 2026 21:42:24 +0000 (14:42 -0700)] 
Sync with 'master'

2 months agoMerge branch 'os/doc-git-custom-commands' into next
Junio C Hamano [Mon, 9 Mar 2026 21:42:12 +0000 (14:42 -0700)] 
Merge branch 'os/doc-git-custom-commands' into next

Doc update.

* os/doc-git-custom-commands:
  doc: make it easier to find custom command information

2 months agoMerge branch 'fp/t3310-unhide-git-failures' into next
Junio C Hamano [Mon, 9 Mar 2026 21:42:12 +0000 (14:42 -0700)] 
Merge branch 'fp/t3310-unhide-git-failures' into next

The construct 'test "$(command)" = expectation' loses the exit
status from the command, which has been fixed by breaking up the
statement into pieces.

* fp/t3310-unhide-git-failures:
  t3310: avoid hiding failures from rev-parse in command substitutions

2 months agoMerge branch 'mf/format-patch-cover-letter-format' into next
Junio C Hamano [Mon, 9 Mar 2026 21:42:11 +0000 (14:42 -0700)] 
Merge branch 'mf/format-patch-cover-letter-format' into next

"git format-patch --cover-letter" learns to use a simpler format
instead of the traditional shortlog format to list its commits with
a new --cover-letter-format option and format.commitListFormat
configuration variable.

* mf/format-patch-cover-letter-format:
  docs: add usage for the cover-letter fmt feature
  format-patch: add commitListFormat config
  format-patch: add ability to use alt cover format
  format-patch: move cover letter summary generation
  pretty.c: add %(count) and %(total) placeholders

2 months agoMerge branch 'jt/repo-structure-extrema' into next
Junio C Hamano [Mon, 9 Mar 2026 21:42:11 +0000 (14:42 -0700)] 
Merge branch 'jt/repo-structure-extrema' into next

"git repo structure" command learns to report maximum values on
various aspects of objects it inspects.

* jt/repo-structure-extrema:
  builtin/repo: find tree with most entries
  builtin/repo: find commit with most parents
  builtin/repo: add OID annotations to table output
  builtin/repo: collect largest inflated objects
  builtin/repo: add helper for printing keyvalue output
  builtin/repo: update stats for each object

2 months agoMerge branch 'sp/wt-status-wo-the-repository' into next
Junio C Hamano [Mon, 9 Mar 2026 21:42:11 +0000 (14:42 -0700)] 
Merge branch 'sp/wt-status-wo-the-repository' into next

Reduce dependence on the global the_hash_algo and the_repository
variables of wt-status code path.

* sp/wt-status-wo-the-repository:
  wt-status: use hash_algo from local repository instead of global the_hash_algo
  wt-status: replace uses of the_repository with local repository instances
  wt-status: pass struct repository through function parameters

2 months agoThe 13th batch
Junio C Hamano [Mon, 9 Mar 2026 21:35:46 +0000 (14:35 -0700)] 
The 13th batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agoMerge branch 'jk/repo-structure-cleanup'
Junio C Hamano [Mon, 9 Mar 2026 21:36:56 +0000 (14:36 -0700)] 
Merge branch 'jk/repo-structure-cleanup'

Code clean-up.

* jk/repo-structure-cleanup:
  repo: remove unnecessary variable shadow

2 months agoMerge branch 'lp/diff-stat-utf8-display-width-fix'
Junio C Hamano [Mon, 9 Mar 2026 21:36:55 +0000 (14:36 -0700)] 
Merge branch 'lp/diff-stat-utf8-display-width-fix'

"git log --graph --stat" did not count the display width of colored
graph part of its own output correctly, which has been corrected.

* lp/diff-stat-utf8-display-width-fix:
  t4052: test for diffstat width when prefix contains ANSI escape codes
  diff: handle ANSI escape codes in prefix when calculating diffstat width

2 months agoMerge branch 'cs/add-skip-submodule-ignore-all'
Junio C Hamano [Mon, 9 Mar 2026 21:36:55 +0000 (14:36 -0700)] 
Merge branch 'cs/add-skip-submodule-ignore-all'

"git add <submodule>" has been taught to honor
submodule.<name>.ignore that is set to "all" (and requires "git add
-f" to override it).

* cs/add-skip-submodule-ignore-all:
  Documentation: update add --force option + ignore=all config
  tests: fix existing tests when add an ignore=all submodule
  tests: t2206-add-submodule-ignored: ignore=all and add --force tests
  read-cache: submodule add need --force given ignore=all configuration
  read-cache: update add_files_to_cache take param ignored_too

2 months agoMerge branch 'ps/refs-for-each'
Junio C Hamano [Mon, 9 Mar 2026 21:36:55 +0000 (14:36 -0700)] 
Merge branch 'ps/refs-for-each'

Code refactoring around refs-for-each-* API functions.

* ps/refs-for-each:
  refs: replace `refs_for_each_fullref_in()`
  refs: replace `refs_for_each_namespaced_ref()`
  refs: replace `refs_for_each_glob_ref()`
  refs: replace `refs_for_each_glob_ref_in()`
  refs: replace `refs_for_each_rawref_in()`
  refs: replace `refs_for_each_rawref()`
  refs: replace `refs_for_each_ref_in()`
  refs: improve verification for-each-ref options
  refs: generalize `refs_for_each_fullref_in_prefixes()`
  refs: generalize `refs_for_each_namespaced_ref()`
  refs: speed up `refs_for_each_glob_ref_in()`
  refs: introduce `refs_for_each_ref_ext`
  refs: rename `each_ref_fn`
  refs: rename `do_for_each_ref_flags`
  refs: move `do_for_each_ref_flags` further up
  refs: move `refs_head_ref_namespaced()`
  refs: remove unused `refs_for_each_include_root_ref()`

2 months agoMerge branch 'ar/run-command-hook-take-2'
Junio C Hamano [Mon, 9 Mar 2026 21:36:55 +0000 (14:36 -0700)] 
Merge branch 'ar/run-command-hook-take-2'

Use the hook API to replace ad-hoc invocation of hook scripts via
the run_command() API.

* ar/run-command-hook-take-2:
  builtin/receive-pack: avoid spinning no-op sideband async threads
  receive-pack: convert receive hooks to hook API
  receive-pack: convert update hooks to new API
  run-command: poll child input in addition to output
  hook: add jobs option
  reference-transaction: use hook API instead of run-command
  transport: convert pre-push to hook API
  hook: allow separate std[out|err] streams
  hook: convert 'post-rewrite' hook in sequencer.c to hook API
  hook: provide stdin via callback
  run-command: add stdin callback for parallelization
  run-command: add helper for pp child states
  t1800: add hook output stream tests

2 months ago.mailmap: update email address for Tian Yuchen
Tian Yuchen [Sun, 8 Mar 2026 04:33:44 +0000 (12:33 +0800)] 
.mailmap: update email address for Tian Yuchen

Map my old Gmail address to my new custom address in .mailmap.

Signed-off-by: Tian Yuchen <a3205153416@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agopatch-ids: document intentional const-casting in patch_id_neq()
Tian Yuchen [Mon, 9 Mar 2026 06:51:40 +0000 (14:51 +0800)] 
patch-ids: document intentional const-casting in patch_id_neq()

The hashmap API requires the comparison function to take const pointers.
However, patch_id_neq() uses lazy evaluation to compute patch IDs on
demand. As established in b3dfeebb (rebase: avoid computing unnecessary
patch IDs, 2016-07-29), this avoids unnecessary work since not all
objects in the hashmap will eventually be compared.

Remove the ten-year-old "NEEDSWORK" comment and formally document
this intentional design trade-off.

Signed-off-by: Tian Yuchen <cat@malon.dev>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agohistory: initialize rev_info in cmd_history_reword()
René Scharfe [Sun, 8 Mar 2026 09:57:02 +0000 (10:57 +0100)] 
history: initialize rev_info in cmd_history_reword()

git history reword expects a single valid revision argument and errors
out if it doesn't get it.  In that case the struct rev_info passed to
release_revisions() for cleanup is still uninitialized, which can result
in attempts to free(3) random pointers.  Avoid that by initializing the
structure.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agobloom: remove a misleading const qualifier
Collin Funk [Mon, 9 Mar 2026 02:55:11 +0000 (19:55 -0700)] 
bloom: remove a misleading const qualifier

When building with glibc-2.43 there is the following warning:

    bloom.c: In function ‘get_or_compute_bloom_filter’:
    bloom.c:515:52: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
      515 |                                 char *last_slash = strrchr(path, '/');
          |                                                    ^~~~~~~

In this case, we always write through "path" through the "last_slash"
pointer. Therefore, the const qualifier on "path" is misleading and we
can just remove it.

Signed-off-by: Collin Funk <collin.funk1@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agot3310: avoid hiding failures from rev-parse in command substitutions
Francesco Paparatto [Sat, 7 Mar 2026 10:36:31 +0000 (11:36 +0100)] 
t3310: avoid hiding failures from rev-parse in command substitutions

Running `git` commands inside command substitutions like

    test "$(git rev-parse A)" = "$(git rev-parse B)"

can hide failures from the `git` invocations and provide little
diagnostic information when `test` fails.

Use `test_cmp` when comparing against a stored expected value so
mismatches show both expected and actual output. Use `test_cmp_rev`
when comparing two revisions. These helpers produce clearer failure
output, making it easier to understand what went wrong.

Suggested-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Francesco Paparatto <francescopaparatto@gmail.com>
Reviewed-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agodoc: make it easier to find custom command information
Omri Sarig [Sat, 7 Mar 2026 17:08:01 +0000 (17:08 +0000)] 
doc: make it easier to find custom command information

Git supports creating additional commands through aliases, and through
placement of executables with a "git-" prefix in the PATH.

This information was not easy enough to find - users will look for this
information around the command description, but the documentation
exists in other locations.

Update the "GIT COMMANDS" section to reference the relevant sections,
making it easier for to find this information.

Signed-off-by: Omri Sarig <omri.sarig13@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agomeson: turn on NO_MMAP when building with LSan
Jeff King [Fri, 6 Mar 2026 16:25:13 +0000 (11:25 -0500)] 
meson: turn on NO_MMAP when building with LSan

The previous commit taught the Makefile to turn on NO_MMAP in this
instance. We should do the same with meson for consistency. We already
do this for ASan builds, so we can just tweak one conditional.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agoMakefile: turn on NO_MMAP when building with LSan
Jeff King [Thu, 5 Mar 2026 23:13:05 +0000 (18:13 -0500)] 
Makefile: turn on NO_MMAP when building with LSan

The past few commits fixed some cases where we leak memory allocated by
mmap(). Building with SANITIZE=leak doesn't detect these because it
covers only heap buffers allocated by malloc().

But if we build with NO_MMAP, our compat mmap() implementation will
allocate a heap buffer and pread() into it. And thus Lsan will detect
these leaks for free.

Using NO_MMAP is less performant, of course, since we have to use extra
memory and read in the whole file, rather than faulting in pages from
disk. But LSan builds are already slow, and this doesn't make them
measurably worse. Getting extra coverage for our leak-checking is worth
it.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agoobject-file: fix mmap() leak in odb_source_loose_read_object_stream()
Jeff King [Sat, 7 Mar 2026 02:24:59 +0000 (21:24 -0500)] 
object-file: fix mmap() leak in odb_source_loose_read_object_stream()

We mmap() a loose object file, storing the result in the local variable
"mapped", which is eventually assigned into our stream struct as
"st.mapped". If we hit an error, we jump to an error label which does:

  munmap(st.mapped, st.mapsize);

to clean up. But this is wrong; we don't assign st.mapped until the end
of the function, after all of the "goto error" jumps. So this munmap()
is never cleaning up anything (st.mapped is always NULL, because we
initialize the struct with calloc).

Instead, we should feed the local variable to munmap().

This leak is due to 595296e124 (streaming: allocate stream inside the
backend-specific logic, 2025-11-23), which introduced the local
variable. Before that, we assigned the mmap result directly into
st.mapped. It was probably switched there so that we do not have to
allocate/free the struct when the map operation fails (e.g., because we
don't have the loose object). Before that commit, the struct was passed
in from the caller, so there was no allocation at all.

You can see the leak in the test suite by building with:

  make SANITIZE=leak NO_MMAP=1 CC=clang

and running t1060. We need NO_MMAP so that the mmap() is backed by an
actual malloc(), which allows LSan to detect it. And the leak seems not
to be detected when compiling with gcc, probably due to some internal
compiler decisions about how the stack memory is written.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agodocs: add usage for the cover-letter fmt feature
Mirko Faina [Fri, 6 Mar 2026 23:34:44 +0000 (00:34 +0100)] 
docs: add usage for the cover-letter fmt feature

Document the new "--cover-letter-format" option in format-patch and its
related configuration variable "format.commitListFormat".

Signed-off-by: Mirko Faina <mroik@delayed.space>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agoformat-patch: add commitListFormat config
Mirko Faina [Fri, 6 Mar 2026 23:34:43 +0000 (00:34 +0100)] 
format-patch: add commitListFormat config

Using "--cover-letter" we can tell format-patch to generate a cover
letter, in this cover letter there's a list of commits included in the
patch series and the format is specified by the "--cover-letter-format"
option. Would be useful if this format could be configured from the
config file instead of always needing to pass it from the command line.

Teach format-patch how to read the format spec for the cover letter from
the config files. The variable it should look for is called
format.commitListFormat.

Possible values:
  - commitListFormat is set but no string is passed: it will default to
    "[%(count)/%(total)] %s"

  - if a string is passed: will use it as a format spec. Note that this
    is either "shortlog" or a format spec prefixed by "log:"
    e.g."log:%s (%an)"

  - if commitListFormat is not set: it will default to the shortlog
    format.

Signed-off-by: Mirko Faina <mroik@delayed.space>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agoformat-patch: add ability to use alt cover format
Mirko Faina [Fri, 6 Mar 2026 23:34:42 +0000 (00:34 +0100)] 
format-patch: add ability to use alt cover format

Often when sending patch series there's a need to clarify to the
reviewer what's the purpose of said series, since it might be difficult
to understand it from reading the commits messages one by one.

"git format-patch" provides the useful "--cover-letter" flag to declare
if we want it to generate a template for us to use. By default it will
generate a "git shortlog" of the changes, which developers find less
useful than they'd like, mainly because the shortlog groups commits by
author, and gives no obvious chronological order.

Give format-patch the ability to specify an alternative format spec
through the "--cover-letter-format" option. This option either takes
"shortlog", which is the current format, or a format spec prefixed with
"log:".

Example:
    git format-patch --cover-letter \
        --cover-letter-format="log:[%(count)/%(total)] %s (%an)" HEAD~3

    [1/3] this is a commit summary (Mirko Faina)
    [2/3] this is another commit summary (Mirko Faina)
    ...

Signed-off-by: Mirko Faina <mroik@delayed.space>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agoformat-patch: move cover letter summary generation
Mirko Faina [Fri, 6 Mar 2026 23:34:41 +0000 (00:34 +0100)] 
format-patch: move cover letter summary generation

As of now format-patch allows generation of a template cover letter for
patch series through "--cover-letter".

Move shortlog summary code generation to its own function. This is done
in preparation to other patches where we enable the user to format the
commit list using thier own format string.

Signed-off-by: Mirko Faina <mroik@delayed.space>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agopretty.c: add %(count) and %(total) placeholders
Mirko Faina [Fri, 6 Mar 2026 23:34:40 +0000 (00:34 +0100)] 
pretty.c: add %(count) and %(total) placeholders

In many commands we can customize the output through the "--format" or
the "--pretty" options. This patch adds two new placeholders used mainly
when there's a range of commits that we want to show.

Currently these two placeholders are not usable as they're coupled with
the rev_info->nr and rev_info->total fields, fields that are used only
by the format-patch numbered email subjects.

Teach repo_format_commit_message() the %(count) and %(total)
placeholders.

Signed-off-by: Mirko Faina <mroik@delayed.space>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agoMerge branch 'sp/send-email-validate-charset' into next
Junio C Hamano [Fri, 6 Mar 2026 22:43:09 +0000 (14:43 -0800)] 
Merge branch 'sp/send-email-validate-charset' into next

"git send-email" has learned to be a bit more careful when it
accepts charset to use from the end-user, to avoid 'y' (mistaken
'yes' when expecting a charset like 'UTF-8') and other nonsense.

* sp/send-email-validate-charset:
  send-email: validate charset name in 8bit encoding prompt

2 months agoMerge branch 'dt/send-email-client-cert' into next
Junio C Hamano [Fri, 6 Mar 2026 22:43:08 +0000 (14:43 -0800)] 
Merge branch 'dt/send-email-client-cert' into next

"git send-email" learns to support use of client-side certificates.

* dt/send-email-client-cert:
  send-email: add client certificate options

2 months agoMerge branch 'ps/ci-gitlab-prepare-for-macos-14-deprecation' into next
Junio C Hamano [Fri, 6 Mar 2026 22:43:08 +0000 (14:43 -0800)] 
Merge branch 'ps/ci-gitlab-prepare-for-macos-14-deprecation' into next

Move gitlab CI from macOS 14 images that are being deprecated.

* ps/ci-gitlab-prepare-for-macos-14-deprecation:
  gitlab-ci: update to macOS 15 images
  meson: detect broken iconv that requires ICONV_RESTART_RESET
  meson: simplify iconv-emits-BOM check

2 months agoMerge branch 'ag/send-email-sasl-with-host-port' into next
Junio C Hamano [Fri, 6 Mar 2026 22:43:08 +0000 (14:43 -0800)] 
Merge branch 'ag/send-email-sasl-with-host-port' into next

"git send-email" learns to pass hostname/port to Authen::SASL
module.

* ag/send-email-sasl-with-host-port:
  send-email: pass smtp hostname and port to Authen::SASL