]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
2 months agoMerge branch 'jw/apply-corrupt-location' into next
Junio C Hamano [Mon, 23 Mar 2026 17:03:57 +0000 (10:03 -0700)] 
Merge branch 'jw/apply-corrupt-location' into next

"git apply" now reports the name of the input file along with the
line number when it encounters a corrupt patch, and correctly
resets the line counter when processing multiple patch files.

* jw/apply-corrupt-location:
  apply: report input location in binary and garbage patch errors
  apply: report input location in header parsing errors
  apply: report the location of corrupt patches

2 months agoSync with 'master'
Junio C Hamano [Sat, 21 Mar 2026 16:43:42 +0000 (09:43 -0700)] 
Sync with 'master'

2 months agoMerge branch 'rs/split-index-the-repo-fix' into next
Junio C Hamano [Sat, 21 Mar 2026 16:43:24 +0000 (09:43 -0700)] 
Merge branch 'rs/split-index-the-repo-fix' into next

split-index.c has been updated to not use the global the_repository
and the_hash_algo variables.

* rs/split-index-the-repo-fix:
  split-index: stop using the_repository and the_hash_algo

2 months agoMerge branch 'rs/ahead-behind-cleanup-optimization' into next
Junio C Hamano [Sat, 21 Mar 2026 16:43:24 +0000 (09:43 -0700)] 
Merge branch 'rs/ahead-behind-cleanup-optimization' into next

The cleanup of remaining bitmaps in "ahead_behind()" has been
simplified.

* rs/ahead-behind-cleanup-optimization:
  commit-reach: simplify cleanup of remaining bitmaps in ahead_behind ()

2 months agoMerge branch 'jc/rerere-modern-strbuf-handling' into next
Junio C Hamano [Sat, 21 Mar 2026 16:43:24 +0000 (09:43 -0700)] 
Merge branch 'jc/rerere-modern-strbuf-handling' into next

Code clean-up overdue by 19 years.

* jc/rerere-modern-strbuf-handling:
  cocci: strbuf.buf is never NULL
  rerere: update to modern representation of empty strbufs

2 months agoMerge branch 'master' of https://github.com/j6t/git-gui
Junio C Hamano [Sat, 21 Mar 2026 16:25:58 +0000 (09:25 -0700)] 
Merge branch 'master' of https://github.com/j6t/git-gui

* 'master' of https://github.com/j6t/git-gui:
  git-gui: grey out comment lines in commit message
  git-gui: wire up "git-gui--askyesno" with Meson
  git-gui: massage "git-gui--askyesno" with "generate-script.sh"
  git-gui: prefer shell at "/bin/sh" with Meson
  git-gui: fix use of GIT_CEILING_DIRECTORIES
  git-gui: shift tabstops to account for the first column of patch text

2 months agoMerge branch 'master' of https://github.com/j6t/gitk
Junio C Hamano [Sat, 21 Mar 2026 16:25:10 +0000 (09:25 -0700)] 
Merge branch 'master' of https://github.com/j6t/gitk

* 'master' of https://github.com/j6t/gitk:
  gitk: l10n: make PO headers identify the Gitk project
  gitk: ignore generated POT file
  gitk: i18n: use "Gitk" as package name in POT file
  gitk: commit translation files without file information
  gitk: support link color in the Preferences dialog
  gitk: use config settings for head/tag colors

2 months agoMerge branch 'kh/doc-interpret-trailers-1' into next
Junio C Hamano [Fri, 20 Mar 2026 21:49:14 +0000 (14:49 -0700)] 
Merge branch 'kh/doc-interpret-trailers-1' into next

Doc updates.

* kh/doc-interpret-trailers-1:
  interpret-trailers: use placeholder instead of *
  doc: config: convert trailers section to synopsis style
  doc: interpret-trailers: normalize and fill out options
  doc: interpret-trailers: convert to synopsis style

2 months agoMerge branch 'ej/ref-transaction-hook-preparing' into next
Junio C Hamano [Fri, 20 Mar 2026 21:49:14 +0000 (14:49 -0700)] 
Merge branch 'ej/ref-transaction-hook-preparing' into next

The reference-transaction hook was taught to be triggered before
taking locks on references in the "preparing" phase.

* ej/ref-transaction-hook-preparing:
  refs: add 'preparing' phase to the reference-transaction hook

2 months agoMerge branch 'mf/apply-p-no-atoi' into next
Junio C Hamano [Fri, 20 Mar 2026 21:49:14 +0000 (14:49 -0700)] 
Merge branch 'mf/apply-p-no-atoi' into next

"git apply -p<n>" parses <n> more carefully now.

* mf/apply-p-no-atoi:
  apply.c: fix -p argument parsing

2 months agoMerge branch 'gi/doc-boolean-config-typofix' into next
Junio C Hamano [Fri, 20 Mar 2026 21:49:13 +0000 (14:49 -0700)] 
Merge branch 'gi/doc-boolean-config-typofix' into next

Doc typofix.

* gi/doc-boolean-config-typofix:
  doc: add missing space on git-config page

2 months agoMerge branch 'mr/merge-file-object-id-worktree-fix' into next
Junio C Hamano [Fri, 20 Mar 2026 21:49:13 +0000 (14:49 -0700)] 
Merge branch 'mr/merge-file-object-id-worktree-fix' into next

merge-file --object-id used to trigger a BUG when run in a linked
worktree, which has been fixed.

* mr/merge-file-object-id-worktree-fix:
  merge-file: fix BUG when --object-id is used in a worktree

2 months agoMerge branch 'rs/prio-queue-to-commit-stack' into next
Junio C Hamano [Fri, 20 Mar 2026 21:49:12 +0000 (14:49 -0700)] 
Merge branch 'rs/prio-queue-to-commit-stack' into next

Uses of prio_queue as a LIFO stack of commits have been written
with commit_stack.

* rs/prio-queue-to-commit-stack:
  use commit_stack instead of prio_queue in LIFO mode

2 months agoMerge branch 'ps/build-tweaks' into next
Junio C Hamano [Fri, 20 Mar 2026 21:49:12 +0000 (14:49 -0700)] 
Merge branch 'ps/build-tweaks' into next

Tweak the build infrastructure by moving tools around.

* ps/build-tweaks:
  meson: precompile "git-compat-util.h"
  meson: compile compatibility sources separately
  git-compat-util.h: move warning infra to prepare for PCHs
  builds: move build scripts into "tools/"
  contrib: move "update-unicode.sh" script into "tools/"
  contrib: move "coverage-diff.sh" script into "tools/"
  contrib: move "coccinelle/" directory into "tools/"
  Introduce new "tools/" directory

2 months agoMerge branch 'jk/diff-highlight-identical-pairs' into next
Junio C Hamano [Fri, 20 Mar 2026 21:49:12 +0000 (14:49 -0700)] 
Merge branch 'jk/diff-highlight-identical-pairs' into next

The handling of the incomplete lines at the end by "git
diff-highlight" has been fixed.

* jk/diff-highlight-identical-pairs:
  contrib/diff-highlight: do not highlight identical pairs

2 months agoMerge branch 'jx/i18n-fix' of github.com:jiangxin/gitk
Johannes Sixt [Fri, 20 Mar 2026 08:23:32 +0000 (09:23 +0100)] 
Merge branch 'jx/i18n-fix' of github.com:jiangxin/gitk

* 'jx/i18n-fix' of github.com:jiangxin/gitk:
  gitk: l10n: make PO headers identify the Gitk project
  gitk: ignore generated POT file
  gitk: i18n: use "Gitk" as package name in POT file

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
2 months agoMerge branch 'js/i18n-no-location'
Johannes Sixt [Fri, 20 Mar 2026 08:18:19 +0000 (09:18 +0100)] 
Merge branch 'js/i18n-no-location'

* js/i18n-no-location:
  gitk: commit translation files without file information

2 months agoMerge branch 'sb/heed-ref-decoration-settings'
Johannes Sixt [Fri, 20 Mar 2026 08:07:09 +0000 (09:07 +0100)] 
Merge branch 'sb/heed-ref-decoration-settings'

* sb/heed-ref-decoration-settings:
  gitk: use config settings for head/tag colors

2 months agocontrib/diff-highlight: do not highlight identical pairs
Jeff King [Tue, 17 Mar 2026 23:02:23 +0000 (19:02 -0400)] 
contrib/diff-highlight: do not highlight identical pairs

We pair lines for highlighting based on their position in the hunk. So
we should never see two identical lines paired, like:

  -one
  -two
  +one
  +something else

which would pair -one/+one, because that implies that the diff could
easily be shrunk by turning line "one" into context.

But there is (at least) one exception: removing a newline at the end of
a file will produce a diff like:

  -foo
  +foo
  \No newline at end of file

And we will pair those two lines. As a result, we end up marking the
whole line, including the newline, as the shared prefix. And there's an
empty suffix.

The most obvious bug here is that when we try to print the highlighted
lines, we remove the trailing newline from the suffix, but do not bother
with the prefix (under the assumption that there had to be a difference
_somewhere_ in the line, and thus the prefix would not eat all the way
up to the newline). And so you get an extra line like:

  -foo

  +foo

  \No newline at end of file

This is obviously ugly, but also causes interactive.diffFilter to
(rightly) complain that the input and output do not match their lines
1-to-1.

This could easily be fixed by chomping the prefix, too, but I think the
problem is deeper. For one, I suspect some of the other logic gets
confused by forming an array with zero-indexed element "3" in a
3-element array. But more importantly, we try not to highlight whole
lines, as there's nothing interesting to show there. So let's catch this
early in is_pair_interesting() and bail to our usual passthrough
strategy.

Reported-by: Scott Baker <scott@perturb.org>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agogitk: l10n: make PO headers identify the Gitk project
Jiang Xin [Thu, 19 Mar 2026 09:11:17 +0000 (17:11 +0800)] 
gitk: l10n: make PO headers identify the Gitk project

Commit f697d08 (gitk: i18n: use "Gitk" as package name in POT file,
2026-03-19) updated the generated POT template to use "Gitk" in its
Project-Id-Version header. Several existing PO files still carry older
header values such as "git" or "git-gui", so they do not consistently
identify themselves as Gitk translations.

Update the Project-Id-Version field in all Gitk PO files so that they
identify the Gitk project consistently.

The "Project-Id-Version" field in the PO header helps tools identify
which project a PO file belongs to. For example, Git's
"git-po-helper" uses it to choose project-specific checks and POT
handling rules. Without this change, some Gitk PO files are
misidentified because their headers still refer to other projects.

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
2 months agococci: strbuf.buf is never NULL
Junio C Hamano [Thu, 19 Mar 2026 22:39:02 +0000 (15:39 -0700)] 
cocci: strbuf.buf is never NULL

We recently noticed one old code from 19 years ago protecting
against an ancient strbuf convention that the .buf member can be
NULL for an empty strbuf.  As that is no longer the case in the
modern codebase, let's catch such a construct.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agogitk: ignore generated POT file
Jiang Xin [Thu, 19 Mar 2026 09:08:47 +0000 (17:08 +0800)] 
gitk: ignore generated POT file

"po/gitk.pot" is generated from the source for translation maintenance.
Ignore it in the working tree so regenerating the template does not
introduce unnecessary noise in `git status`.

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
2 months agogitk: i18n: use "Gitk" as package name in POT file
Jiang Xin [Thu, 19 Mar 2026 09:06:25 +0000 (17:06 +0800)] 
gitk: i18n: use "Gitk" as package name in POT file

Use "Gitk" instead of the placeholder "PACKAGE" in the header of the
generated po/gitk.pot file. In particular, the "Project-Id-Version"
field in the header entry should be set to:

    "Project-Id-Version: Gitk\n"

New PO files generated from this POT file will inherit that package
name.

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
2 months agosplit-index: stop using the_repository and the_hash_algo
René Scharfe [Thu, 19 Mar 2026 18:48:07 +0000 (19:48 +0100)] 
split-index: stop using the_repository and the_hash_algo

Reference the hash algorithm of the passed-in index throughout the code.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agocommit-reach: simplify cleanup of remaining bitmaps in ahead_behind ()
René Scharfe [Thu, 19 Mar 2026 16:24:40 +0000 (17:24 +0100)] 
commit-reach: simplify cleanup of remaining bitmaps in ahead_behind ()

Don't bother extracting the last few remaining prio_queue items in
order when we only want to free their associated bitmaps; just iterate
over the item array.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agoSync with 'master'
Junio C Hamano [Thu, 19 Mar 2026 17:11:54 +0000 (10:11 -0700)] 
Sync with 'master'

2 months agoThe 18th batch
Junio C Hamano [Thu, 19 Mar 2026 16:54:41 +0000 (09:54 -0700)] 
The 18th batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agoMerge branch 'ss/submodule--helper-use-xmalloc'
Junio C Hamano [Thu, 19 Mar 2026 16:54:56 +0000 (09:54 -0700)] 
Merge branch 'ss/submodule--helper-use-xmalloc'

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'
Junio C Hamano [Thu, 19 Mar 2026 16:54:56 +0000 (09:54 -0700)] 
Merge branch 'ps/unit-test-c-escape-names.txt'

The unit test helper function was taught to use backslash +
mnemonic 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'
Junio C Hamano [Thu, 19 Mar 2026 16:54:56 +0000 (09:54 -0700)] 
Merge branch 'jc/doc-wholesale-replace-before-next'

Doc update.

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

2 months agoMerge branch 'lc/rebase-trailer'
Junio C Hamano [Thu, 19 Mar 2026 16:54:56 +0000 (09:54 -0700)] 
Merge branch 'lc/rebase-trailer'

"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 'bk/run-command-wo-the-repository'
Junio C Hamano [Thu, 19 Mar 2026 16:54:55 +0000 (09:54 -0700)] 
Merge branch 'bk/run-command-wo-the-repository'

The run_command() API lost its implicit dependencyon 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'
Junio C Hamano [Thu, 19 Mar 2026 16:54:55 +0000 (09:54 -0700)] 
Merge branch 'ps/editorconfig-unanchor'

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

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

2 months agoMerge branch 'ss/t3200-test-zero-oid'
Junio C Hamano [Thu, 19 Mar 2026 16:54:55 +0000 (09:54 -0700)] 
Merge branch 'ss/t3200-test-zero-oid'

A test now uses the 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'
Junio C Hamano [Thu, 19 Mar 2026 16:54:55 +0000 (09:54 -0700)] 
Merge branch 'dd/list-objects-filter-options-wo-strbuf-split'

The way combined list-object filter options are parsed has been
revamped.

* 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'
Junio C Hamano [Thu, 19 Mar 2026 16:54:54 +0000 (09:54 -0700)] 
Merge branch 'ps/t9200-test-path-is-helpers'

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 agorerere: update to modern representation of empty strbufs
Junio C Hamano [Thu, 19 Mar 2026 07:15:59 +0000 (00:15 -0700)] 
rerere: update to modern representation of empty strbufs

Back when b4833a2c (rerere: Fix use of an empty strbuf.buf,
2007-09-26) was written, a freshly initialized empty strbuf
had NULL in its .buf member, with .len set to 0.  The code this
patch touches in rerere.c was written to _fix_ the original code
that assumed that the .buf member is always pointing at a NUL-terminated
string, even for an empty string, which did not hold back then.

That changed in b315c5c0 (strbuf change: be sure ->buf is never ever
NULL., 2007-09-27), and it has again become safe to assume that .buf
is never NULL, and .buf[0] has '\0' for an empty string (i.e., a
strbuf with its .len member set to 0).

A funny thing is, this piece of code has been moved around from
builtin-rerere.c to rerere.c and also adjusted for updates to the
hash function API over the years, but nobody bothered to question
if this special casing for an empty strbuf was still necessary:

    b4833a2c62 (rerere: Fix use of an empty strbuf.buf, 2007-09-26)
    5b2fd95606 (rerere: Separate libgit and builtin functions, 2008-07-09)
    9126f0091f (fix openssl headers conflicting with custom SHA1 implementations, 2008-10-01)
    c0f16f8e14 (rerere: factor out handle_conflict function, 2018-08-05)
    0d7c419a94 (rerere: convert to use the_hash_algo, 2018-10-15)
    0578f1e66a (global: adapt callers to use generic hash context helpers, 2025-01-31)

Finally get rid of the special casing that was unnecessary for the
last 19 years.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agomeson: precompile "git-compat-util.h"
Patrick Steinhardt [Thu, 19 Mar 2026 05:33:27 +0000 (06:33 +0100)] 
meson: precompile "git-compat-util.h"

Every compilation unit in Git is expected to include "git-compat-util.h"
first, either directly or indirectly via "builtin.h". This header papers
over differences between platforms so that we can expect the typical
POSIX functions to exist. Furthermore, it provides functionality that we
end up using everywhere.

This header is thus quite heavy as a consequence. Preprocessing it as a
standalone unit via `clang -E git-compat-util.h` yields over 23,000
lines of code overall. Naturally, it takes quite some time to compile
all of this.

Luckily, this is exactly the kind of use case that precompiled headers
aim to solve: instead of recompiling it every single time, we compile it
once and then link the result into the executable. If include guards are
set up properly it means that the file won't need to be reprocessed.

Set up such a precompiled header for "git-compat-util.h" and wire it up
via Meson. This causes Meson to implicitly include the precompiled
header in all compilation units. With GCC and Clang for example this is
done via the "-include" statement [1].

This leads to a significant speedup when performing full builds:

  Benchmark 1: ninja (rev = HEAD~)
  Time (mean ± σ):     14.467 s ±  0.126 s    [User: 248.133 s, System: 31.298 s]
  Range (min … max):   14.195 s … 14.633 s    10 runs

  Benchmark 2: ninja (rev = HEAD)
    Time (mean ± σ):     10.307 s ±  0.111 s    [User: 173.290 s, System: 23.998 s]
    Range (min … max):   10.030 s … 10.433 s    10 runs

  Summary
    ninja (rev = HEAD) ran
      1.40 ± 0.02 times faster than ninja (rev = HEAD~)

[1]: https://gcc.gnu.org/onlinedocs/gcc/Precompiled-Headers.html

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agomeson: compile compatibility sources separately
Patrick Steinhardt [Thu, 19 Mar 2026 05:33:26 +0000 (06:33 +0100)] 
meson: compile compatibility sources separately

In the next commit we're about to introduce a precompiled header for
"git-compat-util.h". The consequence of this change is that we'll
implicitly include that header for every compilation unit that uses the
precompiled headers.

This is okay for our "normal" library sources and our builtins. But some
of our compatibility sources do not include the header on purpose, and
doing so would cause compilation errors.

Prepare for this change by splitting out compatibility sources into
their static library. Like this, we can selectively enable precompiled
headers for the library sources.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agogit-compat-util.h: move warning infra to prepare for PCHs
Patrick Steinhardt [Thu, 19 Mar 2026 05:33:25 +0000 (06:33 +0100)] 
git-compat-util.h: move warning infra to prepare for PCHs

The "git-compat-util.h" header is supposed to be the first header
included by every code compilation unit. As such, a subsequent commit
will start to precompile this header to speed up compilation of Git.

This will cause an issue though with the way that we have set up the
"-Wsign-compare" warnings. It is expected that any compilation unit that
fails with that compiler warning sets `DISABLE_SIGN_COMPARE_WARNINGS`
before including "git-compat-util.h". If so, we'll disable the warning
right away via a compiler pragma.

But with precompiled headers we do not know ahead of time whether the
code unit wants to disable those warnings, and thus we'll have to
precompile the header without defining `DISABLE_SIGN_COMPARE_WARNINGS`.
But as the pragma statement is wrapped by our include guards, the second
include of that file will not have the desired effect of disabling the
warnings anymore.

We could fix this issue by declaring a new macro that compilation units
are expected to invoke after having included the file. In retrospect,
that would have been the better way to handle this as it allows for
more flexibility: we could for example toggle the warning for specific
code blocks, only. But changing this now would require a bunch of
changes, and the churn feels excessive for what we gain.

Instead, prepare for the precompiled headers by moving the code outside
of the include guards.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agobuilds: move build scripts into "tools/"
Patrick Steinhardt [Thu, 19 Mar 2026 05:33:24 +0000 (06:33 +0100)] 
builds: move build scripts into "tools/"

We have a bunch of scripts used by our different build systems that are
all located in the top-level directory. Now that we have introduced the
new "tools/" directory though we have a better home for them.

Move the scripts into the "tools/" directory.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agocontrib: move "update-unicode.sh" script into "tools/"
Patrick Steinhardt [Thu, 19 Mar 2026 05:33:23 +0000 (06:33 +0100)] 
contrib: move "update-unicode.sh" script into "tools/"

The "update-unicode.sh" script is used to update the unicode data
compiled into Git whenever a new version of the Unicode standard has
been released. As such, it is a natural part of our developer-facing
tooling, and its presence in "contrib/" is misleading.

Promote the script into the new "tools/" directory.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agocontrib: move "coverage-diff.sh" script into "tools/"
Patrick Steinhardt [Thu, 19 Mar 2026 05:33:22 +0000 (06:33 +0100)] 
contrib: move "coverage-diff.sh" script into "tools/"

The "coverage-diff.sh" script can be used to get information about test
coverage fro the Git codebase. It is thus rather specific to our build
and test infrastructure and part of the developer-facing tooling. The
fact that this script is part of "contrib/" is thus rather misleading
and a historic wart.

Promote the tool into the new "tools/" directory.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agocontrib: move "coccinelle/" directory into "tools/"
Patrick Steinhardt [Thu, 19 Mar 2026 05:33:21 +0000 (06:33 +0100)] 
contrib: move "coccinelle/" directory into "tools/"

The Coccinelle tool is an ingrained part of our build infrastructure. It
is executed by our CI to detect antipatterns and is used to detect
misuses of certain interfaces. It's presence in "contrib/" is thus
rather misleading.

Promote the configuration into the new "tools/" directory.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agoIntroduce new "tools/" directory
Patrick Steinhardt [Thu, 19 Mar 2026 05:33:20 +0000 (06:33 +0100)] 
Introduce new "tools/" directory

According to its readme, the "contrib/" directory's main intent is to
collect stuff that is not an official part of Git, either because it is
too specialized or because it is still considered experimental. The
reality tells a bit of a different story though: while it _does_ contain
such things, it also contains other things:

  - Our credential helpers, which are being distributed by many
    packagers nowadays and which can be considered "stable".

  - A bunch of tooling that relates to our build and test
    infrastructure.

Especially the second category is somewhat of a sore spot. You really
wouldn't expect build-related tooling to be considered an optional part
of Git. Quite the opposite.

Create a new top-level "tools/" directory to fix this discrepancy. This
directory will contain all kind of tools that are related to our build
infrastructure and that Git developers are likely to use day to day.

For now, this directory doesn't contain anything yet except for a
readme and a Meson skeleton. This will change in subsequent commits.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agodoc: add missing space on git-config page
Gabriel “gabldotink” [Wed, 18 Mar 2026 21:00:19 +0000 (15:00 -0600)] 
doc: add missing space on git-config page

Signed-off-by: Gabriel “gabldotink” <gabl@gabl.ink>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agomerge-file: fix BUG when --object-id is used in a worktree
Mathias Rav [Wed, 11 Mar 2026 06:44:06 +0000 (06:44 +0000)] 
merge-file: fix BUG when --object-id is used in a worktree

The `--object-id` option was added in commit e1068f0ad4
(merge-file: add an option to process object IDs, 2023-11-01)
together with a call to setup_git_directory() to avoid crashing
when run outside a repository.

However, the call to setup_git_directory() is redundant when run inside
a repository, as merge-file runs with RUN_SETUP_GENTLY, so the
repository has already been set up. The redundant call is harmless
when linked worktrees are not used, but in a linked worktree,
the repo_set_gitdir() function ends up being called twice.

Calling repo_set_gitdir() used to be silently accepted, but commit
2816b748e5 (odb: handle changing a repository's commondir, 2025-11-19)
changed this to a BUG in repository.c with the error message:
"cannot reinitialize an already-initialized object directory".

Guard the redundant call to setup_git_directory() behind a repo pointer
check, to ensure that we continue to give the correct "not a git repo"
error whilst avoiding the BUG when running in a linked worktree.

Signed-off-by: Mathias Rav <m@git.strova.dk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agoMerge branch 'dd/cocci-do-not-pass-strbuf-by-value' into next
Junio C Hamano [Wed, 18 Mar 2026 19:23:44 +0000 (12:23 -0700)] 
Merge branch 'dd/cocci-do-not-pass-strbuf-by-value' into next

Add a coccinelle rule to break the build when "struct strbuf" gets
passed by value.

* dd/cocci-do-not-pass-strbuf-by-value:
  stash: do not pass strbuf by value
  coccinelle: detect struct strbuf passed by value

2 months agoMerge branch 'ty/doc-diff-u-wo-number' into next
Junio C Hamano [Wed, 18 Mar 2026 19:23:44 +0000 (12:23 -0700)] 
Merge branch 'ty/doc-diff-u-wo-number' into next

"git diff -U<num>" was too lenient in its command line parsing and
took an empty string as a valid <num>.

* ty/doc-diff-u-wo-number:
  diff: document -U without <n> as using default context

2 months agoMerge branch 'ps/upload-pack-buffer-more-writes' into next
Junio C Hamano [Wed, 18 Mar 2026 19:23:43 +0000 (12:23 -0700)] 
Merge branch 'ps/upload-pack-buffer-more-writes' into next

Reduce system overhead "git upload-pack" spends on relaying "git
pack-objects" output to the "git fetch" running on the other end of
the connection.

* ps/upload-pack-buffer-more-writes:
  builtin/pack-objects: reduce lock contention when writing packfile data
  csum-file: drop `hashfd_throughput()`
  csum-file: introduce `hashfd_ext()`
  sideband: use writev(3p) to send pktlines
  wrapper: introduce writev(3p) wrappers
  compat/posix: introduce writev(3p) wrapper
  upload-pack: reduce lock contention when writing packfile data
  upload-pack: prefer flushing data over sending keepalive
  upload-pack: adapt keepalives based on buffering
  upload-pack: fix debug statement when flushing packfile data

2 months agoMerge branch 'tb/incremental-midx-part-3.2' into next
Junio C Hamano [Wed, 18 Mar 2026 19:23:43 +0000 (12:23 -0700)] 
Merge branch 'tb/incremental-midx-part-3.2' into next

Further work on incremental repacking using MIDX/bitmap

* tb/incremental-midx-part-3.2:
  midx: enable reachability bitmaps during MIDX compaction
  midx: implement MIDX compaction
  t/helper/test-read-midx.c: plug memory leak when selecting layer
  midx-write.c: factor fanout layering from `compute_sorted_entries()`
  midx-write.c: enumerate `pack_int_id` values directly
  midx-write.c: extract `fill_pack_from_midx()`
  midx-write.c: introduce `midx_pack_perm()` helper
  midx: do not require packs to be sorted in lexicographic order
  midx-write.c: introduce `struct write_midx_opts`
  midx-write.c: don't use `pack_perm` when assigning `bitmap_pos`
  t/t5319-multi-pack-index.sh: fix copy-and-paste error in t5319.39
  git-multi-pack-index(1): align SYNOPSIS with 'git multi-pack-index -h'
  git-multi-pack-index(1): remove non-existent incompatibility
  builtin/multi-pack-index.c: make '--progress' a common option
  midx: introduce `midx_get_checksum_hex()`
  midx: rename `get_midx_checksum()` to `midx_get_checksum_hash()`
  midx: mark `get_midx_checksum()` arguments as const

2 months agoMerge branch 'yc/histogram-hunk-shift-fix' into next
Junio C Hamano [Wed, 18 Mar 2026 19:23:43 +0000 (12:23 -0700)] 
Merge branch 'yc/histogram-hunk-shift-fix' into next

The final clean-up phase of the diff output could turn the result of
histogram diff algorithm suboptimal, which has been corrected.

* yc/histogram-hunk-shift-fix:
  xdiff: re-diff shifted change groups when using histogram algorithm

2 months agouse commit_stack instead of prio_queue in LIFO mode
René Scharfe [Tue, 17 Mar 2026 21:40:07 +0000 (22:40 +0100)] 
use commit_stack instead of prio_queue in LIFO mode

A prio_queue with a NULL compare function acts as a stack -- the last
element in is the first one out (LIFO).  Use an actual commit_stack
instead where possible, as it documents the behavior better, provides
type safety and saves some memory because prio_queue stores an
additional tie-breaking counter per element.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agoMerge branch 'mf/t0008-cleanup' into next
Junio C Hamano [Tue, 17 Mar 2026 18:32:44 +0000 (11:32 -0700)] 
Merge branch 'mf/t0008-cleanup' into next

Test clean-up.

* mf/t0008-cleanup:
  t0008: improve test cleanup to fix failing test

2 months agoMerge branch 'pb/t4200-test-path-is-helpers' into next
Junio C Hamano [Tue, 17 Mar 2026 18:32:44 +0000 (11:32 -0700)] 
Merge branch 'pb/t4200-test-path-is-helpers' into next

Test clean-up.

* pb/t4200-test-path-is-helpers:
  t4200: convert test -[df] checks to test_path_* helpers

2 months agoMerge branch 'jk/transport-color-leakfix' into next
Junio C Hamano [Tue, 17 Mar 2026 18:32:44 +0000 (11:32 -0700)] 
Merge branch 'jk/transport-color-leakfix' into next

Leakfix.

* jk/transport-color-leakfix:
  transport: plug leaks in transport_color_config()

2 months agoMerge branch 'rj/pack-refs-tests-path-is-helpers' into next
Junio C Hamano [Tue, 17 Mar 2026 18:32:43 +0000 (11:32 -0700)] 
Merge branch 'rj/pack-refs-tests-path-is-helpers' into next

Test updates.

* rj/pack-refs-tests-path-is-helpers:
  t/pack-refs-tests: use test_path_is_missing

2 months agoMerge branch 'ps/clar-wo-path-max' into next
Junio C Hamano [Tue, 17 Mar 2026 18:32:43 +0000 (11:32 -0700)] 
Merge branch 'ps/clar-wo-path-max' into next

Clar (unit testing framework) update from the upstream.

* ps/clar-wo-path-max:
  clar: update to fix compilation on platforms without PATH_MAX

2 months agoMerge branch 'gj/user-manual-fix-grep-example' into next
Junio C Hamano [Tue, 17 Mar 2026 18:32:43 +0000 (11:32 -0700)] 
Merge branch 'gj/user-manual-fix-grep-example' into next

Fix an example in the user-manual.

* gj/user-manual-fix-grep-example:
  doc: fix git grep args order in Quick Reference

2 months agoMerge branch 'ps/history-split' into next
Junio C Hamano [Tue, 17 Mar 2026 18:32:42 +0000 (11:32 -0700)] 
Merge branch 'ps/history-split' into next

"git history" learned the "split" subcommand.

* ps/history-split:
  builtin/history: implement "split" subcommand
  builtin/history: split out extended function to create commits
  cache-tree: allow writing in-memory index as tree
  add-patch: allow disabling editing of hunks
  add-patch: add support for in-memory index patching
  add-patch: remove dependency on "add-interactive" subsystem
  add-patch: split out `struct interactive_options`
  add-patch: split out header from "add-interactive.h"

2 months agoMerge branch 'ss/t0410-delete-object-cleanup' into next
Junio C Hamano [Tue, 17 Mar 2026 18:32:42 +0000 (11:32 -0700)] 
Merge branch 'ss/t0410-delete-object-cleanup' into next

Test clean-up.

* ss/t0410-delete-object-cleanup:
  t0410: modernize delete_object helper

2 months agoMerge branch 'jt/fast-import-sign-again' into next
Junio C Hamano [Tue, 17 Mar 2026 18:32:42 +0000 (11:32 -0700)] 
Merge branch 'jt/fast-import-sign-again' into next

"git fast-import" learned to optionally replace signature on
commits whose signatures get invalidated due to replaying by
signing afresh.

* jt/fast-import-sign-again:
  fast-import: add mode to sign commits with invalid signatures
  gpg-interface: allow sign_buffer() to use default signing key
  commit: remove unused forward declaration

2 months agoMerge branch 'ps/object-counting' into next
Junio C Hamano [Tue, 17 Mar 2026 18:32:40 +0000 (11:32 -0700)] 
Merge branch 'ps/object-counting' into next

The logic to count objects has been cleaned up.

* ps/object-counting:
  odb: introduce generic object counting
  odb/source: introduce generic object counting
  object-file: generalize counting objects
  object-file: extract logic to approximate object count
  packfile: extract logic to count number of objects
  odb: stop including "odb/source.h"

2 months agoapply: report input location in binary and garbage patch errors
Jialong Wang [Tue, 17 Mar 2026 16:23:21 +0000 (12:23 -0400)] 
apply: report input location in binary and garbage patch errors

Several binary parsing paths in apply.c still report only line
numbers. When more than one patch input is fed to a single
invocation, that does not tell the user which input the line belongs
to.

Report the patch input location for corrupt and unrecognized binary
patches, as well as the "patch with only garbage" case, and update
the related tests.

Signed-off-by: Jialong Wang <jerrywang183@yahoo.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agoapply: report input location in header parsing errors
Jialong Wang [Tue, 17 Mar 2026 16:23:20 +0000 (12:23 -0400)] 
apply: report input location in header parsing errors

Several header parsing errors in apply.c still report only line
numbers. When applying more than one input, that does not tell the
user which input the line belongs to.

Report the patch input location for these header parsing errors, and
update the related tests.

While touching parse_git_diff_header(), update the helper state to use
the current header line when reporting these errors.

Signed-off-by: Jialong Wang <jerrywang183@yahoo.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agoapply: report the location of corrupt patches
Jialong Wang [Tue, 17 Mar 2026 16:23:19 +0000 (12:23 -0400)] 
apply: report the location of corrupt patches

When parsing a corrupt patch, git apply reports only the line number.
That does not tell the user which input the line number refers to.

Include the patch input path in the error message so the reported
location is easier to use.

Reset the line number for each patch input so the reported location stays
correct when multiple input files are provided.

Add tests for file input, standard input, multiple patch inputs, and
existing binary-diff corrupt patch cases.

Signed-off-by: Jialong Wang <jerrywang183@yahoo.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agorefs: add 'preparing' phase to the reference-transaction hook
Eric Ju [Tue, 17 Mar 2026 02:36:24 +0000 (22:36 -0400)] 
refs: add 'preparing' phase to the reference-transaction hook

The "reference-transaction" hook is invoked multiple times during a ref
transaction. Each invocation corresponds to a different phase:

- The "prepared" phase indicates that references have been locked.
- The "committed" phase indicates that all updates have been written to disk.
- The "aborted" phase indicates that the transaction has been aborted and that
  all changes have been rolled back.

This hook can be used to learn about the updates that Git wants to perform.
For example, forges use it to coordinate reference updates across multiple
nodes.

However, the phases are insufficient for some specific use cases. The earliest
observable phase in the "reference-transaction" hook is "prepared", at which
point Git has already taken exclusive locks on every affected reference. This
makes it suitable for last-chance validation, but not for serialization. So by
the time a hook sees the "prepared" phase, it has no way to defer locking, and
thus it cannot rearrange multiple concurrent ref transactions relative to one
another.

Introduce a new "preparing" phase that runs before the "prepared" phase, that
is before Git acquires any reference lock on disk. This gives callers a
well-defined window to perform validation, enable higher-level ordering of
concurrent transactions, or reject the transaction entirely, all without
interfering with the locking state.

This change is strictly speaking not backwards compatible. Existing hook
scripts that do not know how to handle unknown phases may treat 'preparing'
as an error and return non-zero. But the hook is considered to expose
internal implementation details of how Git works, and as such we have
been a bit more lenient with changing its exact semantics, like for example
in a8ae923f85 (refs: support symrefs in 'reference-transaction' hook, 2024-05-07).

An alternative would be to introduce a "reference-transaction-v2" hook that
knows about the new phase. This feels like a rather heavy-weight option though,
and was thus discarded.

Helped-by: Patrick Steinhardt <ps@pks.im>
Helped-by: Justin Tobler <jltobler@gmail.com>
Helped-by: Karthik Nayak <karthik.188@gmail.com>
Signed-off-by: Eric Ju <eric.peijian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agointerpret-trailers: use placeholder instead of *
Kristoffer Haugsbakk [Mon, 16 Mar 2026 21:48:27 +0000 (22:48 +0100)] 
interpret-trailers: use placeholder instead of *

Use `<key-alias>` instead of `*` in order to be consistent with
the documentation.

Signed-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agodoc: config: convert trailers section to synopsis style
Kristoffer Haugsbakk [Mon, 16 Mar 2026 21:48:26 +0000 (22:48 +0100)] 
doc: config: convert trailers section to synopsis style

Convert this part of the configuration documentation to synopsis style
so that all of git-interpret-trailers(1) is consistent.

See the commit message from two commits ago.

Signed-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agodoc: interpret-trailers: normalize and fill out options
Kristoffer Haugsbakk [Mon, 16 Mar 2026 21:48:25 +0000 (22:48 +0100)] 
doc: interpret-trailers: normalize and fill out options

Some negated options are missing according to
`git interpret-trailers -h`.

Also normalize to the “stuck form” (see gitcli(7)) like what was done
in 806337c7 (doc: notes: use stuck form throughout, 2025-05-27).[1]

Also normalize the order of the regular and negated options according to
the current convention.[2]

Also note that `--no-trailer` will reset the list.

† 1: See also https://lore.kernel.org/git/6f7d027e-088a-4d66-92af-b8d1c32d730c@app.fastmail.com/
† 2: https://lore.kernel.org/git/xmqqcyct1mtq.fsf@gitster.g/

Signed-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agodoc: interpret-trailers: convert to synopsis style
Kristoffer Haugsbakk [Mon, 16 Mar 2026 21:48:24 +0000 (22:48 +0100)] 
doc: interpret-trailers: convert to synopsis style

See e.g. 0ae23ab5 (doc: convert git worktree to synopsis style,
2025-10-05) for the markup rules for this style.

There aren’t many subtleties to the transformation of this doc since it
doesn’t use any advanced constructs. The only thing is that "`:`{nbsp}" is
used instead of `': '` to refer to effective inline-verbatim with
a space (␠).[1] I also use (_) for emphasis although (') gives the
same result.

Also prefer linking to Git commands instead of saying e.g. `git
format-patch`. But for this command we can type out git-interpret-
trailers(1) to avoid a self-reference.

Also replace camel case `<keyAlias>` with kebab case `<key-alias>`.
And while doing that make sure to replace `trailer.*` with
`trailer.<key-alias>`.

† 1: Similar to "`tag:`{nbsp}" in `Documentation/pretty-formats.adoc`

Signed-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agotransport: plug leaks in transport_color_config()
Jeff King [Sat, 14 Mar 2026 16:08:14 +0000 (12:08 -0400)] 
transport: plug leaks in transport_color_config()

We retrieve config values with repo_config_get_string(), which will
allocate a new copy of the string for us. But we don't hold on to those
strings, since they are just fed to git_config_colorbool() and
color_parse(). But nor do we free them, which means they leak.

We can fix this by using the "_tmp" form of repo_config_get_string(),
which just hands us a pointer directly to the internal storage. This is
OK for our purposes, since we don't need it to last for longer than our
parsing calls.

Two interesting side notes here:

  1. Many types already have a repo_config_get_X() variant that handles
     this for us (e.g., repo_config_get_bool()). But neither colorbools
     nor colors themselves have such helpers. We might think about
     adding them, but converting all callers is a larger task, and out
     of scope for this fix.

  2. As far as I can tell, this leak has been there since 960786e761
     (push: colorize errors, 2018-04-21), but wasn't detected by LSan in
     our test suite. It started triggering when we applied dd3693eb08
     (transport-helper, connect: use clean_on_exit to reap children on
     abnormal exit, 2026-03-12) which is mostly unrelated.

     Even weirder, it seems to trigger only with clang (and not gcc),
     and only with GIT_TEST_DEFAULT_REF_FORMAT=reftable. So I think this
     is another odd case where the pointers happened to be hanging
     around in stack memory, but changing the pattern of function calls
     in nearby code was enough for them to be incidentally overwritten.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agot4200: convert test -[df] checks to test_path_* helpers
PRASHANT S BISHT [Mon, 16 Mar 2026 17:24:57 +0000 (22:54 +0530)] 
t4200: convert test -[df] checks to test_path_* helpers

Replace old-style path existence checks in t4200-rerere.sh with
the appropriate test_path_* helper functions. These helpers provide
clearer diagnostic messages on failure than the raw shell test
builtin.

Signed-off-by: Prashant S Bisht <prashantjee2025@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agoapply.c: fix -p argument parsing
Mirko Faina [Mon, 16 Mar 2026 00:51:16 +0000 (01:51 +0100)] 
apply.c: fix -p argument parsing

"git apply" has an option -p that takes an integer as its argument.
Unfortunately the function apply_option_parse_p() in charge of parsing
this argument uses atoi() to convert from string to integer, which
allows a non-digit after the number (e.g. "1q") to be silently ignored.
As a consequence, an argument that does not begin with a digit silently
becomes a zero. Despite this command working fine when a non-positive
argument is passed, it might be useful for the end user to know that
their input contains non-digits that might've been unintended.

Replace atoi() with strtol_i() to catch malformed inputs.

Signed-off-by: Mirko Faina <mroik@delayed.space>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agot0008: improve test cleanup to fix failing test
Mirko Faina [Mon, 16 Mar 2026 01:15:42 +0000 (02:15 +0100)] 
t0008: improve test cleanup to fix failing test

The "large exclude file ignored in tree" test fails. This is due to an
additional warning message that is generated in the test. "warning:
unable to access 'subdir/.gitignore': Too many levels of symbolic
links", the extra warning that is not supposed to be there, happens
because of some leftover files left by previous tests.

To fix this we improve cleanup on "symlinks not respected in-tree", and
because the tests in t0008 in general have poor cleanup, at the start of
"large exclude file ignored in tree" we search for any leftover
.gitignore and remove them before starting the test.

Improve post-test cleanup and add pre-test cleanup to make sure that we
have a workable environment for the test.

Signed-off-by: Mirko Faina <mroik@delayed.space>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agoSync with 'master'
Junio C Hamano [Mon, 16 Mar 2026 17:51:25 +0000 (10:51 -0700)] 
Sync with 'master'

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 agoThe 17th batch
Junio C Hamano [Mon, 16 Mar 2026 17:48:02 +0000 (10:48 -0700)] 
The 17th batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agoMerge branch 'ty/patch-ids-document-lazy-eval'
Junio C Hamano [Mon, 16 Mar 2026 17:48:15 +0000 (10:48 -0700)] 
Merge branch 'ty/patch-ids-document-lazy-eval'

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'
Junio C Hamano [Mon, 16 Mar 2026 17:48:15 +0000 (10:48 -0700)] 
Merge branch 'rs/history-ergonomics-updates-fix'

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'
Junio C Hamano [Mon, 16 Mar 2026 17:48:15 +0000 (10:48 -0700)] 
Merge branch 'jk/unleak-mmap'

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'
Junio C Hamano [Mon, 16 Mar 2026 17:48:14 +0000 (10:48 -0700)] 
Merge branch 'ty/setup-error-tightening'

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 agoMerge branch 'os/doc-git-custom-commands'
Junio C Hamano [Mon, 16 Mar 2026 17:48:14 +0000 (10:48 -0700)] 
Merge branch 'os/doc-git-custom-commands'

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'
Junio C Hamano [Mon, 16 Mar 2026 17:48:14 +0000 (10:48 -0700)] 
Merge branch 'fp/t3310-unhide-git-failures'

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 'jt/repo-structure-extrema'
Junio C Hamano [Mon, 16 Mar 2026 17:48:14 +0000 (10:48 -0700)] 
Merge branch 'jt/repo-structure-extrema'

"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'
Junio C Hamano [Mon, 16 Mar 2026 17:48:13 +0000 (10:48 -0700)] 
Merge branch 'sp/wt-status-wo-the-repository'

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 agodoc: fix git grep args order in Quick Reference
Guillaume Jacob [Mon, 16 Mar 2026 14:15:36 +0000 (14:15 +0000)] 
doc: fix git grep args order in Quick Reference

The example provided has its arguments in the wrong order. The revision
should follow the pattern, and not the other way around.

Signed-off-by: Guillaume Jacob <guillaume@absolut-sensing.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agoclar: update to fix compilation on platforms without PATH_MAX
Patrick Steinhardt [Mon, 16 Mar 2026 07:50:43 +0000 (08:50 +0100)] 
clar: update to fix compilation on platforms without PATH_MAX

Update clar to e4172e3 (Merge pull request #134 from
clar-test/ethomson/const, 2026-01-10). Besides some changes to
"generate.py" which don't have any impact on us, this commit also fixes
compilation on platforms that don't have PATH_MAX, like for example
GNU/Hurd.

Reported-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agostash: do not pass strbuf by value
Deveshi Dwivedi [Sun, 15 Mar 2026 09:44:44 +0000 (09:44 +0000)] 
stash: do not pass strbuf by value

save_untracked_files() takes its 'files' parameter as struct strbuf
by value.  Passing a strbuf by value copies the struct but shares
the underlying buffer between caller and callee, risking a dangling
pointer and double-free if the callee reallocates.

The function needs both the buffer and its length for
pipe_command(), so a plain const char * is not sufficient here.
Switch the parameter to struct strbuf * and update the caller to
pass a pointer.

Signed-off-by: Deveshi Dwivedi <deveshigurgaon@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agococcinelle: detect struct strbuf passed by value
Deveshi Dwivedi [Sun, 15 Mar 2026 09:44:43 +0000 (09:44 +0000)] 
coccinelle: detect struct strbuf passed by value

Passing a struct strbuf by value to a function copies the struct
but shares the underlying character array between caller and callee.
If the callee causes a reallocation, the caller's copy becomes a
dangling pointer, leading to a double-free when strbuf_release() is
called.  There is no coccinelle rule to catch this pattern.

Jeff King suggested adding one during review of the
write_worktree_linking_files() fix [1], and noted that a reporting
rule using coccinelle's Python scripting extensions could emit a
descriptive warning, but we do not currently require Python support
in coccinelle.

Add a transformation rule that rewrites a by-value strbuf parameter
to a pointer.  The detection is identical to what a Python-based
reporting rule would catch; only the presentation differs.  The
resulting diff will not produce compilable code on its own (callers
and the function body still need updating), but the spatch output
alerts the developer that the signature needs attention.  This is
consistent with the other rules in strbuf.cocci, which also rewrite
to the preferred form.

[1] https://lore.kernel.org/git/20260309192600.GC309867@coredump.intra.peff.net/

Signed-off-by: Deveshi Dwivedi <deveshigurgaon@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agoMerge branch 'dd/list-objects-filter-options-wo-strbuf-split' into dd/cocci-do-not...
Junio C Hamano [Sun, 15 Mar 2026 21:46:30 +0000 (14:46 -0700)] 
Merge branch 'dd/list-objects-filter-options-wo-strbuf-split' into dd/cocci-do-not-pass-strbuf-by-value

* 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 agot/pack-refs-tests: use test_path_is_missing
Ritesh Singh Jadoun [Sun, 15 Mar 2026 08:10:32 +0000 (13:40 +0530)] 
t/pack-refs-tests: use test_path_is_missing

The pack-refs tests previously used raw 'test -f' and 'test -e' checks
with negation. Update them to use Git's standard helper function
test_path_is_missing for consistency and clearer failure reporting.

As suggested in review, replaced the negated 'test_path_exists' with
test_path_is_missing to better reflect the expected absence of paths.

Signed-off-by: Ritesh Singh Jadoun <riteshjd75@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
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