]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
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 agosetup: improve error diagnosis for invalid .git files
Tian Yuchen [Wed, 4 Mar 2026 14:15:26 +0000 (22:15 +0800)] 
setup: improve error diagnosis for invalid .git files

'read_gitfile_gently()' treats any non-regular file as
'READ_GITFILE_ERR_NOT_A_FILE' and fails to discern between 'ENOENT'
and other stat failures. This flawed error reporting is noted by two
'NEEDSWORK' comments.

Address these comments by introducing two new error codes:
'READ_GITFILE_ERR_MISSING'(which groups the "file missing" scenarios
together) and 'READ_GITFILE_ERR_IS_A_DIR':

1. Update 'read_gitfile_error_die()' to treat 'IS_A_DIR', 'MISSING',
'NOT_A_FILE' and 'STAT_FAILED' as non-fatal no-ops. This accommodates
intentional non-repo scenarios (e.g., GIT_DIR=/dev/null).

2. Explicitly catch 'NOT_A_FILE' and 'STAT_FAILED' during
discovery and call 'die()' if 'die_on_error' is set.

3. Unconditionally pass '&error_code' to 'read_gitfile_gently()'.

4. Only invoke 'is_git_directory()' when we explicitly receive
   'READ_GITFILE_ERR_IS_A_DIR', avoiding redundant checks.

Additionally, audit external callers of 'read_gitfile_gently()' in
'submodule.c' and 'worktree.c' to accommodate the refined error codes.

Signed-off-by: Tian Yuchen <a3205153416@gmail.com>
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 agogit-gui: grey out comment lines in commit message
Wolfgang Faust [Wed, 4 Mar 2026 01:30:52 +0000 (17:30 -0800)] 
git-gui: grey out comment lines in commit message

Comment lines are stripped by wash_commit_message, but there is no
indication in the UI that they are special and will be removed.
Grey these lines out to indicate that they will be removed.

Signed-off-by: Wolfgang Faust <contrib-git@wolfgangfaust.com>
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
3 months agosubmodule: fetch missing objects from default remote
Nasser Grainawi [Tue, 3 Mar 2026 23:40:44 +0000 (15:40 -0800)] 
submodule: fetch missing objects from default remote

When be76c21282 (fetch: ensure submodule objects fetched, 2018-12-06)
added support for fetching a missing submodule object by id, it
hardcoded the remote name as "origin" and deferred anything more
complicated for a later patch. Implement the NEEDSWORK item to remove
the hardcoded assumption by adding and using a submodule helper subcmd
'get-default-remote'. Fixing this lets 'git fetch --recurse-submodules'
succeed when the fetched commit(s) in the superproject trigger a
submodule fetch, and that submodule's default remote name is not
"origin".

Add non-"origin" remote tests to t5526-fetch-submodules.sh and
t5572-pull-submodule.sh demonstrating this works as expected and add
dedicated tests for get-default-remote.

Signed-off-by: Nasser Grainawi <nasser.grainawi@oss.qualcomm.com>
Reviewed-by: Jacob Keller <jacob.keller@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agobuiltin/history: implement "split" subcommand
Patrick Steinhardt [Mon, 2 Mar 2026 12:13:12 +0000 (13:13 +0100)] 
builtin/history: implement "split" subcommand

It is quite a common use case that one wants to split up one commit into
multiple commits by moving parts of the changes of the original commit
out into a separate commit. This is quite an involved operation though:

  1. Identify the commit in question that is to be dropped.

  2. Perform an interactive rebase on top of that commit's parent.

  3. Modify the instruction sheet to "edit" the commit that is to be
     split up.

  4. Drop the commit via "git reset HEAD~".

  5. Stage changes that should go into the first commit and commit it.

  6. Stage changes that should go into the second commit and commit it.

  7. Finalize the rebase.

This is quite complex, and overall I would claim that most people who
are not experts in Git would struggle with this flow.

Introduce a new "split" subcommand for git-history(1) to make this way
easier. All the user needs to do is to say `git history split $COMMIT`.
From hereon, Git asks the user which parts of the commit shall be moved
out into a separate commit and, once done, asks the user for the commit
message. Git then creates that split-out commit and applies the original
commit on top of it.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agobuiltin/history: split out extended function to create commits
Patrick Steinhardt [Mon, 2 Mar 2026 12:13:11 +0000 (13:13 +0100)] 
builtin/history: split out extended function to create commits

In the next commit we're about to introduce a new command that splits up
a commit into two. Most of the logic will be shared with rewording
commits, except that we also need to have control over the parents and
the old/new trees.

Extract a new function `commit_tree_with_edited_message_ext()` to
prepare for this commit.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agocache-tree: allow writing in-memory index as tree
Patrick Steinhardt [Mon, 2 Mar 2026 12:13:10 +0000 (13:13 +0100)] 
cache-tree: allow writing in-memory index as tree

The function `write_in_core_index_as_tree()` takes a repository and
writes its index into a tree object. What this function cannot do though
is to take an _arbitrary_ in-memory index.

Introduce a new `struct index_state` parameter so that the caller can
pass a different index than the one belonging to the repository. This
will be used in a subsequent commit.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoadd-patch: allow disabling editing of hunks
Patrick Steinhardt [Mon, 2 Mar 2026 12:13:09 +0000 (13:13 +0100)] 
add-patch: allow disabling editing of hunks

The "add-patch" mode allows the user to edit hunks to apply custom
changes. This is incompatible with a new `git history split` command
that we're about to introduce in a subsequent commit, so we need a way
to disable this mode.

Add a new flag to disable editing hunks.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoadd-patch: add support for in-memory index patching
Patrick Steinhardt [Mon, 2 Mar 2026 12:13:08 +0000 (13:13 +0100)] 
add-patch: add support for in-memory index patching

With `run_add_p()` callers have the ability to apply changes from a
specific revision to a repository's index. This infra supports several
different modes, like for example applying changes to the index,
working tree or both.

One feature that is missing though is the ability to apply changes to an
in-memory index different from the repository's index. Add a new
function `run_add_p_index()` to plug this gap.

This new function will be used in a subsequent commit.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoadd-patch: remove dependency on "add-interactive" subsystem
Patrick Steinhardt [Mon, 2 Mar 2026 12:13:07 +0000 (13:13 +0100)] 
add-patch: remove dependency on "add-interactive" subsystem

With the preceding commit we have split out interactive configuration
that is used by both "git add -p" and "git add -i". But we still
initialize that configuration in the "add -p" subsystem by calling
`init_add_i_state()`, even though we only do so to initialize the
interactive configuration as well as a repository pointer.

Stop doing so and instead store and initialize the interactive
configuration in `struct add_p_state` directly.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoadd-patch: split out `struct interactive_options`
Patrick Steinhardt [Mon, 2 Mar 2026 12:13:06 +0000 (13:13 +0100)] 
add-patch: split out `struct interactive_options`

The `struct add_p_opt` is reused both by our infra for "git add -p" and
"git add -i". Users of `run_add_i()` for example are expected to pass
`struct add_p_opt`. This is somewhat confusing and raises the question
of which options apply to what part of the stack.

But things are even more confusing than that: while callers are expected
to pass in `struct add_p_opt`, these options ultimately get used to
initialize a `struct add_i_state` that is used by both subsystems. So we
are basically going full circle here.

Refactor the code and split out a new `struct interactive_options` that
hosts common options used by both. These options are then applied to a
`struct interactive_config` that hosts common configuration.

This refactoring doesn't yet fully detangle the two subsystems from one
another, as we still end up calling `init_add_i_state()` in the "git add
-p" subsystem. This will be fixed in a subsequent commit.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoadd-patch: split out header from "add-interactive.h"
Patrick Steinhardt [Mon, 2 Mar 2026 12:13:05 +0000 (13:13 +0100)] 
add-patch: split out header from "add-interactive.h"

While we have a "add-patch.c" code file, its declarations are part of
"add-interactive.h". This makes it somewhat harder than necessary to
find relevant code and to identify clear boundaries between the two
subsystems.

Split up concerns and move declarations that relate to "add-patch.c"
into a new "add-patch.h" header.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
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 agogitk: commit translation files without file information
Johannes Sixt [Mon, 2 Mar 2026 08:14:48 +0000 (09:14 +0100)] 
gitk: commit translation files without file information

File information in the translation files is only helpful for the
translators, but is not needed to compile the message catalogs. On top
of that, file information is rather volatile and leads to large patches
that do not carry essential information. For this reason, Git project
has opted to remove the file information from its translation files.
Let's do that in this project, too.

Rewrite the update-po target to generate *.po files that do contain
file information for the benefit of translators. Configure a clean
filter under the name "gettext-no-location", which is the same that
the Git project uses. It is expected that translators have already
configured their repository suitably. Nevertheless, write a reminder
as part of the update-po target.

Apply the clean-filter to the translation files.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
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>
3 months agofor-each-repo: test outside of repo context
Derrick Stolee [Tue, 3 Mar 2026 17:31:51 +0000 (17:31 +0000)] 
for-each-repo: test outside of repo context

The 'git for-each-repo' tool is frequently run outside of a repo context
in the real world. For example, it powers background maintenance.
Despite this typical case, we have not been testing it without a local
repository.

Update t0068 to stop creating a test repo and to use global config
everywhere. This has some subtle changes to test across the file.

This was noticed because an earlier attempt to remove the_repository
from builtin/for-each-repo.c did not catch a segmentation fault since
the passed 'repo' is NULL. This use of the_repository will need to stay
until we have a better way to handle config queries outside of a repo
context. Similar use still exists in builtin/config.c for the same
reason.

Signed-off-by: Derrick Stolee <stolee@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agodoc: fix list continuation in alias.adoc
Jonatan Holmgren [Tue, 3 Mar 2026 15:12:38 +0000 (16:12 +0100)] 
doc: fix list continuation in alias.adoc

Add missing list continuation marks ('+') after code blocks and shell examples
so paragraphs render correctly as part of the preceding list item.

Signed-off-by: Jonatan Holmgren <jonatan@jontes.page>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoxdiff: re-diff shifted change groups when using histogram algorithm
Yee Cheng Chin [Mon, 2 Mar 2026 14:54:25 +0000 (14:54 +0000)] 
xdiff: re-diff shifted change groups when using histogram algorithm

After a diff algorithm has been run, the compaction phase
(xdl_change_compact()) shifts and merges change groups to produce a
cleaner output. However, this shifting could create a new matched group
where both sides now have matching lines. This results in a
wrong-looking diff output which contains redundant lines that are the
same on both files.

Fix this by detecting this situation, and re-diff the texts on each side
to find similar lines, using the fall-back Myer's diff. Only do this for
histogram diff as it's the only algorithm where this is relevant. Below
contains an example, and more details.

For an example, consider two files below:

    file1:
        A

        A
        A
        A

        A
        A
        A

    file2:
        A

        A
        x
        A

        A
        A
        A

When using Myer's diff, the algorithm finds that only the "x" has been
changed, and produces a final diff result (these are line diffs, but
using word-diff syntax for ease of presentation):

        A A[-A-]{+x+}A AAA

When using histogram diff, the algorithm first discovers the LCS "A
AAA", which it uses as anchor, then produces an intermediate diff:

        {+A Ax+}A AAA[- AAA-].

This is a longer diff than Myer's, but it's still self-consistent.
However, the compaction phase attempts to shift the first file's diff
group upwards (note that this shift crosses the anchor that histogram
had used), leading to the final results for histogram diff:

        [-A AA-]{+A Ax+}A AAA

This is a technically correct patch but looks clearly redundant to a
human as the first 3 lines should not be in the diff.

The fix would detect that a shift has caused matching to a new group,
and re-diff the "A AA" and "A Ax" parts, which results in "A A"
correctly re-marked as unchanged. This creates the now correct histogram
diff:

        A A[-A-]{+x+}A AAA

This issue is not applicable to Myer's diff algorithm as it already
generates a minimal diff, which means a shift cannot result in a smaller
diff output (the default Myer's diff in xdiff is not guaranteed to be
minimal for performance reasons, but it typically does a good enough
job).

It's also not applicable to patience diff, because it uses only unique
lines as anchor for its splits, and falls back to Myer's diff within
each split. Shifting requires both ends having the same lines, and
therefore cannot cross the unique line boundaries established by the
patience algorithm. In contrast histogram diff uses non-unique lines as
anchors, and therefore shifting can cross over them.

This issue is rare in a normal repository. Below is a table of
repositories (`git log --no-merges -p --histogram -1000`), showing how
many times a re-diff was done and how many times it resulted in finding
matching lines (therefore addressing this issue) with the fix. In
general it is fewer than 1% of diff's that exhibit this offending
behavior:

| Repo (1k commits)  | Re-diff | Found matching lines |
|--------------------|---------|----------------------|
| llvm-project       |  45     | 11                   |
| vim                | 110     |  9                   |
| git                |  18     |  2                   |
| WebKit             | 168     |  1                   |
| ripgrep            |  22     |  1                   |
| cpython            |  32     |  0                   |
| vscode             |  13     |  0                   |

Signed-off-by: Yee Cheng Chin <ychin.git@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agodoc: gitprotocol-pack: normalize italic formatting
LorenzoPegorari [Tue, 3 Mar 2026 01:46:29 +0000 (02:46 +0100)] 
doc: gitprotocol-pack: normalize italic formatting

Uniform italic style usage for command and process names.

Signed-off-by: LorenzoPegorari <lorenzo.pegorari2002@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agodoc: gitprotocol-pack: improve paragraphs structure
LorenzoPegorari [Tue, 3 Mar 2026 01:46:10 +0000 (02:46 +0100)] 
doc: gitprotocol-pack: improve paragraphs structure

Logically separate the introductory sentence from the first transport
description to improve readability and structural clarity.

Signed-off-by: LorenzoPegorari <lorenzo.pegorari2002@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agodoc: gitprotocol-pack: fix pronoun-antecedent agreement
LorenzoPegorari [Tue, 3 Mar 2026 01:45:59 +0000 (02:45 +0100)] 
doc: gitprotocol-pack: fix pronoun-antecedent agreement

Fix "pronoun-antecedent agreement" errors.

Signed-off-by: LorenzoPegorari <lorenzo.pegorari2002@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoThe 9th batch
Junio C Hamano [Tue, 3 Mar 2026 00:05:51 +0000 (16:05 -0800)] 
The 9th batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoMerge branch 'jt/object-file-use-container-of'
Junio C Hamano [Tue, 3 Mar 2026 01:06:53 +0000 (17:06 -0800)] 
Merge branch 'jt/object-file-use-container-of'

Code clean-up.

* jt/object-file-use-container-of:
  object-file.c: avoid container_of() of a NULL container
  object-file: use `container_of()` to convert from base types

3 months agoMerge branch 'ps/receive-pack-shallow-optim'
Junio C Hamano [Tue, 3 Mar 2026 01:06:53 +0000 (17:06 -0800)] 
Merge branch 'ps/receive-pack-shallow-optim'

The code to accept shallow "git push" has been optimized.

* ps/receive-pack-shallow-optim:
  commit: use commit graph in `lookup_commit_reference_gently()`
  commit: make `repo_parse_commit_no_graph()` more robust
  commit: avoid parsing non-commits in `lookup_commit_reference_gently()`

3 months agoMerge branch 'kh/doc-patch-id-4'
Junio C Hamano [Tue, 3 Mar 2026 01:06:53 +0000 (17:06 -0800)] 
Merge branch 'kh/doc-patch-id-4'

Doc update.

* kh/doc-patch-id-4:
  doc: patch-id: see also git-cherry(1)
  doc: patch-id: add script example
  doc: patch-id: emphasize multi-patch processing

3 months agoMerge branch 'ps/meson-gitk-git-gui'
Junio C Hamano [Tue, 3 Mar 2026 01:06:52 +0000 (17:06 -0800)] 
Merge branch 'ps/meson-gitk-git-gui'

Plumb gitk/git-gui build and install procedure in meson based
builds.

* ps/meson-gitk-git-gui:
  meson: wire up gitk and git-gui

3 months agoMerge branch 'pw/meson-doc-mergetool'
Junio C Hamano [Tue, 3 Mar 2026 01:06:52 +0000 (17:06 -0800)] 
Merge branch 'pw/meson-doc-mergetool'

Update build precedure for mergetool documentation in meson-based builds.

* pw/meson-doc-mergetool:
  meson: fix building mergetool docs

3 months agoMerge branch 'kh/doc-am-xref'
Junio C Hamano [Tue, 3 Mar 2026 01:06:52 +0000 (17:06 -0800)] 
Merge branch 'kh/doc-am-xref'

Doc update.

* kh/doc-am-xref:
  doc: am: fill out hook discussion
  doc: am: add missing config am.messageId
  doc: am: say that --message-id adds a trailer
  doc: am: normalize git(1) command links

3 months agoMerge branch 'ps/object-info-bits-cleanup'
Junio C Hamano [Tue, 3 Mar 2026 01:06:52 +0000 (17:06 -0800)] 
Merge branch 'ps/object-info-bits-cleanup'

A couple of bugs in use of flag bits around odb API has been
corrected, and the flag bits reordered.

* ps/object-info-bits-cleanup:
  odb: convert `odb_has_object()` flags into an enum
  odb: convert object info flags into an enum
  odb: drop gaps in object info flag values
  builtin/fsck: fix flags passed to `odb_has_object()`
  builtin/backfill: fix flags passed to `odb_has_object()`

3 months agoMerge branch 'ag/http-netrc-tests'
Junio C Hamano [Tue, 3 Mar 2026 01:06:51 +0000 (17:06 -0800)] 
Merge branch 'ag/http-netrc-tests'

Additional tests were introduced to see the interaction with netrc
auth with auth failure on the http transport.

* ag/http-netrc-tests:
  t5550: add netrc tests for http 401/403

3 months agoMerge branch 'ty/symlinks-use-unsigned-for-bitset'
Junio C Hamano [Tue, 3 Mar 2026 01:06:51 +0000 (17:06 -0800)] 
Merge branch 'ty/symlinks-use-unsigned-for-bitset'

Code clean-up.

* ty/symlinks-use-unsigned-for-bitset:
  symlinks: use unsigned int for flags

3 months agoMerge branch 'ps/validate-prefix-in-subtree-split'
Junio C Hamano [Tue, 3 Mar 2026 01:06:51 +0000 (17:06 -0800)] 
Merge branch 'ps/validate-prefix-in-subtree-split'

"git subtree split --prefix=P <commit>" now checks the prefix P
against the tree of the (potentially quite different from the
current working tree) given commit.

* ps/validate-prefix-in-subtree-split:
  subtree: validate --prefix against commit in split

3 months agoMerge branch 'uk/signature-is-good-after-key-expires'
Junio C Hamano [Tue, 3 Mar 2026 01:06:50 +0000 (17:06 -0800)] 
Merge branch 'uk/signature-is-good-after-key-expires'

A signature on a commit that was GPG signed long time ago ought to
be still valid after the key that was used to sign it has expired,
but we showed them in alarming red.

* uk/signature-is-good-after-key-expires:
  gpg-interface: signatures by expired keys are fine

3 months agoMerge branch 'ps/odb-for-each-object'
Junio C Hamano [Tue, 3 Mar 2026 01:06:50 +0000 (17:06 -0800)] 
Merge branch 'ps/odb-for-each-object'

Revamp object enumeration API around odb.

* ps/odb-for-each-object:
  odb: drop unused `for_each_{loose,packed}_object()` functions
  reachable: convert to use `odb_for_each_object()`
  builtin/pack-objects: use `packfile_store_for_each_object()`
  odb: introduce mtime fields for object info requests
  treewide: drop uses of `for_each_{loose,packed}_object()`
  treewide: enumerate promisor objects via `odb_for_each_object()`
  builtin/fsck: refactor to use `odb_for_each_object()`
  odb: introduce `odb_for_each_object()`
  packfile: introduce function to iterate through objects
  packfile: extract function to iterate through objects of a store
  object-file: introduce function to iterate through objects
  object-file: extract function to read object info from path
  odb: fix flags parameter to be unsigned
  odb: rename `FOR_EACH_OBJECT_*` flags

3 months agoMerge branch 'ar/run-command-hook-take-2' into ar/config-hooks
Junio C Hamano [Tue, 3 Mar 2026 00:01:33 +0000 (16:01 -0800)] 
Merge branch 'ar/run-command-hook-take-2' into ar/config-hooks

* ar/run-command-hook-take-2:
  builtin/receive-pack: avoid spinning no-op sideband async threads

3 months agobuiltin/receive-pack: avoid spinning no-op sideband async threads
Adrian Ratiu [Mon, 2 Mar 2026 19:17:04 +0000 (21:17 +0200)] 
builtin/receive-pack: avoid spinning no-op sideband async threads

Exit early if the hooks do not exist, to avoid spinning up/down
sideband async threads which no-op.

It is important to call the hook_exists() API provided by hook.[ch]
because it covers both config-defined hooks and the "traditional"
hooks from the hookdir. find_hook() only covers the hookdir hooks.

The regression happened because the no-op async threads add some
additional overhead which can be measured with the receive-refs test
of the benchmarks suite [1].

Reproduced using:
cd benchmarks/receive-refs && \
./run --revisions /path/to/git \
fc148b146ad41be71a7852c4867f0773cbfe1ff9~,fc148b146ad41be71a7852c4867f0773cbfe1ff9 \
--parameter-list refformat reftable --parameter-list refcount 10000

1: https://gitlab.com/gitlab-org/data-access/git/benchmarks

Fixes: fc148b146ad4 ("receive-pack: convert update hooks to new API")
Reported-by: Patrick Steinhardt <ps@pks.im>
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Adrian Ratiu <adrian.ratiu@collabora.com>
[jc: avoid duplicated hardcoded hook names]
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agobuiltin/repo: find tree with most entries
Justin Tobler [Mon, 2 Mar 2026 21:45:26 +0000 (15:45 -0600)] 
builtin/repo: find tree with most entries

The size of a tree object usually corresponds with the number of entries
it has. While iterating through objects in the repository for
git-repo-structure, identify the tree with the most entries and display
it in the output.

Signed-off-by: Justin Tobler <jltobler@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agobuiltin/repo: find commit with most parents
Justin Tobler [Mon, 2 Mar 2026 21:45:25 +0000 (15:45 -0600)] 
builtin/repo: find commit with most parents

Complex merge events may produce an octopus merge where the resulting
merge commit has more than two parents. While iterating through objects
in the repository for git-repo-structure, identify the commit with the
most parents and display it in the output.

Signed-off-by: Justin Tobler <jltobler@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agobuiltin/repo: add OID annotations to table output
Justin Tobler [Mon, 2 Mar 2026 21:45:24 +0000 (15:45 -0600)] 
builtin/repo: add OID annotations to table output

The "structure" output for git-repo(1) does not show the corresponding
OIDs for the largest objects in its "table" output. Update the output to
include a list of OID annotations with an index to the corresponding row
in the table.

Signed-off-by: Justin Tobler <jltobler@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agobuiltin/repo: collect largest inflated objects
Justin Tobler [Mon, 2 Mar 2026 21:45:23 +0000 (15:45 -0600)] 
builtin/repo: collect largest inflated objects

The "structure" output for git-repo(1) shows the total inflated and disk
sizes of reachable objects in the repository, but doesn't show the size
of the largest individual objects. Since an individual object may be a
large contributor to the overall repository size, it is useful for users
to know the maximum size of individual objects.

While interating across objects, record the size and OID of the largest
objects encountered for each object type to provide as output. Note that
the default "table" output format only displays size information and not
the corresponding OID. In a subsequent commit, the table format is
updated to add table annotations that mention the OID.

Signed-off-by: Justin Tobler <jltobler@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agobuiltin/repo: add helper for printing keyvalue output
Justin Tobler [Mon, 2 Mar 2026 21:45:22 +0000 (15:45 -0600)] 
builtin/repo: add helper for printing keyvalue output

The machine-parsable formats for the git-repo(1) "structure" subcommand
print output in keyvalue pairs. Introduce the helper function
`print_keyvalue()` to remove some code duplication and improve
readability.

Signed-off-by: Justin Tobler <jltobler@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agobuiltin/repo: update stats for each object
Justin Tobler [Mon, 2 Mar 2026 21:45:21 +0000 (15:45 -0600)] 
builtin/repo: update stats for each object

When walking reachable objects in the repository, `count_objects()`
processes a set of objects and updates the `struct object_stats`. In
preparation for more granular statistics being collected, update the
`struct object_stats` for each individual object instead.

Signed-off-by: Justin Tobler <jltobler@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agot: fix "that that" typo in lib-unicode-nfc-nfd.sh
Siddharth Shrimali [Mon, 2 Mar 2026 19:26:27 +0000 (00:56 +0530)] 
t: fix "that that" typo in lib-unicode-nfc-nfd.sh

In the comments of lib-unicode-nfc-nfd.sh, "that that" was used
unintentionally. Remove the redundant "that" to improve clarity.

Signed-off-by: Siddharth Shrimali <r.siddharth.shrimali@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agot3310: replace test -f/-d with test_path_is_file/test_path_is_dir
Francesco Paparatto [Sat, 28 Feb 2026 00:59:39 +0000 (01:59 +0100)] 
t3310: replace test -f/-d with test_path_is_file/test_path_is_dir

Replace old-style path assertions with modern helpers that
provide clearer diagnostic messages on failure. When test -f
fails, the output gives no indication of what went wrong.

These instances were found using:

  git grep "test -[efd]" t/

as suggested in the microproject ideas.

Signed-off-by: Francesco Paparatto <francescopaparatto@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoci: unset GITLAB_FEATURES envvar to not bust xargs(1) limits
Patrick Steinhardt [Mon, 2 Mar 2026 11:55:02 +0000 (12:55 +0100)] 
ci: unset GITLAB_FEATURES envvar to not bust xargs(1) limits

We have started to see the following assert happen in our GitLab CI
pipelines for jobs that use Windows with Meson:

  assertion "bc_ctl.arg_max >= LINE_MAX" failed: file "xargs.c", line 512, function: main

The assert in question verifies that we have enough room available to
pass at least `LINE_MAX` many bytes via the command line. The xargs(1)
binary in those jobs comes from Git for Windows, which in turn sources
the binaries from MSYS2, and has the following limits in place:

  $ & "C:/Program Files/Git/usr/bin/bash.exe" -l -c 'xargs --show-limits </dev/null'
  Your environment variables take up 17373 bytes
  POSIX upper limit on argument length (this system): 12579
  POSIX smallest allowable upper limit on argument length (all systems): 4096
  Maximum length of command we could actually use: 18446744073709546822
  Size of command buffer we are actually using: 12579
  Maximum parallelism (--max-procs must be no greater): 2147483647

What's interesting to see is the limit of 16 exabits for the maximum
command line length. This value might seem a bit high, and it is indeed
the result of an underflow: our environment is larger than the POSIX
upper limit on argument length, and the value is computed by subtracting
the former from the latter. So what we get is the result of `2^64 -
(17373 - 12579)`.

This makes it clear that the problem here is the size of our environment
variables. A listing sorted by length yields the following result:

  $ Get-ChildItem "Env:" |
      Sort-Object { $_.Value.Length } -Descending |
      Select-Object Name, @{Name="Length"; Expression={$_.Value.Length}}
  Name                                          Length
  ----                                          ------
  GITLAB_FEATURES                                 6386
  Path                                             706
  PSModulePath                                     229

The GITLAB_FEATURES environment variable makes up for roughly a third of
the complete environment. This variable is a comma-separated list of
features available for the GitLab instance, and seemingly it has been
growing over time as GitLab added more and more features.

Fix the issue by unsetting the environment variable in "ci/lib.sh". This
ensures that the environment variables are now smaller than the upper
limit on argument length again, and that in turn fixes the assert in
xargs(1).

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agodoc: diff-options.adoc: make *.noprefix split translatable
Kristoffer Haugsbakk [Sun, 1 Mar 2026 19:21:14 +0000 (20:21 +0100)] 
doc: diff-options.adoc: make *.noprefix split translatable

We cannot split single words like what we did in the previous
commit. That is because the doc translations are processed in
bigger chunks.

Instead write the two paragraphs with the only variations being this
configuration variable.

Reported-by: Jean-Noël Avila <jn.avila@free.fr>
Signed-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agosend-email: add client certificate options
David Timber [Mon, 2 Mar 2026 03:16:41 +0000 (12:16 +0900)] 
send-email: add client certificate options

For SMTP servers that do "mutual certificate verification", the mail
client is required to present its own TLS certificate as well. This
patch adds --smtp-ssl-client-cert and --smtp-ssl-client-key for such
servers.

The problem of which private key for the certificate is chosen arises
when there are private keys in both the certificate and private key
file. According to the documentation of IO::Socket::SSL(link supplied),
the behaviour(the private key chosen) depends on the format of the
certificate. In a nutshell,

- PKCS12: the key in the cert always takes the precedence
- PEM: if the key file is not given, it will "try" to read one
  from the cert PEM file

Many users may find this discrepancy unintuitive.

In terms of client certificate, git-send-email is implemented in a way
that what's possible with perl's SSL library is exposed to the user as
much as possible. In this instance, the user may choose to use a PEM
file that contains both certificate and private key should be
at their discretion despite the implications.

Link: https://metacpan.org/pod/IO::Socket::SSL#SSL_cert_file-%7C-SSL_cert-%7C-SSL_key_file-%7C-SSL_key
Link: https://lore.kernel.org/all/319bf98c-52df-4bf9-b157-e4bc2bf087d6@dev.snart.me/
Signed-off-by: David Timber <dxdt@dev.snart.me>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agodiff: fix crash with --find-object outside repository
Michael Montalbo [Sat, 28 Feb 2026 20:31:16 +0000 (20:31 +0000)] 
diff: fix crash with --find-object outside repository

When "git diff --find-object=<oid>" is run outside a git repository,
the option parsing callback eagerly resolves the OID via
repo_get_oid(), which reaches get_main_ref_store() and hits a BUG()
assertion because no repository has been set up.

Check startup_info->have_repository before attempting to resolve the
OID, and return a user-friendly error instead.

Signed-off-by: Michael Montalbo <mmontalbo@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agofsmonitor-watchman: fix variable reference and remove redundant code
Paul Tarjan [Sat, 28 Feb 2026 17:37:57 +0000 (17:37 +0000)] 
fsmonitor-watchman: fix variable reference and remove redundant code

The is_work_tree_watched() function in fsmonitor-watchman.sample has
two bugs:

1. Wrong variable in error check: After calling watchman_clock(), the
   result is stored in $o, but the code checks $output->{error} instead
   of $o->{error}. This means errors from the clock command are silently
   ignored.

2. Double output violates protocol: When the retry path triggers (the
   directory wasn't initially watched), output_result() is called with
   the "/" flag, then launch_watchman() is called recursively which
   calls output_result() again. This outputs two clock tokens to stdout,
   but git's fsmonitor v2 protocol expects exactly one response.

Fix #1 by checking $o->{error} after watchman_clock().

Fix #2 by removing the recursive launch_watchman() call. The "/"
"everything is dirty" flag already tells git to do a full scan, and
git will call the hook again on the next invocation with a valid clock
token.

With the recursive call removed, the $retry guard is no longer needed
since it only existed to prevent infinite recursion. Remove it.

Apply the same fixes to the test helper scripts in t/t7519/.

Signed-off-by: Paul Tarjan <github@paulisageek.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agosend-email: validate charset name in 8bit encoding prompt
Shreyansh Paliwal [Sat, 28 Feb 2026 11:20:45 +0000 (16:50 +0530)] 
send-email: validate charset name in 8bit encoding prompt

When a non-ASCII character is detected in the body or subject of the email
the user is prompted with,

        Which 8bit encoding should I declare [UTF-8]? foo

After this the input string is validated by the regex, based on the fact
that the charset string will be minimum 4 characters [1]. If the string is
more than 4 letters the email is sent, if not then a second prompt to
confirm is asked to the user,

        Are you sure you want to use <foo> [y/N]? y

This relies on a length based regex heuristic check to validate the user
input, and can allow clearly invalid charset names to pass if the input is
greater than 4 characters.

Add a semantic validation of the charset name using the
Encode::find_encoding() which is a bundled module of perl. If the encoding
is not recognized, warn the user and ask for confirmation before proceeding.
After this validation the lenght based validation becomes redundant and also
breaks flow, so change the regex of valid input to any non blank string.

Make the encoding warning logic specific to the 8bit prompt, also add a
unique confirmation prompt which  reduces the load on ask(), and improves
maintainability.

Additionally, the wording of the first prompt can confuse the user if not
read properly or under any default assumptions for a yes/no prompt. Change
the wording to make it explicitly clear to the user that the prompt needs a
string input, UTF-8 being the default.

The intended flow is,

        Declare which 8bit encoding to use [default: UTF-8]? foobar
        'foobar' does not appear to be a valid charset name. Use it anyway [y/N]?

[1]- https://github.com/git/git/commit/852a15d748034eec87adbee73a72689c8936fb8b

Signed-off-by: Shreyansh Paliwal <shreyanshpaliwalcmsmn@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoparseopt: check for duplicate long names and numerical options
René Scharfe [Sat, 28 Feb 2026 09:19:16 +0000 (10:19 +0100)] 
parseopt: check for duplicate long names and numerical options

We already check for duplicate short names.  Check for and report
duplicate long names and numerical options as well.

Perform the slightly expensive string duplicate check only when showing
the usage to keep the cost of normal invocations low.  t0012-help.sh
covers it.

Helped-by: Jeff King <peff@peff.net>
Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agogitk: support link color in the Preferences dialog
Wang Zichong [Sat, 28 Feb 2026 07:59:44 +0000 (07:59 +0000)] 
gitk: support link color in the Preferences dialog

As a dark-theme user, I use the Preferences dialog to set colors
for gitk. The only color I cannot change via that dialog is the
link foreground color, which leads to using the default link color
on a dark background that makes it hard to read.

Make the link foreground color also configurable in the Gitk
Preferences dialog's Color tab, so users won't need to dig into
the code/manual to check if it is configurable and can simply set
the color there.

Signed-off-by: Wang Zichong <wangzichong@deepin.org>
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
3 months agoThe 8th batch
Junio C Hamano [Fri, 27 Feb 2026 22:19:13 +0000 (14:19 -0800)] 
The 8th batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoMerge branch 'ap/use-test-seq-f-more'
Junio C Hamano [Fri, 27 Feb 2026 23:11:55 +0000 (15:11 -0800)] 
Merge branch 'ap/use-test-seq-f-more'

Test clean-up.

* ap/use-test-seq-f-more:
  t: use test_seq -f and pipes in a few more places

3 months agoMerge branch 'db/doc-fetch-jobs-auto'
Junio C Hamano [Fri, 27 Feb 2026 23:11:54 +0000 (15:11 -0800)] 
Merge branch 'db/doc-fetch-jobs-auto'

Doc update.

* db/doc-fetch-jobs-auto:
  doc: fetch: document `--jobs=0` behavior

3 months agoMerge branch 'mf/format-patch-honor-from-for-cover-letter'
Junio C Hamano [Fri, 27 Feb 2026 23:11:53 +0000 (15:11 -0800)] 
Merge branch 'mf/format-patch-honor-from-for-cover-letter'

"git format-patch --from=<me>" did not honor the command line
option when writing out the cover letter, which has been corrected.

* mf/format-patch-honor-from-for-cover-letter:
  format-patch: fix From header in cover letter

3 months agoMerge branch 'jh/alias-i18n'
Junio C Hamano [Fri, 27 Feb 2026 23:11:53 +0000 (15:11 -0800)] 
Merge branch 'jh/alias-i18n'

Extend the alias configuration syntax to allow aliases using
characters outside ASCII alphanumeric (plus '-').

* jh/alias-i18n:
  completion: fix zsh alias listing for subsection aliases
  alias: support non-alphanumeric names via subsection syntax
  alias: prepare for subsection aliases
  help: use list_aliases() for alias listing

3 months agoMerge branch 'ps/tests-wo-iconv-fixes'
Junio C Hamano [Fri, 27 Feb 2026 23:11:52 +0000 (15:11 -0800)] 
Merge branch 'ps/tests-wo-iconv-fixes'

Some tests assumed "iconv" is available without honoring ICONV
prerequisite, which has been corrected.

* ps/tests-wo-iconv-fixes:
  t6006: don't use iconv(1) without ICONV prereq
  t5550: add ICONV prereq to tests that use "$HTTPD_URL/error"
  t4205: improve handling of ICONV prerequisite
  t40xx: don't use iconv(1) without ICONV prereq
  t: don't set ICONV prereq when iconv(1) is missing

3 months agoMerge branch 'ps/ci-gitlab-msvc-updates'
Junio C Hamano [Fri, 27 Feb 2026 23:11:52 +0000 (15:11 -0800)] 
Merge branch 'ps/ci-gitlab-msvc-updates'

CI update.

* ps/ci-gitlab-msvc-updates:
  gitlab-ci: handle failed tests on MSVC+Meson job
  gitlab-ci: use "run-test-slice-meson.sh"
  ci: make test slicing consistent across Meson/Make
  github: fix Meson tests not executing at all
  meson: fix MERGE_TOOL_DIR with "--no-bin-wrappers"
  ci: don't skip smallest test slice in GitLab
  ci: handle failures of test-slice helper

3 months agoMerge branch 'jc/whitespace-incomplete-line'
Junio C Hamano [Fri, 27 Feb 2026 23:11:52 +0000 (15:11 -0800)] 
Merge branch 'jc/whitespace-incomplete-line'

It does not make much sense to apply the "incomplete-line"
whitespace rule to symbolic links, whose contents almost always
lack the final newline.  "git apply" and "git diff" are now taught
to exclude them for a change to symbolic links.

* jc/whitespace-incomplete-line:
  whitespace: symbolic links usually lack LF at the end

3 months agoMerge branch 'jc/checkout-switch-restore'
Junio C Hamano [Fri, 27 Feb 2026 23:11:51 +0000 (15:11 -0800)] 
Merge branch 'jc/checkout-switch-restore'

"git switch <name>", in an attempt to create a local branch <name>
after a remote tracking branch of the same name gave an advise
message to disambiguate using "git checkout", which has been
updated to use "git switch".

* jc/checkout-switch-restore:
  checkout: tell "parse_remote_branch" which command is calling it
  checkout: pass program-readable token to unified "main"

3 months agoMerge branch 'jk/ref-filter-lrstrip-optim'
Junio C Hamano [Fri, 27 Feb 2026 23:11:50 +0000 (15:11 -0800)] 
Merge branch 'jk/ref-filter-lrstrip-optim'

Code clean-up.

* jk/ref-filter-lrstrip-optim:
  ref-filter: clarify lstrip/rstrip component counting
  ref-filter: avoid strrchr() in rstrip_ref_components()
  ref-filter: simplify rstrip_ref_components() memory handling
  ref-filter: simplify lstrip_ref_components() memory handling
  ref-filter: factor out refname component counting

3 months agoMerge branch 'ps/history-ergonomics-updates'
Junio C Hamano [Fri, 27 Feb 2026 23:11:50 +0000 (15:11 -0800)] 
Merge branch 'ps/history-ergonomics-updates'

UI improvements for "git history reword".

* ps/history-ergonomics-updates:
  Documentation/git-history: document default for "--update-refs="
  builtin/history: rename "--ref-action=" to "--update-refs="
  builtin/history: replace "--ref-action=print" with "--dry-run"
  builtin/history: check for merges before asking for user input
  builtin/history: perform revwalk checks before asking for user input

3 months agoMerge branch 'ps/for-each-ref-in-fixes'
Junio C Hamano [Fri, 27 Feb 2026 23:11:50 +0000 (15:11 -0800)] 
Merge branch 'ps/for-each-ref-in-fixes'

A handful of places used refs_for_each_ref_in() API incorrectly,
which has been corrected.

* ps/for-each-ref-in-fixes:
  bisect: simplify string_list memory handling
  bisect: fix misuse of `refs_for_each_ref_in()`
  pack-bitmap: fix bug with exact ref match in "pack.preferBitmapTips"
  pack-bitmap: deduplicate logic to iterate over preferred bitmap tips

3 months agoMerge branch 'lo/repo-info-keys'
Junio C Hamano [Fri, 27 Feb 2026 23:11:49 +0000 (15:11 -0800)] 
Merge branch 'lo/repo-info-keys'

"git repo info" learns "--keys" action to list known keys.

* lo/repo-info-keys:
  repo: add new flag --keys to git-repo-info
  repo: rename the output format "keyvalue" to "lines"

3 months agot4052: test for diffstat width when prefix contains ANSI escape codes
LorenzoPegorari [Fri, 27 Feb 2026 21:48:35 +0000 (22:48 +0100)] 
t4052: test for diffstat width when prefix contains ANSI escape codes

Add test checking the calculation of the diffstat display width when the
`line_prefix`, which is text that goes before the diffstat, contains
ANSI escape codes.

This situation happens, for example, when `git log --stat --graph` is
executed:
* `--stat` will create a diffstat for each commit
* `--graph` will stuff `line_prefix` with the graph portion of the log,
  which contains ANSI escape codes to color the text

Signed-off-by: LorenzoPegorari <lorenzo.pegorari2002@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agodiff: handle ANSI escape codes in prefix when calculating diffstat width
LorenzoPegorari [Fri, 27 Feb 2026 21:45:19 +0000 (22:45 +0100)] 
diff: handle ANSI escape codes in prefix when calculating diffstat width

The diffstat width is calculated by taking the terminal width and
incorrectly subtracting the `strlen()` of `line_prefix`, instead of the
actual display width of `line_prefix`, which may contain ANSI escape
codes (e.g., ANSI-colored strings in `log --graph --stat`).

Utilize the display width instead, obtained via `utf8_strnwidth()` with
the flag `skip_ansi`.

Signed-off-by: LorenzoPegorari <lorenzo.pegorari2002@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agopack-objects: remove duplicate --stdin-packs definition
René Scharfe [Fri, 27 Feb 2026 19:27:00 +0000 (20:27 +0100)] 
pack-objects: remove duplicate --stdin-packs definition

cd846bacc7 (pack-objects: introduce '--stdin-packs=follow', 2025-06-23)
added a new definition of the option --stdin-packs that accepts an
argument.  It kept the old definition, which still shows up in the short
help, but is shadowed by the new one.  Remove it.

Hinted-at-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agorepo: remove unnecessary variable shadow
K Jayatheerth [Mon, 23 Feb 2026 13:52:48 +0000 (19:22 +0530)] 
repo: remove unnecessary variable shadow

Avoid redeclaring `entry` inside the conditional block, removing
unnecessary variable shadowing and improving code clarity without
changing behavior.

Signed-off-by: K Jayatheerth <jayatheerthkulkarni2005@gmail.com>
Acked-by: Justin Tobler <jltobler@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agogit, help: fix memory leaks in alias listing
Jonatan Holmgren [Thu, 26 Feb 2026 20:53:28 +0000 (21:53 +0100)] 
git, help: fix memory leaks in alias listing

The list_aliases() function sets the util pointer of each list item to
a heap-allocated copy of the alias command value.  Two callers failed
to free these util pointers:

 - list_cmds() in git.c collects a string list with STRING_LIST_INIT_DUP
   and clears it with string_list_clear(&list, 0), which frees the
   duplicated strings (strdup_strings=1) but not the util pointers.
   Pass free_util=1 to free them.

 - list_cmds_by_config() in help.c calls string_list_sort_u(list, 0) to
   deduplicate the list before processing completion.commands overrides.
   When duplicate entries are removed, the util pointer of each discarded
   item is leaked because free_util=0.  Pass free_util=1 to free them.

Reported-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Jonatan Holmgren <jonatan@jontes.page>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoalias: treat empty subsection [alias ""] as plain [alias]
Jonatan Holmgren [Thu, 26 Feb 2026 20:53:27 +0000 (21:53 +0100)] 
alias: treat empty subsection [alias ""] as plain [alias]

When git-config stores a key of the form alias..name, it records
it under an empty subsection ([alias ""]). The new subsection-aware
alias lookup would see a non-NULL but zero-length subsection and
fall into the subsection code path, where it required a "command"
key and thus silently ignored the entry.

Normalize an empty subsection to NULL before any further processing
so that entries stored this way continue to work as plain
case-insensitive aliases, matching the pre-subsection behaviour.

Users who relied on alias..name to create an alias literally named
".name" may want to migrate to subsection syntax, which looks less confusing:

    [alias ".name"]
        command = <value>

Add tests covering both the empty-subsection compatibility case and
the leading-dot alias via the new syntax.

Signed-off-by: Jonatan Holmgren <jonatan@jontes.page>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agodoc: fix list continuation in alias subsection example
Jonatan Holmgren [Thu, 26 Feb 2026 20:53:26 +0000 (21:53 +0100)] 
doc: fix list continuation in alias subsection example

The example showing the equivalence between alias.last and
alias.last.command was missing the list continuation marks (+
between the shell session block and the following prose, leaving
the paragraph detached from the list item in the rendered output.

Signed-off-by: Jonatan Holmgren <jonatan@jontes.page>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agostatus: add status.compareBranches config for multiple branch comparisons
Harald Nordgren [Thu, 26 Feb 2026 10:33:42 +0000 (10:33 +0000)] 
status: add status.compareBranches config for multiple branch comparisons

Add a new configuration variable status.compareBranches that allows
users to specify a space-separated list of branch comparisons in
git status output.

Supported values:
- @{upstream} for the current branch's upstream tracking branch
- @{push} for the current branch's push destination

Any other value is ignored and a warning is shown.

When not configured, the default behavior is equivalent to setting
`status.compareBranches = @{upstream}`, preserving backward
compatibility.

The advice messages shown are context-aware:
- "git pull" advice is shown only when comparing against @{upstream}
- "git push" advice is shown only when comparing against @{push}
- Divergence advice is shown for upstream branch comparisons

This is useful for triangular workflows where the upstream tracking
branch differs from the push destination, allowing users to see their
status relative to both branches at once.

Example configuration:
    [status]
        compareBranches = @{upstream} @{push}

Signed-off-by: Harald Nordgren <haraldnordgren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agorefactor format_branch_comparison in preparation
Harald Nordgren [Thu, 26 Feb 2026 10:33:41 +0000 (10:33 +0000)] 
refactor format_branch_comparison in preparation

Refactor format_branch_comparison function in preparation for showing
comparison with push remote tracking branch.

Signed-off-by: Harald Nordgren <haraldnordgren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoenvironment: move "branch.autoSetupMerge" into `struct repo_config_values`
Olamide Caleb Bello [Mon, 16 Feb 2026 16:38:27 +0000 (17:38 +0100)] 
environment: move "branch.autoSetupMerge" into `struct repo_config_values`

The config value `branch.autoSetupMerge` is parsed in
`git_default_branch_config()` and stored in the global variable
`git_branch_track`. This global variable can be overwritten
by another repository when multiple Git repos run in the the same process.

Move this value into `struct repo_config_values` in the_repository to
retain current behaviours and move towards libifying Git.
Since the variable is no longer a global variable, it has been renamed to
`branch_track` in the struct `repo_config_values`.

Suggested-by: Phillip Wood <phillip.wood123@gmail.com>
Mentored-by: Christian Couder <christian.couder@gmail.com>
Mentored-by: Usman Akinyemi <usmanakinyemi202@gmail.com>
Signed-off-by: Olamide Caleb Bello <belkid98@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoenvironment: stop using core.sparseCheckout globally
Olamide Caleb Bello [Mon, 16 Feb 2026 16:38:26 +0000 (17:38 +0100)] 
environment: stop using core.sparseCheckout globally

The config value `core.sparseCheckout` is parsed in
`git_default_core_config()` and stored globally in
`core_apply_sparse_checkout`. This could cause it to be overwritten
by another repository when different Git repositories run in the same
process.

Move the parsed value into `struct repo_config_values` in the_repository
to retain current behaviours and move towards libifying Git.

Suggested-by: Phillip Wood <phillip.wood123@gmail.com>
Mentored-by: Christian Couder <christian.couder@gmail.com>
Mentored-by: Usman Akinyemi <usmanakinyemi202@gmail.com>
Signed-off-by: Olamide Caleb Bello <belkid98@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoThe 7th batch
Junio C Hamano [Wed, 25 Feb 2026 18:49:04 +0000 (10:49 -0800)] 
The 7th batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoMerge branch 'ac/string-list-sort-u-and-tests'
Junio C Hamano [Wed, 25 Feb 2026 19:54:18 +0000 (11:54 -0800)] 
Merge branch 'ac/string-list-sort-u-and-tests'

Code clean-up using a new helper function introduced lately.

* ac/string-list-sort-u-and-tests:
  sparse-checkout: use string_list_sort_u

3 months agoMerge branch 'mc/tr2-process-ancestry-cleanup'
Junio C Hamano [Wed, 25 Feb 2026 19:54:18 +0000 (11:54 -0800)] 
Merge branch 'mc/tr2-process-ancestry-cleanup'

Add process ancestry data to trace2 on macOS to match what we
already do on Linux and Windows.  Also adjust the way Windows
implementation reports this information to match the other two.

* mc/tr2-process-ancestry-cleanup:
  t0213: add trace2 cmd_ancestry tests
  test-tool: extend trace2 helper with 400ancestry
  trace2: emit cmd_ancestry data for Windows
  trace2: refactor Windows process ancestry trace2 event
  build: include procinfo.c impl for macOS
  trace2: add macOS process ancestry tracing