]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
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 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 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

2 months agoMerge branch 'ss/t9123-setup-inside-test-expect-success' into next
Junio C Hamano [Fri, 6 Mar 2026 22:43:08 +0000 (14:43 -0800)] 
Merge branch 'ss/t9123-setup-inside-test-expect-success' into next

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' into next
Junio C Hamano [Fri, 6 Mar 2026 22:43:07 +0000 (14:43 -0800)] 
Merge branch 'sk/oidmap-clear-with-custom-free-func' into next

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 'ps/odb-sources' into next
Junio C Hamano [Fri, 6 Mar 2026 22:43:05 +0000 (14:43 -0800)] 
Merge branch 'ps/odb-sources' into next

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 'jt/doc-submitting-patches-study-before-sending' into next
Junio C Hamano [Fri, 6 Mar 2026 22:43:05 +0000 (14:43 -0800)] 
Merge branch 'jt/doc-submitting-patches-study-before-sending' into next

Doc update for our contributors.

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

2 months agoDocumentation: extend guidance for submitting patches
Justin Tobler [Thu, 5 Mar 2026 19:38:36 +0000 (13:38 -0600)] 
Documentation: extend guidance for submitting patches

Before submitting patches on the mailing list, it is often a good idea
to check for previous related discussions or if similar work is already
in progress. This enables better coordination amongst contributors and
could avoid duplicating work.

Additionally, it is often recommended to give reviewers some time to
reply to a patch series before sending new versions. This helps collect
broader feedback and reduces unnecessary churn from rapid rerolls.

Document this guidance in "Documentation/SubmittingPatches" accordingly.

Signed-off-by: Justin Tobler <jltobler@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agoMerge branch 'hn/status-compare-with-push' into next
Junio C Hamano [Fri, 6 Mar 2026 16:46:33 +0000 (08:46 -0800)] 
Merge branch 'hn/status-compare-with-push' into next

"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

2 months agoMerge branch 'ds/for-each-repo-w-worktree' into next
Junio C Hamano [Fri, 6 Mar 2026 16:46:33 +0000 (08:46 -0800)] 
Merge branch 'ds/for-each-repo-w-worktree' into next

"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

3 months agoodb/source: make `begin_transaction()` function pluggable
Patrick Steinhardt [Thu, 5 Mar 2026 14:19:57 +0000 (15:19 +0100)] 
odb/source: make `begin_transaction()` function pluggable

Introduce a new callback function in `struct odb_source` to make the
function pluggable.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoodb/source: make `write_alternate()` function pluggable
Patrick Steinhardt [Thu, 5 Mar 2026 14:19:56 +0000 (15:19 +0100)] 
odb/source: make `write_alternate()` function pluggable

Introduce a new callback function in `struct odb_source` to make the
function pluggable.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoodb/source: make `read_alternates()` function pluggable
Patrick Steinhardt [Thu, 5 Mar 2026 14:19:55 +0000 (15:19 +0100)] 
odb/source: make `read_alternates()` function pluggable

Introduce a new callback function in `struct odb_source` to make the
function pluggable.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoodb/source: make `write_object_stream()` function pluggable
Patrick Steinhardt [Thu, 5 Mar 2026 14:19:54 +0000 (15:19 +0100)] 
odb/source: make `write_object_stream()` function pluggable

Introduce a new callback function in `struct odb_source` to make the
function pluggable.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoodb/source: make `write_object()` function pluggable
Patrick Steinhardt [Thu, 5 Mar 2026 14:19:53 +0000 (15:19 +0100)] 
odb/source: make `write_object()` function pluggable

Introduce a new callback function in `struct odb_source` to make the
function pluggable.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoodb/source: make `freshen_object()` function pluggable
Patrick Steinhardt [Thu, 5 Mar 2026 14:19:52 +0000 (15:19 +0100)] 
odb/source: make `freshen_object()` function pluggable

Introduce a new callback function in `struct odb_source` to make the
function pluggable.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoodb/source: make `for_each_object()` function pluggable
Patrick Steinhardt [Thu, 5 Mar 2026 14:19:51 +0000 (15:19 +0100)] 
odb/source: make `for_each_object()` function pluggable

Introduce a new callback function in `struct odb_source` to make the
function pluggable.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoodb/source: make `read_object_stream()` function pluggable
Patrick Steinhardt [Thu, 5 Mar 2026 14:19:50 +0000 (15:19 +0100)] 
odb/source: make `read_object_stream()` function pluggable

Introduce a new callback function in `struct odb_source` to make the
function pluggable.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoodb/source: make `read_object_info()` function pluggable
Patrick Steinhardt [Thu, 5 Mar 2026 14:19:49 +0000 (15:19 +0100)] 
odb/source: make `read_object_info()` function pluggable

Introduce a new callback function in `struct odb_source` to make the
function pluggable.

Note that this function is a bit less straight-forward to convert
compared to the other functions. The reason here is that the logic to
read an object is:

  1. We try to read the object. If it exists we return it.

  2. If the object does not exist we reprepare the object database
     source.

  3. We then try reading the object info a second time in case the
     reprepare caused it to appear.

The second read is only supposed to happen for the packfile store
though, as reading loose objects is not impacted by repreparing the
object database.

Ideally, we'd just move this whole logic into the ODB source. But that's
not easily possible because we try to avoid the reprepare unless really
required, which is after we have found out that no other ODB source
contains the object, either. So the logic spans across multiple ODB
sources, and consequently we cannot move it into an individual source.

Instead, introduce a new flag `OBJECT_INFO_SECOND_READ` that tells the
backend that we already tried to look up the object once, and that this
time around the ODB source should try to find any new objects that may
have surfaced due to an on-disk change.

With this flag, the "files" backend can trivially skip trying to re-read
the object as a loose object. Furthermore, as we know that we only try
the second read via the packfile store, we can skip repreparing loose
objects and only reprepare the packfile store.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoodb/source: make `close()` function pluggable
Patrick Steinhardt [Thu, 5 Mar 2026 14:19:48 +0000 (15:19 +0100)] 
odb/source: make `close()` function pluggable

Introduce a new callback function in `struct odb_source` to make the
function pluggable.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoodb/source: make `reprepare()` function pluggable
Patrick Steinhardt [Thu, 5 Mar 2026 14:19:47 +0000 (15:19 +0100)] 
odb/source: make `reprepare()` function pluggable

Introduce a new callback function in `struct odb_source` to make the
function pluggable.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoodb/source: make `free()` function pluggable
Patrick Steinhardt [Thu, 5 Mar 2026 14:19:46 +0000 (15:19 +0100)] 
odb/source: make `free()` function pluggable

Introduce a new callback function in `struct odb_source` to make the
function pluggable.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoodb/source: introduce source type for robustness
Patrick Steinhardt [Thu, 5 Mar 2026 14:19:45 +0000 (15:19 +0100)] 
odb/source: introduce source type for robustness

When a caller holds a `struct odb_source`, they have no way of telling
what type the source is. This doesn't really cause any problems in the
current status quo as we only have a single type anyway, "files". But
going forward we expect to add more types, and if so it will become
necessary to tell the sources apart.

Introduce a new enum to cover this use case and assert that the given
source actually matches the target source when performing the downcast.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoodb: move reparenting logic into respective subsystems
Patrick Steinhardt [Thu, 5 Mar 2026 14:19:44 +0000 (15:19 +0100)] 
odb: move reparenting logic into respective subsystems

The primary object database source may be initialized with a relative
path. When the process changes its current working directory we thus
have to update this path and have it point to the same path, but
relative to the new working directory.

This logic is handled in the object database layer. It consists of three
steps:

  1. We undo any potential temporary object directory, which are used
     for transactions. This is done so that we don't end up modifying
     the temporary object database source that got applied for the
     transaction.

  2. We then iterate through the non-transactional sources and reparent
     their respective paths.

  3. We reapply the temporary object directory, but update its path.

All of this logic is heavily tied to how the object database source
handles paths in the first place. It's an internal implementation
detail, and as sources may not even use an on-disk path at all it is not
a mechanism that applies to all potential sources.

Refactor the code so that the logic to reparent the sources is hosted by
the "files" source and the temporary object directory subsystems,
respectively. This logic is easier to reason about, but it also ensures
that this logic is handled at the correct level.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoodb: embed base source in the "files" backend
Patrick Steinhardt [Thu, 5 Mar 2026 14:19:43 +0000 (15:19 +0100)] 
odb: embed base source in the "files" backend

The "files" backend is implemented as a pointer in the `struct
odb_source`. This contradicts our typical pattern for pluggable backends
like we use it for example in the ref store or for object database
streams, where we typically embed the generic base structure in the
specialized implementation. This pattern has a couple of small benefits:

  - We avoid an extra allocation.

  - We hide implementation details in the generic structure.

  - We can easily downcast from a generic backend to the specialized
    structure and vice versa because the offsets are known at compile
    time.

  - It becomes trivial to identify locations where we depend on backend
    specific logic because the cast needs to be explicit.

Refactor our "files" object database source to do the same and embed the
`struct odb_source` in the `struct odb_source_files`.

There are still a bunch of sites in our code base where we do have to
access internals of the "files" backend. The intent is that those will
go away over time, but this will certainly take a while. Meanwhile,
provide a `odb_source_files_downcast()` function that can convert a
generic source into a "files" source.

As we only have a single source the downcast succeeds unconditionally
for now. Eventually though the intent is to make the cast `BUG()` in
case the caller requests to downcast a non-"files" backend to a "files"
backend.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoodb: introduce "files" source
Patrick Steinhardt [Thu, 5 Mar 2026 14:19:42 +0000 (15:19 +0100)] 
odb: introduce "files" source

Introduce a new "files" object database source. This source encapsulates
access to both loose object files and the packfile store, similar to how
the "files" backend for refs encapsulates access to loose refs and the
packed-refs file.

Note that for now the "files" source is still a direct member of a
`struct odb_source`. This architecture will be reversed in the next
commit so that the files source contains a `struct odb_source`.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoodb: split `struct odb_source` into separate header
Patrick Steinhardt [Thu, 5 Mar 2026 14:19:41 +0000 (15:19 +0100)] 
odb: split `struct odb_source` into separate header

Subsequent commits will expand the `struct odb_source` to become a
generic interface for accessing an object database source. As part of
these refactorings we'll add a set of function pointers that will
significantly expand the structure overall.

Prepare for this by splitting out the `struct odb_source` into a
separate header. This keeps the high-level object database interface
detached from the low-level object database sources.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agot9123: use test_when_finished for cleanup
Siddharth Shrimali [Thu, 5 Mar 2026 12:54:08 +0000 (18:24 +0530)] 
t9123: use test_when_finished for cleanup

Move the setup logic into a 'test_expect_success' block.
This ensures that the code is properly tracked by the test harness.

Additionally, we use the 'test_when_finished' helper at the start of
the block to ensure that the 'import' directory is removed even if the
test fails.
This is cleaner than the previous manual 'rm -rf import' approach.

Signed-off-by: Siddharth Shrimali <r.siddharth.shrimali@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agosend-email: pass smtp hostname and port to Authen::SASL
Aditya Garg [Thu, 5 Mar 2026 17:01:15 +0000 (17:01 +0000)] 
send-email: pass smtp hostname and port to Authen::SASL

Starting from version 2.2000, Authen::SASL supports passing the SMTP
server hostname and port to the OAUTHBEARER string passed via SMTP AUTH.
Add support for the same in git-send-email.

It's safe to add the new parameters unconditionally as older versions of
Authen::SASL will simply ignore them without any error. Something
similar is already being done for the authname parameter, which is not
supported by every authentication mechanism. This can be understood as
declaring a variable but not using at all.

Link: https://metacpan.org/pod/Authen::SASL::Perl::OAUTHBEARER
Signed-off-by: Aditya Garg <gargaditya08@live.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agogitlab-ci: update to macOS 15 images
Patrick Steinhardt [Thu, 5 Mar 2026 11:20:23 +0000 (12:20 +0100)] 
gitlab-ci: update to macOS 15 images

The macos-14-xcode-15 images for GitLab's macOS runners have been
deprecated. Update to macOS 15, which is our current stable version.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agomeson: detect broken iconv that requires ICONV_RESTART_RESET
Patrick Steinhardt [Thu, 5 Mar 2026 11:20:22 +0000 (12:20 +0100)] 
meson: detect broken iconv that requires ICONV_RESTART_RESET

In d0cec08d70 (utf8.c: prepare workaround for iconv under macOS 14/15,
2026-01-12) we have introduced a new workaround for a broken version of
libiconv on macOS. This workaround has for now only been wired up for
our Makefile, so using Meson with such a broken version will fail.

We can rather easily detect the broken behaviour. Some encodings have
different modes that can be switched to via an escape sequence. In the
case of ISO-2022-JP this can be done via "<Esc>$B" and "<Esc>(J" to
switch between ASCII and JIS modes. The bug now triggers when one does
multiple calls to iconv(3p) to convert a string piece by piece, where
the first call enters JIS mode. The second call forgets about the fact
that it is still in JIS mode, and consequently it will incorrectly treat
the input as ASCII, and thus the produced output is of course garbage.

Wire up a test that exercises this in Meson and, if it fails, set the
`ICONV_RESTART_RESET` define.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agomeson: simplify iconv-emits-BOM check
Patrick Steinhardt [Thu, 5 Mar 2026 11:20:21 +0000 (12:20 +0100)] 
meson: simplify iconv-emits-BOM check

Simplify the iconv-emits-BOM check that we have in Meson a bit by:

  - Dropping useless variables.

  - Casting the `inpos` pointer to `void *` instead of using a typedef
    that depends on whether or not we use an old iconv library.

This overall condenses the code signficantly and makes it easier to
follow.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agobuiltin/rev-list: migrate missing_objects cleanup to oidmap_clear_with_free()
Seyi Kufoiji [Thu, 5 Mar 2026 10:05:26 +0000 (11:05 +0100)] 
builtin/rev-list: migrate missing_objects cleanup to oidmap_clear_with_free()

As part of the conversion away from oidmap_clear(), switch the
missing_objects map to use oidmap_clear_with_free().

missing_objects stores struct missing_objects_map_entry instances,
which own an xstrdup()'d path string in addition to the container
struct itself. Previously, rev-list manually freed entry->path
before calling oidmap_clear(&missing_objects, true).

Introduce a dedicated free callback and pass it to
oidmap_clear_with_free(), consolidating entry teardown into a
single place and making cleanup semantics explicit.

Signed-off-by: Seyi Kuforiji <kuforiji98@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agooidmap: make entry cleanup explicit in oidmap_clear
Seyi Kufoiji [Thu, 5 Mar 2026 10:05:25 +0000 (11:05 +0100)] 
oidmap: make entry cleanup explicit in oidmap_clear

Replace oidmap's use of hashmap_clear_() and layout-dependent freeing
with an explicit iteration and optional free callback. This removes
reliance on struct layout assumptions while keeping the existing API
intact.

Add tests for oidmap_clear_with_free behavior.
test_oidmap__clear_with_free_callback verifies that entries are freed
when a callback is provided, while
test_oidmap__clear_without_free_callback verifies that entries are not
freed when no callback is given. These tests ensure the new clear
implementation behaves correctly and preserves ownership semantics.

Signed-off-by: Seyi Kuforiji <kuforiji98@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoSync with 'master'
Junio C Hamano [Thu, 5 Mar 2026 18:06:14 +0000 (10:06 -0800)] 
Sync with 'master'

3 months agoMerge branch 'os/doc-custom-subcommand-on-path' into next
Junio C Hamano [Thu, 5 Mar 2026 18:06:07 +0000 (10:06 -0800)] 
Merge branch 'os/doc-custom-subcommand-on-path' into next

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

3 months agoMerge branch 'ss/t3700-modernize' into next
Junio C Hamano [Thu, 5 Mar 2026 18:06:06 +0000 (10:06 -0800)] 
Merge branch 'ss/t3700-modernize' into next

Test clean-up.

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

3 months agoThe 12th batch
Junio C Hamano [Thu, 5 Mar 2026 18:04:35 +0000 (10:04 -0800)] 
The 12th batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoMerge branch 'ps/fsck-stream-from-the-right-object-instance'
Junio C Hamano [Thu, 5 Mar 2026 18:04:49 +0000 (10:04 -0800)] 
Merge branch 'ps/fsck-stream-from-the-right-object-instance'

"fsck" iterates over packfiles and its access to pack data caused
the list to be permuted, which caused it to loop forever; the code
to access pack data by "fsck" has been updated to avoid this.

* ps/fsck-stream-from-the-right-object-instance:
  pack-check: fix verification of large objects
  packfile: expose function to read object stream for an offset
  object-file: adapt `stream_object_signature()` to take a stream
  t/helper: improve "genrandom" test helper

3 months agoMerge branch 'ob/core-attributesfile-in-repository'
Junio C Hamano [Thu, 5 Mar 2026 18:04:48 +0000 (10:04 -0800)] 
Merge branch 'ob/core-attributesfile-in-repository'

The core.attributesfile is intended to be set per repository, but
were kept track of by a single global variable in-core, which has
been corrected by moving it to per-repository data structure.

* ob/core-attributesfile-in-repository:
  environment: move "branch.autoSetupMerge" into `struct repo_config_values`
  environment: stop using core.sparseCheckout globally
  environment: stop storing `core.attributesFile` globally

3 months agoMerge branch 'pt/t7527-flake-workaround'
Junio C Hamano [Thu, 5 Mar 2026 18:04:48 +0000 (10:04 -0800)] 
Merge branch 'pt/t7527-flake-workaround'

Test fixup.

* pt/t7527-flake-workaround:
  t7527: fix flaky fsmonitor event tests with retry logic

3 months agoSync with 'master'
Junio C Hamano [Wed, 4 Mar 2026 18:53:57 +0000 (10:53 -0800)] 
Sync with 'master'

3 months agoMerge branch 'lp/doc-gitprotocol-pack-fixes' into next
Junio C Hamano [Wed, 4 Mar 2026 18:53:48 +0000 (10:53 -0800)] 
Merge branch 'lp/doc-gitprotocol-pack-fixes' into next

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

3 months agoMerge branch 'kj/path-micro-code-cleanup' into next
Junio C Hamano [Wed, 4 Mar 2026 18:53:47 +0000 (10:53 -0800)] 
Merge branch 'kj/path-micro-code-cleanup' into next

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

3 months agoMerge branch 'bc/sha1-256-interop-02' into next
Junio C Hamano [Wed, 4 Mar 2026 18:53:47 +0000 (10:53 -0800)] 
Merge branch 'bc/sha1-256-interop-02' into next

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

3 months agoThe 11th batch
Junio C Hamano [Wed, 4 Mar 2026 18:50:48 +0000 (10:50 -0800)] 
The 11th batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoMerge branch 'cx/fetch-display-ubfix'
Junio C Hamano [Wed, 4 Mar 2026 18:53:02 +0000 (10:53 -0800)] 
Merge branch 'cx/fetch-display-ubfix'

Undefined-behaviour fix in "git fetch".

* cx/fetch-display-ubfix:
  fetch: fix wrong evaluation order in URL trailing-slash trimming

3 months agoMerge branch 'ds/config-list-with-type'
Junio C Hamano [Wed, 4 Mar 2026 18:53:02 +0000 (10:53 -0800)] 
Merge branch 'ds/config-list-with-type'

"git config list" is taught to show the values interpreted for
specific type with "--type=<X>" option.

* ds/config-list-with-type:
  config: use an enum for type
  config: restructure format_config()
  config: format colors quietly
  color: add color_parse_quietly()
  config: format expiry dates quietly
  config: format paths gently
  config: format bools or strings in helper
  config: format bools or ints gently
  config: format bools gently
  config: format int64s gently
  config: make 'git config list --type=<X>' work
  config: add 'gently' parameter to format_config()
  config: move show_all_config()

3 months agoMerge branch 'en/merge-ort-almost-wo-the-repository'
Junio C Hamano [Wed, 4 Mar 2026 18:53:01 +0000 (10:53 -0800)] 
Merge branch 'en/merge-ort-almost-wo-the-repository'

Mark the marge-ort codebase to prevent more uses of the_repository
from getting added.

* en/merge-ort-almost-wo-the-repository:
  replay: prevent the_repository from coming back
  merge-ort: prevent the_repository from coming back
  merge-ort: replace the_hash_algo with opt->repo->hash_algo
  merge-ort: replace the_repository with opt->repo
  merge-ort: pass repository to write_tree()
  merge,diff: remove the_repository check before prefetching blobs

3 months agoMerge branch 'lo/repo-leftover-bits'
Junio C Hamano [Wed, 4 Mar 2026 18:53:01 +0000 (10:53 -0800)] 
Merge branch 'lo/repo-leftover-bits'

Clean-up the code around "git repo info" command.

* lo/repo-leftover-bits:
  Documentation/git-repo: capitalize format descriptions
  Documentation/git-repo: replace 'NUL' with '_NUL_'
  t1901: adjust nul format output instead of expected value
  t1900: rename t1900-repo to t1900-repo-info
  repo: rename struct field to repo_info_field
  repo: replace get_value_fn_for_key by get_repo_info_field
  repo: rename repo_info_fields to repo_info_field
  CodingGuidelines: instruct to name arrays in singular

3 months agoMerge branch 'ps/maintenance-geometric-default'
Junio C Hamano [Wed, 4 Mar 2026 18:53:01 +0000 (10:53 -0800)] 
Merge branch 'ps/maintenance-geometric-default'

"git maintenance" starts using the "geometric" strategy by default.

* ps/maintenance-geometric-default:
  builtin/maintenance: use "geometric" strategy by default
  t7900: prepare for switch of the default strategy
  t6500: explicitly use "gc" strategy
  t5510: explicitly use "gc" strategy
  t5400: explicitly use "gc" strategy
  t34xx: don't expire reflogs where it matters
  t: disable maintenance where we verify object database structure
  t: fix races caused by background maintenance

3 months agoMerge branch 'jr/apply-directory-normalize'
Junio C Hamano [Wed, 4 Mar 2026 18:53:01 +0000 (10:53 -0800)] 
Merge branch 'jr/apply-directory-normalize'

"git apply --directory=./un/../normalized/path" now normalizes the
given path before using it.

* jr/apply-directory-normalize:
  apply: normalize path in --directory argument

3 months agoMerge branch 'sp/tree-diff-wo-the-repository'
Junio C Hamano [Wed, 4 Mar 2026 18:53:00 +0000 (10:53 -0800)] 
Merge branch 'sp/tree-diff-wo-the-repository'

The last uses of the_repository in "tree-diff.c" have been
eradicated.

* sp/tree-diff-wo-the-repository:
  tree-diff: remove the usage of the_hash_algo global

3 months agoMerge branch 'pw/no-more-NULL-means-current-worktree'
Junio C Hamano [Wed, 4 Mar 2026 18:53:00 +0000 (10:53 -0800)] 
Merge branch 'pw/no-more-NULL-means-current-worktree'

API clean-up for the worktree subsystem.

* pw/no-more-NULL-means-current-worktree:
  path: remove repository argument from worktree_git_path()
  wt-status: avoid passing NULL worktree

3 months agoMerge branch 'bk/mailmap-wo-the-repository'
Junio C Hamano [Wed, 4 Mar 2026 18:53:00 +0000 (10:53 -0800)] 
Merge branch 'bk/mailmap-wo-the-repository'

Wean the mailmap code off of the_repository dependency.

* bk/mailmap-wo-the-repository:
  mailmap: drop global config variables
  mailmap: stop using the_repository

3 months agoMerge branch 'dk/meson-regen-config-list'
Junio C Hamano [Wed, 4 Mar 2026 18:53:00 +0000 (10:53 -0800)] 
Merge branch 'dk/meson-regen-config-list'

Fix dependency screw-up in meson-based builds.

* dk/meson-regen-config-list:
  build: regenerate config-list.h when Documentation changes

3 months agoMerge branch 'rr/gitweb-mobile'
Junio C Hamano [Wed, 4 Mar 2026 18:52:59 +0000 (10:52 -0800)] 
Merge branch 'rr/gitweb-mobile'

"gitweb" has been taught to be mobile friendly.

* rr/gitweb-mobile:
  gitweb: let page header grow on mobile for long wrapped project names
  gitweb: fix mobile footer overflow by wrapping text and clearing floats
  gitweb: fix mobile page overflow across log/commit/blob/diff views
  gitweb: prevent project search bar from overflowing on mobile
  gitweb: add viewport meta tag for mobile devices

3 months agoMerge branch 'sp/shallow-deepen-relative-fix'
Junio C Hamano [Wed, 4 Mar 2026 18:52:59 +0000 (10:52 -0800)] 
Merge branch 'sp/shallow-deepen-relative-fix'

"git fetch --deepen" that tries to go beyond merged branch used to
get confused where the updated shallow points are, which has been
corrected.

* sp/shallow-deepen-relative-fix:
  shallow: handling fetch relative-deepen
  shallow: free local object_array allocations

3 months agoMerge branch 'kn/osxkeychain-buildfix'
Junio C Hamano [Wed, 4 Mar 2026 18:52:59 +0000 (10:52 -0800)] 
Merge branch 'kn/osxkeychain-buildfix'

Simplify build procedure for oxskeychain (in contrib/).

* kn/osxkeychain-buildfix:
  osxkeychain: define build targets in the top-level Makefile.

3 months agoMerge branch 'kn/ref-location'
Junio C Hamano [Wed, 4 Mar 2026 18:52:58 +0000 (10:52 -0800)] 
Merge branch 'kn/ref-location'

Allow the directory in which reference backends store their data to
be specified.

* kn/ref-location:
  refs: add GIT_REFERENCE_BACKEND to specify reference backend
  refs: allow reference location in refstorage config
  refs: receive and use the reference storage payload
  refs: move out stub modification to generic layer
  refs: extract out `refs_create_refdir_stubs()`
  setup: don't modify repo in `create_reference_database()`

3 months agostatus: clarify how status.compareBranches deduplicates
Harald Nordgren [Wed, 4 Mar 2026 12:25:31 +0000 (12:25 +0000)] 
status: clarify how status.compareBranches deduplicates

The order of output when multiple branches are specified on the
configuration variable was not clearly spelled out in the
documentation.

Add a paragraph to describe the order and also how the branches are
deduplicated.  Update t6040 with additional tests to illustrate how
multiple branches are shown and deduplicated.

Signed-off-by: Harald Nordgren <haraldnordgren@gmail.com>
[jc: made a whole replacement into incremental; wrote log message.]
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agodoc: add information regarding external commands
Omri Sarig [Wed, 4 Mar 2026 15:03:34 +0000 (15:03 +0000)] 
doc: add information regarding external commands

Git supports running external commands in the user's PATH as if they
were built-in commands (see execv_dashed_external in git.c).

This feature was not fully documented in Git's user-facing
documentation.

Add a short documentation to describe how PATH is used to find a custom
subcommand.

Signed-off-by: Omri Sarig <omri.sarig13@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agopath: remove redundant function calls
K Jayatheerth [Wed, 4 Mar 2026 13:05:02 +0000 (18:35 +0530)] 
path: remove redundant function calls

repo_settings_get_shared_repository() is invoked multiple times in
calc_shared_perm(). While the function internally caches the value,
repeated calls still add unnecessary noise.

Store the result in a local variable and reuse it instead. This makes
it explicit that the value is expected to remain constant and avoids
repeated calls in the same scope.

Signed-off-by: K Jayatheerth <jayatheerthkulkarni2005@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agopath: use size_t for dir_prefix length
K Jayatheerth [Wed, 4 Mar 2026 13:05:01 +0000 (18:35 +0530)] 
path: use size_t for dir_prefix length

The strlen() function returns a size_t. Storing this in a standard
signed int is a bad practice that invites overflow vulnerabilities if
paths get absurdly long.

Switch the variable to size_t. This is safe to do because 'len' is
strictly used as an argument to strncmp() (which expects size_t) and
as a positive array index, involving no signed arithmetic that could
rely on negative values.

Signed-off-by: K Jayatheerth <jayatheerthkulkarni2005@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agopath: remove unused header
K Jayatheerth [Wed, 4 Mar 2026 13:05:00 +0000 (18:35 +0530)] 
path: remove unused header

The "environment.h" header is included in "path.c", but none of the
functions or macros it provides are used in this file.

Signed-off-by: K Jayatheerth <jayatheerthkulkarni2005@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoSync with 'master'
Junio C Hamano [Tue, 3 Mar 2026 21:41:30 +0000 (13:41 -0800)] 
Sync with 'master'

3 months agoMerge branch 'jh/alias-i18n-fixes' into next
Junio C Hamano [Tue, 3 Mar 2026 21:41:22 +0000 (13:41 -0800)] 
Merge branch 'jh/alias-i18n-fixes' into next

Further update to the i18n alias support to avoid regressions.

* jh/alias-i18n-fixes:
  doc: fix list continuation in alias.adoc

3 months agoMerge branch 'pt/fsmonitor-watchman-sample-fix' into next
Junio C Hamano [Tue, 3 Mar 2026 21:41:22 +0000 (13:41 -0800)] 
Merge branch 'pt/fsmonitor-watchman-sample-fix' into next

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

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

3 months agoMerge branch 'mm/diff-no-index-find-object' into next
Junio C Hamano [Tue, 3 Mar 2026 21:41:21 +0000 (13:41 -0800)] 
Merge branch 'mm/diff-no-index-find-object' into next

"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

3 months agoMerge branch 'ps/ci-reduce-gitlab-envsize' into next
Junio C Hamano [Tue, 3 Mar 2026 21:41:21 +0000 (13:41 -0800)] 
Merge branch 'ps/ci-reduce-gitlab-envsize' into next

CI fix.

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

3 months agoMerge branch 'fp/t3310-test-path-is-helpers' into next
Junio C Hamano [Tue, 3 Mar 2026 21:41:21 +0000 (13:41 -0800)] 
Merge branch 'fp/t3310-test-path-is-helpers' into next

Test clean-up.

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

3 months agoMerge branch 'ss/test-that-that-typofix' into next
Junio C Hamano [Tue, 3 Mar 2026 21:41:20 +0000 (13:41 -0800)] 
Merge branch 'ss/test-that-that-typofix' into next

Typofix in t/.

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

3 months agoMerge branch 'rs/parse-options-duplicated-long-options' into next
Junio C Hamano [Tue, 3 Mar 2026 21:41:20 +0000 (13:41 -0800)] 
Merge branch 'rs/parse-options-duplicated-long-options' into next

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

3 months agoMerge branch 'ar/config-hooks' into next
Junio C Hamano [Tue, 3 Mar 2026 21:41:20 +0000 (13:41 -0800)] 
Merge branch 'ar/config-hooks' into next

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:

3 months agoMerge branch 'kh/format-patch-noprefix-is-boolean' into next
Junio C Hamano [Tue, 3 Mar 2026 21:41:19 +0000 (13:41 -0800)] 
Merge branch 'kh/format-patch-noprefix-is-boolean' into next

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

3 months agot3700: use test_grep helper for better diagnostics
Siddharth Shrimali [Tue, 3 Mar 2026 20:40:29 +0000 (02:10 +0530)] 
t3700: use test_grep helper for better diagnostics

Replace 'grep' and '! grep' invocations with 'test_grep' and
'test_grep !'. This provides better debugging output if tests fail
in the future, as 'test_grep' will automatically print the
contents of the file when a check fails.

While at it, update any remaining instances of 'grep' to 'test_grep'
that were missed in the previous versions to ensure that the entire
file is consistent with modern project style.

Suggested-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Siddharth Shrimali <r.siddharth.shrimali@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agot3700: avoid suppressing git's exit code
Siddharth Shrimali [Tue, 3 Mar 2026 20:40:28 +0000 (02:10 +0530)] 
t3700: avoid suppressing git's exit code

Replace pipelines involving git commands with temporary files (actual)
to ensure that any crashes or unexpected exit codes from the git
commands are properly caught by the test suite. A simple pipeline
like 'git foo | grep bar' ignores the exit code of 'git', which
can hide regressions.

In cases where we were counting lines with 'wc -l' to ensure a
pattern was absent, simplify the logic to use '! grep' to avoid
subshells entirely.

Suggested-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Siddharth Shrimali <r.siddharth.shrimali@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoThe 10th batch
Junio C Hamano [Tue, 3 Mar 2026 19:08:01 +0000 (11:08 -0800)] 
The 10th batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoMerge branch 'hy/diff-lazy-fetch-with-break-fix'
Junio C Hamano [Tue, 3 Mar 2026 19:08:13 +0000 (11:08 -0800)] 
Merge branch 'hy/diff-lazy-fetch-with-break-fix'

A prefetch call can be triggered to access a stale diff_queue entry
after diffcore-break breaks a filepair into two and freed the
original entry that is no longer used, leading to a segfault, which
has been corrected.

* hy/diff-lazy-fetch-with-break-fix:
  diffcore-break: avoid segfault with freed entries

3 months agoMerge branch 'aa/add-p-no-auto-advance'
Junio C Hamano [Tue, 3 Mar 2026 19:08:13 +0000 (11:08 -0800)] 
Merge branch 'aa/add-p-no-auto-advance'

"git add -p" learned a new mode that allows the user to revisit a
file that was already dealt with.

* aa/add-p-no-auto-advance:
  add-patch: allow interfile navigation when selecting hunks
  add-patch: allow all-or-none application of patches
  add-patch: modify patch_update_file() signature
  interactive -p: add new `--auto-advance` flag

3 months agoMerge branch 'lg/t2004-test-path-is-helpers'
Junio C Hamano [Tue, 3 Mar 2026 19:08:13 +0000 (11:08 -0800)] 
Merge branch 'lg/t2004-test-path-is-helpers'

Test code clean-up.

* lg/t2004-test-path-is-helpers:
  t2004: use test_path_is_file instead of test -f

3 months agoMerge branch 'ps/simplify-normalize-path-copy-len'
Junio C Hamano [Tue, 3 Mar 2026 19:08:12 +0000 (11:08 -0800)] 
Merge branch 'ps/simplify-normalize-path-copy-len'

Code clean-up.

* ps/simplify-normalize-path-copy-len:
  path: factor out skip_slashes() in normalize_path_copy_len()

3 months agoMerge branch 'sc/pack-redundant-leakfix'
Junio C Hamano [Tue, 3 Mar 2026 19:08:12 +0000 (11:08 -0800)] 
Merge branch 'sc/pack-redundant-leakfix'

Leakfix.

* sc/pack-redundant-leakfix:
  pack-redundant: fix memory leak when open_pack_index() fails

3 months agoMerge branch 'cs/subtree-split-fixes'
Junio C Hamano [Tue, 3 Mar 2026 19:08:12 +0000 (11:08 -0800)] 
Merge branch 'cs/subtree-split-fixes'

An earlier attempt to optimize "git subtree" discarded too much
relevant histories, which has been corrected.

* cs/subtree-split-fixes:
  contrib/subtree: process out-of-prefix subtrees
  contrib/subtree: test history depth
  contrib/subtree: capture additional test-cases

3 months agofor-each-repo: simplify passing of parameters
Derrick Stolee [Tue, 3 Mar 2026 17:31:54 +0000 (17:31 +0000)] 
for-each-repo: simplify passing of parameters

This change simplifies the code somewhat from its original
implementation.

Signed-off-by: Derrick Stolee <stolee@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agofor-each-repo: work correctly in a worktree
Derrick Stolee [Tue, 3 Mar 2026 17:31:53 +0000 (17:31 +0000)] 
for-each-repo: work correctly in a worktree

When run in a worktree, the GIT_DIR directory is set in a different way
than in a typical repository. Show this by updating t0068 to include a
worktree and add a test that runs from that worktree. This requires
moving the repo.key config into a global config instead of the base test
repository's local config (demonstrating that it worked with
non-worktree Git repositories).

We need to be careful to unset the local Git environment variables and
let the child process rediscover them, while also reinstating those
variables in the parent process afterwards. Update run_command_on_repo()
to use the new sanitize_repo_env() helper method to erase these
environment variables.

During review of this bug fix, there were several incorrect patches
demonstrating different bad behaviors. Most of these are covered by
tests, when it is not too expensive to set it up. One case that would be
expensive to set up is the GIT_NO_REPLACE_OBJECTS environment variable,
but we trust that using sanitize_repo_env() will be sufficient to
capture these uncovered cases by using the common code for resetting
environment variables.

Reported-by: Matthew Gabeler-Lee <fastcat@gmail.com>
Signed-off-by: Derrick Stolee <stolee@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agorun-command: extract sanitize_repo_env helper
Derrick Stolee [Tue, 3 Mar 2026 17:31:52 +0000 (17:31 +0000)] 
run-command: extract sanitize_repo_env helper

The current prepare_other_repo_env() does two distinct things:

 1. Strip certain known environment variables that should be set by a
    child process based on a different repository.

 2. Set the GIT_DIR variable to avoid repository discovery.

The second item is valuable for child processes that operate on
submodules, where the repo discovery could be mistaken for the parent
repository.

In the next change, we will see an important case where only the first
item is required as the GIT_DIR discovery should happen naturally from
the '-C' parameter in the child process.

Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Derrick Stolee <stolee@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>