]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
4 days agoMerge branch 'bc/sha1-256-interop-02' into seen seen
Junio C Hamano [Tue, 23 Dec 2025 14:12:52 +0000 (23:12 +0900)] 
Merge branch 'bc/sha1-256-interop-02' into seen

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
  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

4 days ago### CI
Junio C Hamano [Tue, 23 Dec 2025 14:12:52 +0000 (23:12 +0900)] 
### CI

4 days agoMerge branch 'cc/lop-filter-auto' into seen
Junio C Hamano [Tue, 23 Dec 2025 14:12:50 +0000 (23:12 +0900)] 
Merge branch 'cc/lop-filter-auto' into seen

* cc/lop-filter-auto:
  fetch-pack: wire up and enable auto filter logic
  promisor-remote: keep advertised filter in memory
  list-objects-filter-options: implement auto filter resolution
  list-objects-filter-options: support 'auto' mode for --filter
  doc: fetch: document `--filter=<filter-spec>` option
  fetch: make filter_options local to cmd_fetch()
  clone: make filter_options local to cmd_clone()
  promisor-remote: allow a client to store fields
  promisor-remote: refactor initialising field lists

4 days agoMerge branch 'ps/packfile-store-in-odb-source' into seen
Junio C Hamano [Tue, 23 Dec 2025 14:12:50 +0000 (23:12 +0900)] 
Merge branch 'ps/packfile-store-in-odb-source' into seen

The packfile_store data structure is moved from object store to odb
source.

Comments?

* ps/packfile-store-in-odb-source:
  packfile: move MIDX into packfile store
  packfile: refactor `find_pack_entry()` to work on the packfile store
  packfile: inline `find_kept_pack_entry()`
  packfile: only prepare owning store in `packfile_store_prepare()`
  packfile: only prepare owning store in `packfile_store_get_packs()`
  packfile: move packfile store into object source
  packfile: refactor misleading code when unusing pack windows
  packfile: refactor kept-pack cache to work with packfile stores
  packfile: pass source to `prepare_pack()`
  packfile: create store via its owning source

4 days agofetch-pack: wire up and enable auto filter logic
Christian Couder [Tue, 23 Dec 2025 11:11:13 +0000 (12:11 +0100)] 
fetch-pack: wire up and enable auto filter logic

Previous commits have set up an infrastructure for `--filter=auto` to
automatically prepare a partial clone filter based on what the server
advertised and the client accepted.

Using that infrastructure, let's now enable the `--filter=auto` option
in `git clone` and `git fetch` by setting `allow_auto_filter` to 1.

Note that these small changes mean that when `git clone --filter=auto`
or `git fetch --filter=auto` are used, "auto" is automatically saved
as the partial clone filter for the server on the client. Therefore
subsequent calls to `git fetch` on the client will automatically use
this "auto" mode even without `--filter=auto`.

Let's also set `allow_auto_filter` to 1 in `transport.c`, as the
transport layer must be able to accept the "auto" filter spec even if
the invoking command hasn't fully parsed it yet.

When an "auto" filter is requested, let's have the "fetch-pack.c" code
in `do_fetch_pack_v2()` compute a filter and send it to the server.

In `do_fetch_pack_v2()` the logic also needs to check for the
"promisor-remote" capability and call `promisor_remote_reply()` to
parse advertised remotes and populate the list of those accepted (and
their filters).

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 days agopromisor-remote: keep advertised filter in memory
Christian Couder [Tue, 23 Dec 2025 11:11:12 +0000 (12:11 +0100)] 
promisor-remote: keep advertised filter in memory

Currently, advertised filters are only kept in memory temporarily
during parsing, or persisted to disk if `promisor.storeFields`
contains 'partialCloneFilter'.

In a following commit though, we will add a `--filter=auto` option.
This option will enable the client to use the filters that the server
is suggesting for the promisor remotes the client accepts.

To use them even if `promisor.storeFields` is not configured, these
filters should be stored somewhere for the current session.

Let's add an `advertised_filter` field to `struct promisor_remote`
for that purpose.

To ensure that the filters are available in all cases,
filter_promisor_remote() captures them into a temporary list and
applies them to the `promisor_remote` structs after the potential
configuration reload.

Then the accepted remotes are marked as `accepted` in the repository
state. This ensures that subsequent calls to look up accepted remotes
(like in the filter construction below) actually find them.

In a following commit, we will add a `--filter=auto` option that will
enable a client to use the filters suggested by the server for the
promisor remotes the client accepted.

To enable the client to construct a filter spec based on these filters,
let's add a `promisor_remote_construct_filter(repo)` function.

This function:

- iterates over all accepted promisor remotes in the repository,
- collects the filters advertised for them (using `advertised_filter`
  which a previous commit added to `struct promisor_remote`), and
- generates a single filter spec for them (using the
  `list_objects_filter_combine()` function added by a previous commit).

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 days agolist-objects-filter-options: implement auto filter resolution
Christian Couder [Tue, 23 Dec 2025 11:11:11 +0000 (12:11 +0100)] 
list-objects-filter-options: implement auto filter resolution

In a following commit, we will need to aggregate filters from multiple
accepted promisor remotes into a single filter.

For that purpose, let's add a `list_objects_filter_combine()` helper
function that takes a list of filter specifications and combines them
into a single string. If multiple filters are provided, it constructs a
"combine:..." filter, ensuring that sub-filters are properly
URL-encoded using the existing `allow_unencoded` logic.

In a following commit, we will add a `--filter=auto` option that will
enable a client to use the filters suggested by the server for the
promisor remotes the client accepted.

To simplify the filter processing related to this new feature, let's
also add a small `list_objects_filter_resolve_auto()` function.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 days agolist-objects-filter-options: support 'auto' mode for --filter
Christian Couder [Tue, 23 Dec 2025 11:11:10 +0000 (12:11 +0100)] 
list-objects-filter-options: support 'auto' mode for --filter

In a following commit, we are going to allow passing "auto" as a
<filterspec> to the `--filter=<filterspec>` option, but only for some
commands. Other commands that support the `--filter=<filterspec>`
option should still die() when 'auto' is passed.

Let's set up the "list-objects-filter-options.{c,h}" infrastructure to
support that:

- Add a new `unsigned int allow_auto_filter : 1;` flag to
  `struct list_objects_filter_options` which specifies if "auto" is
  accepted or not.
- Change gently_parse_list_objects_filter() to parse "auto" if it's
  accepted.
- Make sure we die() if "auto" is combined with another filter.
- Update list_objects_filter_release() to preserve the
  allow_auto_filter flag, as this function is often called (via
  opt_parse_list_objects_filter) to reset the struct before parsing a
  new value.

Let's also update `list-objects-filter.c` to recognize the new
`LOFC_AUTO` choice. Since "auto" must be resolved to a concrete filter
before filtering actually begins, initializing a filter with
`LOFC_AUTO` is invalid and will trigger a BUG().

Note that ideally combining "auto" with "auto" could be allowed, but in
practice, it's probably not worth the added code complexity. And if we
really want it, nothing prevents us to allow it in future work.

If we ever want to give a meaning to combining "auto" with a different
filter too, nothing prevents us to do that in future work either.

While at it, let's add a new "u-list-objects-filter-options.c" file for
`struct list_objects_filter_options` related unit tests. For now it
only tests gently_parse_list_objects_filter() though.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 days agodoc: fetch: document `--filter=<filter-spec>` option
Christian Couder [Tue, 23 Dec 2025 11:11:09 +0000 (12:11 +0100)] 
doc: fetch: document `--filter=<filter-spec>` option

The `--filter=<filter-spec>` option is documented in most commands that
support it except `git fetch`.

Let's fix that and document that option properly in the same way as it
is already documented for `git clone`.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 days agofetch: make filter_options local to cmd_fetch()
Christian Couder [Tue, 23 Dec 2025 11:11:08 +0000 (12:11 +0100)] 
fetch: make filter_options local to cmd_fetch()

The `struct list_objects_filter_options filter_options` variable used
in "builtin/fetch.c" to store the parsed filters specified by
`--filter=<filterspec>` is currently a static variable global to the
file.

As we are going to use it more in a following commit, it could become a
bit less easy to understand how it's managed.

To avoid that, let's make it clear that it's owned by cmd_fetch() by
moving its definition into that function and making it non-static.

This requires passing a pointer to it through the prepare_transport(),
do_fetch(), backfill_tags(), fetch_one_setup_partial(), and fetch_one()
functions, but it's quite straightforward.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 days agoclone: make filter_options local to cmd_clone()
Christian Couder [Tue, 23 Dec 2025 11:11:07 +0000 (12:11 +0100)] 
clone: make filter_options local to cmd_clone()

The `struct list_objects_filter_options filter_options` variable used
in "builtin/clone.c" to store the parsed filters specified by
`--filter=<filterspec>` is currently a static variable global to the
file.

As we are going to use it more in a following commit, it could become
a bit less easy to understand how it's managed.

To avoid that, let's make it clear that it's owned by cmd_clone() by
moving its definition into that function and making it non-static.

The only additional change to make this work is to pass it as an
argument to checkout(). So it's a small quite cheap cleanup anyway.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 days agopromisor-remote: allow a client to store fields
Christian Couder [Tue, 23 Dec 2025 11:11:06 +0000 (12:11 +0100)] 
promisor-remote: allow a client to store fields

A previous commit allowed a server to pass additional fields through
the "promisor-remote" protocol capability after the "name" and "url"
fields, specifically the "partialCloneFilter" and "token" fields.

Another previous commit, c213820c51 (promisor-remote: allow a client
to check fields, 2025-09-08), has made it possible for a client to
decide if it accepts a promisor remote advertised by a server based
on these additional fields.

Often though, it would be interesting for the client to just store in
its configuration files these additional fields passed by the server,
so that it can use them when needed.

For example if a token is necessary to access a promisor remote, that
token could be updated frequently only on the server side and then
passed to all the clients through the "promisor-remote" capability,
avoiding the need to update it on all the clients manually.

Storing the token on the client side makes sure that the token is
available when the client needs to access the promisor remotes for a
lazy fetch.

In the same way, if it appears that it's better to use a different
filter to access a promisor remote, it could be helpful if the client
could automatically use it.

To allow this, let's introduce a new "promisor.storeFields"
configuration variable.

Like "promisor.checkFields" and "promisor.sendFields", it should
contain a comma or space separated list of field names. Only the
"partialCloneFilter" and "token" field names are supported for now.

When a server advertises a promisor remote, for example "foo", along
with for example "token=XXXXX" to a client, and on the client side
"promisor.storeFields" contains "token", then the client will store
XXXXX for the "remote.foo.token" variable in its configuration file
and reload its configuration so it can immediately use this new
configuration variable.

A message is emitted on stderr to warn users when the config is
changed.

Note that even if "promisor.acceptFromServer" is set to "all", a
promisor remote has to be already configured on the client side for
some of its config to be changed. In any case no new remote is
configured and no new URL is stored.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 days agopromisor-remote: refactor initialising field lists
Christian Couder [Tue, 23 Dec 2025 11:11:05 +0000 (12:11 +0100)] 
promisor-remote: refactor initialising field lists

In "promisor-remote.c", the fields_sent() and fields_checked()
functions serve similar purposes and contain a small amount of
duplicated code.

As we are going to add a similar function in a following commit,
let's refactor this common code into a new initialize_fields_list()
function.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 days agoMerge branch 'pc/lockfile-pid' into seen
Junio C Hamano [Tue, 23 Dec 2025 03:19:57 +0000 (12:19 +0900)] 
Merge branch 'pc/lockfile-pid' into seen

Allow recording process ID of the process that holds the lock next
to a lockfile for diagnosis.

* pc/lockfile-pid:
  lockfile: add PID file for debugging stale locks

5 days agoMerge branch 'ps/read-object-info-improvements' into seen
Junio C Hamano [Tue, 23 Dec 2025 03:19:57 +0000 (12:19 +0900)] 
Merge branch 'ps/read-object-info-improvements' into seen

The object-info API has been cleaned up.

Comments?

* ps/read-object-info-improvements:
  packfile: drop repository parameter from `packed_object_info()`
  packfile: skip unpacking object header for disk size requests
  packfile: disentangle return value of `packed_object_info()`
  packfile: always populate pack-specific info when reading object info
  packfile: extend `is_delta` field to allow for "unknown" state
  packfile: always declare object info to be OI_PACKED
  object-file: always set OI_LOOSE when reading object info

5 days agoMerge branch 'js/neuter-sideband' into seen
Junio C Hamano [Tue, 23 Dec 2025 03:19:56 +0000 (12:19 +0900)] 
Merge branch 'js/neuter-sideband' into seen

Invalidate control characters in sideband messages, to avoid
terminal state getting messed up.

Comments?
cf. <aS-D5lD2Kk6BHNIl@fruit.crustytoothpaste.net>

* js/neuter-sideband:
  sideband: add options to allow more control sequences to be passed through
  sideband: do allow ANSI color sequences by default
  sideband: introduce an "escape hatch" to allow control characters
  sideband: mask control characters

5 days agoMerge branch 'lo/repo-info-keys' into seen
Junio C Hamano [Tue, 23 Dec 2025 03:19:55 +0000 (12:19 +0900)] 
Merge branch 'lo/repo-info-keys' into seen

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

Comments?

* lo/repo-info-keys:
  repo: add new flag --keys to git-repo-info
  repo: add a default output format to enum output_format

5 days agoMerge branch 'sp/shallow-time-boundary' into seen
Junio C Hamano [Tue, 23 Dec 2025 03:19:55 +0000 (12:19 +0900)] 
Merge branch 'sp/shallow-time-boundary' into seen

The set of shallow boundary "git clone --shallow-since" leaves
contained commits that are not on the boundary, which has been
corrected.

Comments?

* sp/shallow-time-boundary:
  shallow: set borders which are all reachable after clone shallow since

5 days agoMerge branch 'dw/config-global-list' into seen
Junio C Hamano [Tue, 23 Dec 2025 03:19:55 +0000 (12:19 +0900)] 
Merge branch 'dw/config-global-list' into seen

"git config --list --global", unlike "git config --list", did not
consult both of the two possible per-user sources of the
configuration files, i.e. $HOME/.gitconfig and the XDG one, which
has been corrected.

* dw/config-global-list:
  config: keep bailing on unreadable global files
  config: read global scope via config_sequence
  config: test home and xdg files in `list --global`
  cleanup_path: force forward slashes on Windows

5 days agoMerge branch 'je/doc-reset' into seen
Junio C Hamano [Tue, 23 Dec 2025 03:19:55 +0000 (12:19 +0900)] 
Merge branch 'je/doc-reset' into seen

Documentation updates.

* je/doc-reset:
  doc: git-reset: clarify `git reset <pathspec>`
  doc: git-reset: clarify `git reset [mode]`
  doc: git-reset: clarify intro
  doc: git-reset: reorder the forms

5 days agoMerge branch 'lc/rebase-trailer' into seen
Junio C Hamano [Tue, 23 Dec 2025 03:19:54 +0000 (12:19 +0900)] 
Merge branch 'lc/rebase-trailer' into seen

Refactor code paths to run "interpret-trailers" from "git
commit/tag" and use it in "git rebase".

* lc/rebase-trailer:
  rebase: support --trailer
  trailer: append trailers in-process and drop the fork to `interpret-trailers`
  trailer: move process_trailers to trailer.h
  interpret-trailers: factor out buffer-based processing to process_trailers()

5 days agoMerge branch 'ms/doc-worktree-side-by-side' into seen
Junio C Hamano [Tue, 23 Dec 2025 03:19:54 +0000 (12:19 +0900)] 
Merge branch 'ms/doc-worktree-side-by-side' into seen

Document "git worktree add" and use of out-of-tree worktrees with
examples.

* ms/doc-worktree-side-by-side:
  doc: git-worktree: Add side by side branch checkout example
  doc: git-worktree: Link to examples

5 days agoMerge branch 'jc/exclude-with-gitignore' into seen
Junio C Hamano [Tue, 23 Dec 2025 03:19:54 +0000 (12:19 +0900)] 
Merge branch 'jc/exclude-with-gitignore' into seen

"git add ':(exclude)foo.o'" is clearly a request not to add 'foo.o',
but the command complained about listing an ignored path foo.o on
the command line, which has been corrected.

Comments?

* jc/exclude-with-gitignore:
  dir.c: do not be fooled by :(exclude) pathspec elements

5 days agoMerge branch 'tb/incremental-midx-part-3.2' into seen
Junio C Hamano [Tue, 23 Dec 2025 03:19:53 +0000 (12:19 +0900)] 
Merge branch 'tb/incremental-midx-part-3.2' into seen

Further work on incremental repacking using MIDX/bitmap

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

5 days agoMerge branch 'ps/clar-integers' into seen
Junio C Hamano [Tue, 23 Dec 2025 03:19:53 +0000 (12:19 +0900)] 
Merge branch 'ps/clar-integers' into seen

Import newer version of "clar", unit testing framework.

Comments?

* ps/clar-integers:
  gitattributes: disable blank-at-eof errors for clar test expectations
  t/unit-tests: demonstrate use of integer comparison assertions
  t/unit-tests: update clar to 39f11fe

5 days agoMerge branch 'kh/replay-invalid-onto-advance' into seen
Junio C Hamano [Tue, 23 Dec 2025 03:19:47 +0000 (12:19 +0900)] 
Merge branch 'kh/replay-invalid-onto-advance' into seen

* kh/replay-invalid-onto-advance:
  t3650: add more regression tests for failure conditions
  replay: die descriptively when invalid commit-ish

5 days agot3650: add more regression tests for failure conditions
Kristoffer Haugsbakk [Mon, 22 Dec 2025 22:04:43 +0000 (23:04 +0100)] 
t3650: add more regression tests for failure conditions

There isn’t much test coverage for basic failure conditions. Let’s add
a few more since these are simple to write and remove if they become
obsolete.

Signed-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 days agoreplay: die descriptively when invalid commit-ish
Kristoffer Haugsbakk [Mon, 22 Dec 2025 22:04:42 +0000 (23:04 +0100)] 
replay: die descriptively when invalid commit-ish

Giving an invalid commit-ish to `--onto` or `--advance` makes
git-replay(1) fail with:

    fatal: Replaying down to root commit is not supported yet!

Going backwards from this point:

1. `onto` is `NULL` from `determine_replay_mode`;
2. that function in turn calls `peel_committish`; and
3. here we return `NULL` if `repo_get_oid` fails.

Let’s die immediately with a descriptive error message instead.

Doing this also provides us with a descriptive error if we “forget” to
provide an argument to `--onto` (but we really do unintentionally):[1]

    $ git replay --onto ^main topic1
    fatal: '^main' is not a valid commit-ish

† 1: The argument to `--onto` is mandatory and the option parser accepts
     both `--onto=<name>` (stuck form) and `--onto name`. The latter
     form makes it easy to unintentionally pass something to the option
     when you really meant to pass a positional argument.

Signed-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 days agoMerge branch 'sb/bundle-uri-without-uri' into jch
Junio C Hamano [Tue, 23 Dec 2025 02:33:39 +0000 (11:33 +0900)] 
Merge branch 'sb/bundle-uri-without-uri' into jch

Diagnose invalid bundle-URI that lack the URI entry, instead of
crashing.

* sb/bundle-uri-without-uri:
  bundle-uri: validate that bundle entries have a uri

5 days agoMerge branch 'sb/doc-worktree-prune-expire-improvement' into jch
Junio C Hamano [Tue, 23 Dec 2025 02:33:39 +0000 (11:33 +0900)] 
Merge branch 'sb/doc-worktree-prune-expire-improvement' into jch

The help text and the documentation for the "--expire" option of
"git worktree [list|prune]" have been improved.

* sb/doc-worktree-prune-expire-improvement:
  worktree: use 'prune' instead of 'expire' in help text
  worktree: clarify --expire applies to missing worktrees

5 days agoMerge branch 'js/symlink-windows' into jch
Junio C Hamano [Tue, 23 Dec 2025 02:33:38 +0000 (11:33 +0900)] 
Merge branch 'js/symlink-windows' into jch

Upstream symbolic link support on Windows from Git-for-Windows.

* js/symlink-windows:
  mingw: special-case index entries for symlinks with buggy size
  mingw: emulate `stat()` a little more faithfully
  mingw: try to create symlinks without elevated permissions
  mingw: add support for symlinks to directories
  mingw: implement basic `symlink()` functionality (file symlinks only)
  mingw: implement `readlink()`
  mingw: allow `mingw_chdir()` to change to symlink-resolved directories
  mingw: support renaming symlinks
  mingw: handle symlinks to directories in `mingw_unlink()`
  mingw: add symlink-specific error codes
  mingw: change default of `core.symlinks` to false
  mingw: factor out the retry logic
  mingw: compute the correct size for symlinks in `mingw_lstat()`
  mingw: teach dirent about symlinks
  mingw: let `mingw_lstat()` error early upon problems with reparse points
  mingw: drop the separate `do_lstat()` function
  mingw: implement `stat()` with symlink support
  mingw: don't call `GetFileAttributes()` twice in `mingw_lstat()`

5 days agoMerge branch 'js/prep-symlink-windows' into jch
Junio C Hamano [Tue, 23 Dec 2025 02:33:38 +0000 (11:33 +0900)] 
Merge branch 'js/prep-symlink-windows' into jch

Further preparation to upstream symbolic link support on Windows.

* js/prep-symlink-windows:
  trim_last_path_component(): avoid hard-coding the directory separator
  strbuf_readlink(): support link targets that exceed PATH_MAX
  strbuf_readlink(): avoid calling `readlink()` twice in corner-cases
  init: do parse _all_ core.* settings early
  mingw: do resolve symlinks in `getcwd()`

5 days agoMerge branch 'ap/http-probe-rpc-use-auth' into jch
Junio C Hamano [Tue, 23 Dec 2025 02:33:37 +0000 (11:33 +0900)] 
Merge branch 'ap/http-probe-rpc-use-auth' into jch

* ap/http-probe-rpc-use-auth:
  remote-curl: Use auth for probe_rpc() requests too

5 days agoMerge branch 'pw/replay-drop-empty' into jch
Junio C Hamano [Tue, 23 Dec 2025 02:33:37 +0000 (11:33 +0900)] 
Merge branch 'pw/replay-drop-empty' into jch

"git replay" is taught to drop commits that become empty (not the
ones that are empty in the original).

* pw/replay-drop-empty:
  replay: drop commits that become empty
  builtin/history: implement "split" subcommand
  cache-tree: allow writing in-memory index as tree
  add-patch: allow disabling editing of hunks
  add-patch: add support for in-memory index patching
  add-patch: remove dependency on "add-interactive" subsystem
  add-patch: split out `struct interactive_options`
  add-patch: split out header from "add-interactive.h"
  builtin/history: implement "reword" subcommand
  builtin: add new "history" command
  replay: stop using `the_repository`
  replay: extract logic to pick commits
  wt-status: provide function to expose status for trees

5 days agoMerge branch 'sb/doc-update-ref-markup-fix' into jch
Junio C Hamano [Tue, 23 Dec 2025 02:33:37 +0000 (11:33 +0900)] 
Merge branch 'sb/doc-update-ref-markup-fix' into jch

Doc mark-up fix.

Will merget to 'next'.

* sb/doc-update-ref-markup-fix:
  doc: fix `update-ref` `symref-create` formatting

5 days agoMerge branch 'yc/histogram-hunk-shift-fix' into jch
Junio C Hamano [Tue, 23 Dec 2025 02:33:36 +0000 (11:33 +0900)] 
Merge branch 'yc/histogram-hunk-shift-fix' into jch

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

Comments?

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

5 days agoMerge branch 'ps/odb-misc-fixes' into jch
Junio C Hamano [Tue, 23 Dec 2025 02:33:36 +0000 (11:33 +0900)] 
Merge branch 'ps/odb-misc-fixes' into jch

Miscellaneous fixes on object database layer.

Comments?

* ps/odb-misc-fixes:
  odb: properly close sources before freeing them
  builtin/gc: fix condition for whether to write commit graphs

5 days agoMerge branch 'jk/parse-int' into jch
Junio C Hamano [Tue, 23 Dec 2025 02:33:36 +0000 (11:33 +0900)] 
Merge branch 'jk/parse-int' into jch

Introduce a more robust way to parse a decimal integer stored in a
piece of memory that is not necessarily terminated with NUL (which
Asan strict-string-check complains even when use of strtol() is
safe due to varified existence of whitespace after the digits).

* jk/parse-int:
  fsck: use parse_unsigned_from_buf() for parsing timestamp
  cache-tree: use parse_int_from_buf()
  parse: add functions for parsing from non-string buffers
  parse: prefer bool to int for boolean returns

5 days agoMerge branch 'tc/last-modified-options-cleanup' into jch
Junio C Hamano [Tue, 23 Dec 2025 02:33:35 +0000 (11:33 +0900)] 
Merge branch 'tc/last-modified-options-cleanup' into jch

The "-z" and "--max-depth" documentation (and implementation of
"-z") in the "git last-modified" command have been updated.

* tc/last-modified-options-cleanup:
  fixup! last-modified: document option --max-depth
  last-modified: document how depth is handled better
  last-modified: document option --max-depth
  last-modified: handle and document NUL termination

5 days agoMerge branch 'kn/ref-location' into jch
Junio C Hamano [Tue, 23 Dec 2025 02:33:35 +0000 (11:33 +0900)] 
Merge branch 'kn/ref-location' into jch

A mechanism to specify what reference backend to use and store
references in which directory is introduced, which would likely to
be useful during ref migration.

Comments?

* kn/ref-location:
  refs: add GIT_REF_URI to specify reference backend and directory
  refs: support obtaining ref_store for given dir

5 days agoMerge branch 'wm/complete-git-short-opts' into jch
Junio C Hamano [Tue, 23 Dec 2025 02:33:35 +0000 (11:33 +0900)] 
Merge branch 'wm/complete-git-short-opts' into jch

The command line completion script (in contrib/) learned to
complete "git -<TAB>" to give single-letter options like "-C".

* wm/complete-git-short-opts:
  completion: complete "git -<TAB>" with short options

5 days agoMerge branch 'ar/submodule-gitdir-tweak' into jch
Junio C Hamano [Tue, 23 Dec 2025 02:33:35 +0000 (11:33 +0900)] 
Merge branch 'ar/submodule-gitdir-tweak' into jch

Avoid local submodule repository directory paths overlapping with
each other by encoding submodule names before using them as path
components.

Comments?

* ar/submodule-gitdir-tweak:
  submodule: detect conflicts with existing gitdir configs
  submodule: hash the submodule name for the gitdir path
  submodule: fix case-folding gitdir filesystem collisions
  submodule--helper: fix filesystem collisions by encoding gitdir paths
  builtin/credential-store: move is_rfc3986_unreserved to url.[ch]
  submodule--helper: add gitdir migration command
  submodule: allow runtime enabling extensions.submodulePathConfig
  submodule: introduce extensions.submodulePathConfig
  builtin/submodule--helper: add gitdir command
  submodule: always validate gitdirs inside submodule_name_to_gitdir
  submodule--helper: use submodule_name_to_gitdir in add_submodule

5 days agoMerge branch 'ja/doc-synopsis-style-more' into jch
Junio C Hamano [Tue, 23 Dec 2025 02:33:34 +0000 (11:33 +0900)] 
Merge branch 'ja/doc-synopsis-style-more' into jch

More doc style updates.

* ja/doc-synopsis-style-more:
  doc: convert git-remote to synopsis style
  doc: convert git stage to use synopsis block
  doc: convert git-status tables to AsciiDoc format
  doc: convert git-status to synopsis style
  doc: fix t0450-txt-doc-vs-help to select only first synopsis block

5 days agoMerge branch 'rs/macos-iconv-workaround' into jch
Junio C Hamano [Tue, 23 Dec 2025 02:33:34 +0000 (11:33 +0900)] 
Merge branch 'rs/macos-iconv-workaround' into jch

Workaround the "iconv" shipped as part of macOS, which is broken
handling stateful ISO/IEC 2022 encoded strings.

Comments?

* rs/macos-iconv-workaround:
  macOS: use iconv from Homebrew if present
  macOS: make Homebrew use configurable

5 days agoMerge branch 'ar/run-command-hook' into jch
Junio C Hamano [Tue, 23 Dec 2025 02:33:34 +0000 (11:33 +0900)] 
Merge branch 'ar/run-command-hook' into jch

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

* ar/run-command-hook:
  receive-pack: convert receive hooks to hook API
  receive-pack: convert update hooks to new API
  hooks: allow callers to capture output
  run-command: allow capturing of collated output
  hook: allow overriding the ungroup option
  reference-transaction: use hook API instead of run-command
  transport: convert pre-push to hook API
  hook: convert 'post-rewrite' hook in sequencer.c to hook API
  hook: provide stdin via callback
  run-command: add stdin callback for parallelization
  run-command: add first helper for pp child states

5 days ago### match next
Junio C Hamano [Tue, 23 Dec 2025 02:33:34 +0000 (11:33 +0900)] 
### match next

5 days agoMerge branch 'jk/test-curl-updates' into jch
Junio C Hamano [Tue, 23 Dec 2025 02:33:33 +0000 (11:33 +0900)] 
Merge branch 'jk/test-curl-updates' into jch

Update HTTP tests to adjust for changes in curl 8.18.0

* jk/test-curl-updates:
  t5563: add missing end-of-line in HTTP header
  t5551: handle trailing slashes in expected cookies output

5 days agoMerge branch 'jc/object-read-stream-fix' into jch
Junio C Hamano [Tue, 23 Dec 2025 02:33:33 +0000 (11:33 +0900)] 
Merge branch 'jc/object-read-stream-fix' into jch

Fix a performance regression in recently graduated topic.

* jc/object-read-stream-fix:
  odb: do not use "blank" substitute for NULL

5 days agoMerge branch 'js/test-func-comment-fix' into jch
Junio C Hamano [Tue, 23 Dec 2025 02:33:33 +0000 (11:33 +0900)] 
Merge branch 'js/test-func-comment-fix' into jch

Comment fix.

* js/test-func-comment-fix:
  test_detect_ref_format: fix comment

5 days agoMerge branch 'gf/clear-path-cache-cleanup' into jch
Junio C Hamano [Tue, 23 Dec 2025 02:33:32 +0000 (11:33 +0900)] 
Merge branch 'gf/clear-path-cache-cleanup' into jch

Code clean-up.

* gf/clear-path-cache-cleanup:
  repository: remove duplicate free of cache->squash_msg

5 days agoMerge branch 'gf/maintenance-is-needed-fix' into jch
Junio C Hamano [Tue, 23 Dec 2025 02:33:32 +0000 (11:33 +0900)] 
Merge branch 'gf/maintenance-is-needed-fix' into jch

Brown-paper-bag fix to a recently graduated
'kn/maintenance-is-needed' topic.

* gf/maintenance-is-needed-fix:
  refs: dereference the value of the required pointer

5 days agoMerge branch 'dk/ci-rust-fix' into jch
Junio C Hamano [Tue, 23 Dec 2025 02:33:31 +0000 (11:33 +0900)] 
Merge branch 'dk/ci-rust-fix' into jch

Build fix.

* dk/ci-rust-fix:
  rust: build correctly without GNU sed

5 days agoMerge branch 'mh/doc-core-attributesfile' into jch
Junio C Hamano [Tue, 23 Dec 2025 02:33:31 +0000 (11:33 +0900)] 
Merge branch 'mh/doc-core-attributesfile' into jch

Doc update.

* mh/doc-core-attributesfile:
  docs: note the type of core.attributesfile

5 days agoMerge branch 'ps/repack-avoid-noop-midx-rewrite' into jch
Junio C Hamano [Tue, 23 Dec 2025 02:33:31 +0000 (11:33 +0900)] 
Merge branch 'ps/repack-avoid-noop-midx-rewrite' into jch

Even when there is no changes in the packfile and no need to
recompute bitmaps, "git repack" recomputed and updated the MIDX
file, which has been corrected.

* ps/repack-avoid-noop-midx-rewrite:
  midx-write: skip rewriting MIDX with `--stdin-packs` unless needed
  midx-write: extract function to test whether MIDX needs updating
  midx: fix `BUG()` when getting preferred pack without a reverse index

5 days agoMerge branch 'js/test-symlink-windows' into jch
Junio C Hamano [Tue, 23 Dec 2025 02:33:30 +0000 (11:33 +0900)] 
Merge branch 'js/test-symlink-windows' into jch

Prepare test suite for Git for Windows that supports symbolic
links.

* js/test-symlink-windows:
  t7800: work around the MSYS path conversion on Windows
  t6423: introduce Windows-specific handling for symlinking to /dev/null
  t1305: skip symlink tests that do not apply to Windows
  t1006: accommodate for symlink support in MSYS2
  t0600: fix incomplete prerequisite for a test case
  t0301: another fix for Windows compatibility
  t0001: handle `diff --no-index` gracefully
  mingw: special-case `open(symlink, O_CREAT | O_EXCL)`
  apply: symbolic links lack a "trustable executable bit"
  t9700: accommodate for Windows paths

5 days agoMerge branch 'jt/doc-rev-list-filter-provided-objects' into jch
Junio C Hamano [Tue, 23 Dec 2025 02:33:30 +0000 (11:33 +0900)] 
Merge branch 'jt/doc-rev-list-filter-provided-objects' into jch

Document "rev-list --filter-provided-objects" better.

* jt/doc-rev-list-filter-provided-objects:
  docs: clarify git-rev-list(1) --filter behavior

5 days agoMerge branch 'jt/repo-struct-more-objinfo' into jch
Junio C Hamano [Tue, 23 Dec 2025 02:33:30 +0000 (11:33 +0900)] 
Merge branch 'jt/repo-struct-more-objinfo' into jch

More object database related information are shown in "git repo
structure" output.

* jt/repo-struct-more-objinfo:
  builtin/repo: add object disk size info to structure table
  builtin/repo: add disk size info to keyvalue stucture output
  builtin/repo: add inflated object info to structure table
  builtin/repo: add inflated object info to keyvalue structure output
  builtin/repo: humanise count values in structure output
  strbuf: split out logic to humanise byte values
  builtin/repo: group per-type object values into struct

5 days agoMerge branch 'ap/packfile-promisor-object-optim' into jch
Junio C Hamano [Tue, 23 Dec 2025 02:33:30 +0000 (11:33 +0900)] 
Merge branch 'ap/packfile-promisor-object-optim' into jch

The code path that enumerates promisor objects have been optimized
to skip pointlessly parsing blob objects.

* ap/packfile-promisor-object-optim:
  packfile: skip hash checks in add_promisor_object()
  object: apply skip_hash and discard_tree optimizations to unknown blobs too

5 days agoMerge branch 'ja/doc-misc-fixes' into jch
Junio C Hamano [Tue, 23 Dec 2025 02:33:30 +0000 (11:33 +0900)] 
Merge branch 'ja/doc-misc-fixes' into jch

Various documentation fixes.

* ja/doc-misc-fixes:
  doc: correct minor wording issues
  doc: fix asciidoc markup issues in several files

5 days agoMerge branch 'jc/doc-commit-signoff-config' into jch
Junio C Hamano [Tue, 23 Dec 2025 02:33:29 +0000 (11:33 +0900)] 
Merge branch 'jc/doc-commit-signoff-config' into jch

Documentation update.

* jc/doc-commit-signoff-config:
  signoff-option: linkify the reference to gitfaq
  commit: document that $command.signoff will not be added

5 days agoMerge branch 'jc/c99-fam' into jch
Junio C Hamano [Tue, 23 Dec 2025 02:33:29 +0000 (11:33 +0900)] 
Merge branch 'jc/c99-fam' into jch

Require C99 style flexible array member support from all platforms.

* jc/c99-fam:
  FLEX_ARRAY: require platforms to support the C99 syntax

5 days agoThe 12th batch main master
Junio C Hamano [Tue, 23 Dec 2025 01:37:41 +0000 (10:37 +0900)] 
The 12th batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 days agoMerge branch 'kn/fix-fetch-backfill-tag-with-batched-ref-updates'
Junio C Hamano [Tue, 23 Dec 2025 02:33:17 +0000 (11:33 +0900)] 
Merge branch 'kn/fix-fetch-backfill-tag-with-batched-ref-updates'

"git fetch" that involves fetching tags, when a tag being fetched
needs to overwrite existing one, failed to fetch other tags, which
has been corrected.

* kn/fix-fetch-backfill-tag-with-batched-ref-updates:
  fetch: fix failed batched updates skipping operations
  fetch: fix non-conflicting tags not being committed
  fetch: extract out reference committing logic

5 days agoMerge branch 'rs/diff-files-r-find-copies-fix'
Junio C Hamano [Tue, 23 Dec 2025 02:33:16 +0000 (11:33 +0900)] 
Merge branch 'rs/diff-files-r-find-copies-fix'

"git diff-files -R --find-copies-harder" has been taught to use
the potential copy sources from the index correctly.

* rs/diff-files-r-find-copies-fix:
  diff-files: fix copy detection

5 days agoMerge branch 'jc/memzero-array'
Junio C Hamano [Tue, 23 Dec 2025 02:33:16 +0000 (11:33 +0900)] 
Merge branch 'jc/memzero-array'

Further application of MEMZERO_ARRAY() macro to the rest of the
code base.

* jc/memzero-array:
  cocci: use MEMZERO_ARRAY() a bit more
  coccicheck: emit the contents of cocci patch

5 days agoMerge branch 'tc/memzero-array'
Junio C Hamano [Tue, 23 Dec 2025 02:33:16 +0000 (11:33 +0900)] 
Merge branch 'tc/memzero-array'

MEMZERO_ARRAY() helper is introduced to avoid clearing only the
first N bytes of an N-element array whose elements are larger than
a byte.

* tc/memzero-array:
  contrib/coccinelle: pass include paths to spatch(1)
  git-compat-util: introduce MEMZERO_ARRAY() macro

5 days agoMerge branch 'jc/completion-no-single-letter-options'
Junio C Hamano [Tue, 23 Dec 2025 02:33:15 +0000 (11:33 +0900)] 
Merge branch 'jc/completion-no-single-letter-options'

In-code comment update to clarify that single-letter options are
outside of the scope of command line completion script.

* jc/completion-no-single-letter-options:
  completion: clarify support for short options and arguments

5 days agoMerge branch 'jc/submodule-add'
Junio C Hamano [Tue, 23 Dec 2025 02:33:15 +0000 (11:33 +0900)] 
Merge branch 'jc/submodule-add'

"git submodule add" to add a submodule under <name> segfaulted,
when a submodule.<name>.something is already in .gitmodules file
without defining where its submodule.<name>.path is, which has been
corrected.

* jc/submodule-add:
  submodule add: sanity check existing .gitmodules

5 days agoMerge branch 'ds/doc-scalar-config'
Junio C Hamano [Tue, 23 Dec 2025 02:33:15 +0000 (11:33 +0900)] 
Merge branch 'ds/doc-scalar-config'

Documentation updates.

* ds/doc-scalar-config:
  scalar: document config settings
  scalar: alphabetize and simplify config
  scalar: remove stale config values
  scalar: use index.skipHash=true for performance
  scalar: annotate config file with "set by scalar"

6 days agoThe 11th batch
Junio C Hamano [Mon, 22 Dec 2025 04:46:36 +0000 (13:46 +0900)] 
The 11th batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 days agoMerge branch 'rs/t4014-git-version-string-fix'
Junio C Hamano [Mon, 22 Dec 2025 05:57:49 +0000 (14:57 +0900)] 
Merge branch 'rs/t4014-git-version-string-fix'

Test fix.

* rs/t4014-git-version-string-fix:
  t4014: support Git version strings with spaces

6 days agoMerge branch 'kj/pull-options-decl-cleanup'
Junio C Hamano [Mon, 22 Dec 2025 05:57:48 +0000 (14:57 +0900)] 
Merge branch 'kj/pull-options-decl-cleanup'

Code clean-up.

* kj/pull-options-decl-cleanup:
  pull: move options[] array into function scope

6 days agoMerge branch 'jc/macports-darwinports'
Junio C Hamano [Mon, 22 Dec 2025 05:57:48 +0000 (14:57 +0900)] 
Merge branch 'jc/macports-darwinports'

Makefile in-comment doc update.

* jc/macports-darwinports:
  Makefile: help macOS novices by mentioning MacPorts

6 days agoMerge branch 'rs/replay-wrong-onto-fix'
Junio C Hamano [Mon, 22 Dec 2025 05:57:48 +0000 (14:57 +0900)] 
Merge branch 'rs/replay-wrong-onto-fix'

"git replay --onto=<commit> ...", when <commit> is mistyped,
started to segfault with recent change, which has been corrected.

* rs/replay-wrong-onto-fix:
  replay: move onto NULL check before first use

6 days agoMerge branch 'kh/doc-replay-updates'
Junio C Hamano [Mon, 22 Dec 2025 05:57:48 +0000 (14:57 +0900)] 
Merge branch 'kh/doc-replay-updates'

"git replay" documentation updates.

* kh/doc-replay-updates:
  doc: replay: link section using markup
  replay: improve --contained and add to doc
  doc: replay: mention no output on conflicts

6 days agoMerge branch 'ps/odb-alternates-object-sources'
Junio C Hamano [Mon, 22 Dec 2025 05:57:48 +0000 (14:57 +0900)] 
Merge branch 'ps/odb-alternates-object-sources'

Code refactoring around alternate object store.

* ps/odb-alternates-object-sources:
  odb: write alternates via sources
  odb: read alternates via sources
  odb: drop forward declaration of `read_info_alternates()`
  odb: remove mutual recursion when parsing alternates
  odb: stop splitting alternate in `odb_add_to_alternates_file()`
  odb: move computation of normalized objdir into `alt_odb_usable()`
  odb: resolve relative alternative paths when parsing
  odb: refactor parsing of alternates to be self-contained

7 days agosubmodule: detect conflicts with existing gitdir configs
Adrian Ratiu [Sat, 20 Dec 2025 10:15:28 +0000 (12:15 +0200)] 
submodule: detect conflicts with existing gitdir configs

Credit goes to Emily and Josh for testing and noticing a corner-case
which caused conflicts with existing gitdir configs to silently pass
validation, then fail later in add_submodule() with a cryptic error:

fatal: A git directory for 'nested%2fsub' is found locally with remote(s):
  origin /.../trash directory.t7425-submodule-gitdir-path-extension/sub

This change ensures the validation step checks existing gitdirs for
conflicts. We only have to do this for submodules having gitdirs,
because those without submodule.%s.gitdir need to be migrated and
will throw an error earlier in the submodule codepath.

Quoting Josh:
 My testing setup has been as follows:
 * Using our locally-built Git with our downstream patch of [1] included:
   * create a repo "sub"
   * create a repo "super"
   * In "super":
     * mkdir nested
     * git submodule add ../sub nested/sub
     * Verify that the submodule's gitdir is .git/modules/nested%2fsub
 * Using a build of git from upstream `next` plus this series:
   * git config set --global extensions.submodulepathconfig true
   * git clone --recurse-submodules super super2
   * create a repo "nested%2fsub"
   * In "super2":
     * git submodule add ../nested%2fsub

At this point I'd expect the collision detection / encoding to take
effect, but instead I get the error listed above.
End quote

Suggested-by: Josh Steadmon <steadmon@google.com>
Signed-off-by: Adrian Ratiu <adrian.ratiu@collabora.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 days agosubmodule: hash the submodule name for the gitdir path
Adrian Ratiu [Sat, 20 Dec 2025 10:15:27 +0000 (12:15 +0200)] 
submodule: hash the submodule name for the gitdir path

If none of the previous plain-text / encoding / derivation steps work
and case 2.4 is reached, then try a hash of the submodule name to see
if that can be a valid gitdir before giving up and throwing an error.

This is a "last resort" type of measure to avoid conflicts since it
loses the human readability of the gitdir path. This logic will be
reached in rare cases, as can be seen in the test we added.

Signed-off-by: Adrian Ratiu <adrian.ratiu@collabora.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 days agosubmodule: fix case-folding gitdir filesystem collisions
Adrian Ratiu [Sat, 20 Dec 2025 10:15:26 +0000 (12:15 +0200)] 
submodule: fix case-folding gitdir filesystem collisions

Add a new check when extension.submodulePathConfig is enabled, to
detect and prevent case-folding filesystem colisions. When this
new check is triggered, a stricter casefolding aware URI encoding
is used to percent-encode uppercase characters.

By using this check/retry mechanism the uppercase encoding is
only applied when necessary, so case-sensitive filesystems are
not affected.

Signed-off-by: Adrian Ratiu <adrian.ratiu@collabora.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 days agosubmodule--helper: fix filesystem collisions by encoding gitdir paths
Adrian Ratiu [Sat, 20 Dec 2025 10:15:25 +0000 (12:15 +0200)] 
submodule--helper: fix filesystem collisions by encoding gitdir paths

Fix nested filesystem collisions by url-encoding gitdir paths stored
in submodule.%s.gitdir, when extensions.submodulePathConfig is enabled.

Credit goes to Junio and Patrick for coming up with this design: the
encoding is only applied when necessary, to newly added submodules.

Existing modules don't need the encoding because git already errors
out when detecting nested gitdirs before this patch.

This commit adds the basic url-encoding and some tests. Next commits
extend the encode -> validate -> retry loop to fix more conflicts.

Suggested-by: Junio C Hamano <gitster@pobox.com>
Suggested-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Adrian Ratiu <adrian.ratiu@collabora.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 days agobuiltin/credential-store: move is_rfc3986_unreserved to url.[ch]
Adrian Ratiu [Sat, 20 Dec 2025 10:15:24 +0000 (12:15 +0200)] 
builtin/credential-store: move is_rfc3986_unreserved to url.[ch]

is_rfc3986_unreserved() was moved to credential-store.c and was made
static by f89854362c (credential-store: move related functions to
credential-store file, 2023-06-06) under a correct assumption, at the
time, that it was the only place using it.

However now we need it to apply URL-encoding to submodule names when
constructing gitdir paths, to avoid conflicts, so bring it back as a
public function exposed via url.h, instead of the old helper path
(strbuf), which has nothing to do with 3986 encoding/decoding anymore.

This function will be used in subsequent commits which do the encoding.

Signed-off-by: Adrian Ratiu <adrian.ratiu@collabora.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 days agosubmodule--helper: add gitdir migration command
Adrian Ratiu [Sat, 20 Dec 2025 10:15:23 +0000 (12:15 +0200)] 
submodule--helper: add gitdir migration command

Manually running
"git config submodule.<name>.gitdir .git/modules/<name>"
for each submodule can be impractical, so add a migration command to
submodule--helper to automatically create configs for all submodules
as required by extensions.submodulePathConfig.

The command calls create_default_gitdir_config() which validates the
gitdir paths before adding the configs.

Suggested-by: Junio C Hamano <gitster@pobox.com>
Suggested-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Adrian Ratiu <adrian.ratiu@collabora.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 days agosubmodule: allow runtime enabling extensions.submodulePathConfig
Adrian Ratiu [Sat, 20 Dec 2025 10:15:22 +0000 (12:15 +0200)] 
submodule: allow runtime enabling extensions.submodulePathConfig

Add a new config `init.autoSetupSubmodulePathConfig` which allows
enabling `extensions.submodulePathConfig` for new submodules by
default (those created via git init or clone).

Important: setting init.autoSetupSubmodulePathConfig = true does
not globally enable `extensions.submodulePathConfig`. Existing
repositories will still have the extension disabled and will
require migration (for example via git submodule--helper command
added in the next commit).

Suggested-by: Patrick Steinhardt <ps@pks.im>
Suggested-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Adrian Ratiu <adrian.ratiu@collabora.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 days agosubmodule: introduce extensions.submodulePathConfig
Adrian Ratiu [Sat, 20 Dec 2025 10:15:21 +0000 (12:15 +0200)] 
submodule: introduce extensions.submodulePathConfig

The idea of this extension is to abstract away the submodule gitdir
path implementation: everyone is expected to use the config and not
worry about how the path is computed internally, either in git or
other implementations.

With this extension enabled, the submodule.<name>.gitdir repo config
becomes the single source of truth for all submodule gitdir paths.

The submodule.<name>.gitdir config is added automatically for all new
submodules when this extension is enabled.

Git will throw an error if the extension is enabled and a config is
missing, advising users how to migrate. Migration is manual for now.

E.g. to add a missing config entry for an existing "foo" module:
git config submodule.foo.gitdir .git/modules/foo

Suggested-by: Junio C Hamano <gitster@pobox.com>
Suggested-by: Phillip Wood <phillip.wood123@gmail.com>
Suggested-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Adrian Ratiu <adrian.ratiu@collabora.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 days agobuiltin/submodule--helper: add gitdir command
Adrian Ratiu [Sat, 20 Dec 2025 10:15:20 +0000 (12:15 +0200)] 
builtin/submodule--helper: add gitdir command

This exposes the gitdir name computed by submodule_name_to_gitdir()
internally, to make it easier for users and tests to interact with it.

Next commit will add a gitdir configuration, so this helper can also be
used to easily query that config or validate any gitdir path the user
sets (submodule_name_to_git_dir now runs the validation logic, since
our previous commit).

Based-on-patch-by: Brandon Williams <bwilliams.eng@gmail.com>
Signed-off-by: Adrian Ratiu <adrian.ratiu@collabora.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 days agosubmodule: always validate gitdirs inside submodule_name_to_gitdir
Adrian Ratiu [Sat, 20 Dec 2025 10:15:19 +0000 (12:15 +0200)] 
submodule: always validate gitdirs inside submodule_name_to_gitdir

Move the ad-hoc validation checks sprinkled across the source tree,
after calling submodule_name_to_gitdir() into the function proper,
which now always validates the gitdir before returning it.

This simplifies the API and helps to:
1. Avoid redundant validation calls after submodule_name_to_gitdir().
2. Avoid the risk of callers forgetting to validate.
3. Ensure gitdir paths provided by users via configs are always valid
   (config gitdir paths are added in a subsequent commit).

The validation function can still be called as many times as needed
outside submodule_name_to_gitdir(), for example we keep two calls
which are still required, to avoid parallel clone races by re-running
the validation in builtin/submodule-helper.c.

Signed-off-by: Adrian Ratiu <adrian.ratiu@collabora.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 days agosubmodule--helper: use submodule_name_to_gitdir in add_submodule
Adrian Ratiu [Sat, 20 Dec 2025 10:15:18 +0000 (12:15 +0200)] 
submodule--helper: use submodule_name_to_gitdir in add_submodule

While testing submodule gitdir path encoding, I noticed submodule--helper
is still using a hardcoded modules gitdir path leading to test failures.

Call the submodule_name_to_gitdir() helper instead, which was invented
exactly for this purpose and is already used by all the other locations
which work on gitdirs.

Also narrow the scope of the submod_gitdir_path variable which is not
used anymore in the updated "else" branch.

Signed-off-by: Adrian Ratiu <adrian.ratiu@collabora.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 days agodoc: convert git-remote to synopsis style
Jean-Noël Avila [Sat, 20 Dec 2025 19:16:27 +0000 (19:16 +0000)] 
doc: convert git-remote to synopsis style

- Switch the synopsis to a synopsis block which will automatically
  format placeholders in italics and keywords in monospace
- Use _<placeholder>_ instead of <placeholder> in the description
- Use `backticks` for keywords and more complex option
descriptions. The new rendering engine will apply synopsis rules to
these spans.
- also convert first sentences to imperative mood where applicable

Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 days agodoc: convert git stage to use synopsis block
Jean-Noël Avila [Sat, 20 Dec 2025 19:16:26 +0000 (19:16 +0000)] 
doc: convert git stage to use synopsis block

Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 days agodoc: convert git-status tables to AsciiDoc format
Jean-Noël Avila [Sat, 20 Dec 2025 19:16:25 +0000 (19:16 +0000)] 
doc: convert git-status tables to AsciiDoc format

Instead of plain text tables with hand formatting, take advantage of
asciidoc's table syntax to let the renderer do the heavy lifting and
make the tables more maintainable and translatable.

Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 days agodoc: convert git-status to synopsis style
Jean-Noël Avila [Sat, 20 Dec 2025 19:16:24 +0000 (19:16 +0000)] 
doc: convert git-status to synopsis style

Also convert unformatted lists to proper AsciiDoc lists.

Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 days agodoc: fix t0450-txt-doc-vs-help to select only first synopsis block
Jean-Noël Avila [Sat, 20 Dec 2025 19:16:23 +0000 (19:16 +0000)] 
doc: fix t0450-txt-doc-vs-help to select only first synopsis block

In case there are multiple synopsis blocks (declared with [synopsis]
or [verse] style) in the same file, the previous implementation was
incorrectly picking up text from all the blocks until the first empty
line. This commit modifies the sed command to stop processing upon
encountering the first empty line after the first block declaration,
thereby ensuring that only the intended block is captured.

Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 days agoworktree: use 'prune' instead of 'expire' in help text
Sam Bostock [Fri, 19 Dec 2025 18:16:09 +0000 (18:16 +0000)] 
worktree: use 'prune' instead of 'expire' in help text

Use 'prune' instead of 'expire' when describing the --expire option's
effect on missing worktrees, since the terminology is clearer.

Signed-off-by: Sam Bostock <sam@sambostock.ca>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 days agoworktree: clarify --expire applies to missing worktrees
Sam Bostock [Fri, 19 Dec 2025 18:16:08 +0000 (18:16 +0000)] 
worktree: clarify --expire applies to missing worktrees

The `--expire` option for `git worktree list` and `git worktree prune`
only affects worktrees whose working directory path no longer exists.
The help text did not make this clear, and the documentation
inconsistently used "unused" for prune but "missing" for list.

This updates the help text and documentation to consistently describe
these as "missing worktrees".

Signed-off-by: Sam Bostock <sam@sambostock.ca>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 days agodoc: correct minor wording issues
Jean-Noël Avila [Fri, 19 Dec 2025 18:54:16 +0000 (18:54 +0000)] 
doc: correct minor wording issues

* use imperative mood for consistency in options descriptions
* add missing parenthesis
* reword verbose phrase in git-repack.adoc

Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 days agodoc: fix asciidoc markup issues in several files
Jean-Noël Avila [Fri, 19 Dec 2025 18:54:15 +0000 (18:54 +0000)] 
doc: fix asciidoc markup issues in several files

* fix incorrect use of backticks for markup in
  git-checkout.adoc, git-worktree.adoc
* switch tabs to spaces in git-send-email.adoc list items

Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 days agobundle-uri: validate that bundle entries have a uri
Sam Bostock [Fri, 19 Dec 2025 16:01:46 +0000 (16:01 +0000)] 
bundle-uri: validate that bundle entries have a uri

When a bundle list config file has a typo like 'url' instead of 'uri',
or simply omits the uri field, the bundle entry is created but
bundle->uri remains NULL. This causes a segfault when copy_uri_to_file()
passes the NULL to starts_with().

Signed-off-by: Sam Bostock <sam@sambostock.ca>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 days agosignoff-option: linkify the reference to gitfaq
Junio C Hamano [Fri, 19 Dec 2025 12:51:01 +0000 (21:51 +0900)] 
signoff-option: linkify the reference to gitfaq

The GitFAQ is a proper manual page in the section 7, so refer to it
using the usual linkgit:stuff[7] syntax.

Helped-by: Kristoffer Haugsbakk
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 days agodoc: git-reset: clarify `git reset <pathspec>`
Julia Evans [Fri, 19 Dec 2025 00:23:56 +0000 (19:23 -0500)] 
doc: git-reset: clarify `git reset <pathspec>`

From user feedback:

- Continued confusion about the terms "tree-ish" and "pathspec"
- The word "hunks" is confusing folks, use "changes" instead.
- On the part about `git restore`, there were a few comments to the
  effect of "wait, this doesn't actually update any files? What? Why?"
  Be more direct that `git reset` does not update files: there's no
  obvious reason to suggest that folks use `git reset` followed by `git
  restore`, instead suggest just using `git restore`.

Continue avoiding the use of the word "reset" to
describe what "git reset" does.

Signed-off-by: Julia Evans <julia@jvns.ca>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: D. Ben Knoble <ben.knoble+github@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 days agodoc: git-reset: clarify `git reset [mode]`
Julia Evans [Fri, 19 Dec 2025 00:23:55 +0000 (19:23 -0500)] 
doc: git-reset: clarify `git reset [mode]`

From user feedback, there was some confusion about the differences
between the modes, including:

1. Sometimes it says "index" and sometimes "index file".
   Fix by replacing "index file" with "index".
2. Many comments about not being able to understand what `--merge` does.
   Fix by mentioning obscure situations, since that seems to be what
   it's for. Most folks will use `git <cmd> --abort`.
3. Issues telling the difference between --soft and --mixed, as well as
   --keep. Leave --keep alone because I couldn't understand its use case,
   but change `--soft` / `--mixed` / `--hard` as follows:

--mixed is the default, so put it first.

Describe --soft/--mixed/--hard with the following structure:

* Start by saying what happens to the files in the working directory,
  because the thing users want to avoid most is irretrievably losing
  changes to their working directory files.
* Then describe what happens to the staging area. Right now it seems to
  frame leaving the index alone as being a sort of neutral action.
  I think this is part of what's confusing users, because in Git when
  you update HEAD, Git almost always updates the index to match HEAD.
  So leaving the index unchanged while updating HEAD is actually quite
  unusual, and it deserves to be flagged.
* Finally, give an example for --soft to explain a common use case.

Signed-off-by: Julia Evans <julia@jvns.ca>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: D. Ben Knoble <ben.knoble+github@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>