Commit Graph

79798 Commits

Author SHA1 Message Date
Junio C Hamano
7b2bccb0d5 The 7th batch
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-02-25 11:54:18 -08:00
Junio C Hamano
d1c983d41b 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
2026-02-25 11:54:18 -08:00
Junio C Hamano
422cae6687 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
2026-02-25 11:54:18 -08:00
Junio C Hamano
b1f4b5888b Merge branch 'ps/pack-concat-wo-backfill'
"git pack-objects --stdin-packs" with "--exclude-promisor-objects"
fetched objects that are promised, which was not wanted.  This has
been fixed.

* ps/pack-concat-wo-backfill:
  builtin/pack-objects: don't fetch objects when merging packs
2026-02-25 11:54:18 -08:00
Junio C Hamano
d21437a916 Merge branch 'dk/complete-stash-import-export'
Command line completion (in contrib/) update.

* dk/complete-stash-import-export:
  completion: add stash import, export
2026-02-25 11:54:17 -08:00
Junio C Hamano
1a46f31b3e Merge branch 'jc/doc-cg-needswork'
A CodingGuidelines update.

* jc/doc-cg-needswork:
  CodingGuidelines: document NEEDSWORK comments
2026-02-25 11:54:17 -08:00
Junio C Hamano
8d15dd1ce1 Merge branch 'ds/revision-maximal-only'
"git rev-list" and friends learn "--maximal-only" to show only the
commits that are not reachable by other commits.

* ds/revision-maximal-only:
  revision: add --maximal-only option
2026-02-25 11:54:17 -08:00
Junio C Hamano
6b5ad01886 Merge branch 'cc/lop-filter-auto'
"auto filter" logic for large-object promisor remote.

* cc/lop-filter-auto:
  fetch-pack: wire up and enable auto filter logic
  promisor-remote: change promisor_remote_reply()'s signature
  promisor-remote: keep advertised filters in memory
  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
2026-02-25 11:54:17 -08:00
Junio C Hamano
e8c6456592 Merge branch 'pw/commit-msg-sample-hook'
Update sample commit-msg hook to complain when a log message has
material mailinfo considers the end of log message in the middle.

* pw/commit-msg-sample-hook:
  templates: detect commit messages containing diffs
  templates: add .gitattributes entry for sample hooks
2026-02-25 11:54:16 -08:00
Junio C Hamano
bf3c3603fd Merge branch 'kh/doc-am-format-sendmail'
Doc update.

* kh/doc-am-format-sendmail:
  doc: add caveat about round-tripping format-patch
2026-02-25 11:54:16 -08:00
Junio C Hamano
7c02d39fc2 The 6th batch
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-02-20 11:36:18 -08:00
Junio C Hamano
c61120cf65 Merge branch 'ak/t9812-test-path-is-helpers'
Test update.

* ak/t9812-test-path-is-helpers:
  t9812: modernize test path helpers
2026-02-20 11:36:18 -08:00
Junio C Hamano
8ceb69f85d Merge branch 'pw/diff-anchored-optim'
"git diff --anchored=<text>" has been optimized.

* pw/diff-anchored-optim:
  diff --anchored: avoid checking unmatched lines
2026-02-20 11:36:18 -08:00
Junio C Hamano
2a0a64b9d4 Merge branch 'jc/doc-cg-c-comment'
A CodingGuidelines update.

* jc/doc-cg-c-comment:
  CodingGuidelines: document // comments
2026-02-20 11:36:18 -08:00
Junio C Hamano
5465d3683a Merge branch 'pw/xdiff-cleanups'
Small clean-up of xdiff library to remove unnecessary data
duplication.

* pw/xdiff-cleanups:
  xdiff: remove unused data from xdlclass_t
  xdiff: remove "line_hash" field from xrecord_t
2026-02-20 11:36:17 -08:00
Junio C Hamano
73fd77805f The 5th batch
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-02-17 13:30:43 -08:00
Junio C Hamano
05e54d2d60 Merge branch 'jc/doc-rerere-update'
Doc update.

* jc/doc-rerere-update:
  rerere: minor documantation update
2026-02-17 13:30:43 -08:00
Junio C Hamano
11294bb0fa Merge branch 'sd/t7003-test-path-is-helpers'
Test updates.

* sd/t7003-test-path-is-helpers:
  t7003: modernize path existence checks using test helpers
2026-02-17 13:30:43 -08:00
Junio C Hamano
dba8cfa9c0 Merge branch 'kh/doc-rerere-options-xref'
Doc update.

* kh/doc-rerere-options-xref:
  doc: rerere-options.adoc: link to git-rerere(1)
2026-02-17 13:30:43 -08:00
Junio C Hamano
70d3916a7d Merge branch 'bk/t2003-modernise'
Test update.

* bk/t2003-modernise:
  t2003: modernize path existence checks using test helpers
2026-02-17 13:30:43 -08:00
Junio C Hamano
83037cb357 Merge branch 'rs/commit-commit-stack'
Code clean-up to use the commit_stack API.

* rs/commit-commit-stack:
  commit: use commit_stack
2026-02-17 13:30:42 -08:00
Junio C Hamano
354b8d89ac Merge branch 'rs/clean-includes'
Clean up redundant includes of header files.

* rs/clean-includes:
  remove duplicate includes
2026-02-17 13:30:42 -08:00
Junio C Hamano
d445421a54 Merge branch 'rs/xdiff-wo-the-repository'
Reduce dependency on the_repository of xdiff-interface layer.

* rs/xdiff-wo-the-repository:
  xdiff-interface: stop using the_repository
2026-02-17 13:30:42 -08:00
Junio C Hamano
e8b7e16e7b Merge branch 'rs/version-wo-the-repository'
Code clean-up.

* rs/version-wo-the-repository:
  version: stop using the_repository
2026-02-17 13:30:42 -08:00
Junio C Hamano
73f29c8ca9 Merge branch 'yt/merge-file-outside-a-repository'
"git merge-file" can be run outside a repository, but it ignored
all configuration, even the per-user ones.  The command now uses
available configuration files to find its customization.

* yt/merge-file-outside-a-repository:
  merge-file: honor merge.conflictStyle outside of a repository
2026-02-17 13:30:41 -08:00
Junio C Hamano
6de2d1493a Merge branch 'ja/doc-synopsis-style-even-more'
A handful of documentation pages have been modernized to use the
"synopsis" style.

* ja/doc-synopsis-style-even-more:
  doc: convert git-show to synopsis style
  doc: fix some style issues in git-clone and for-each-ref-options
  doc: finalize git-clone documentation conversion to synopsis style
  doc: convert git-submodule to synopsis style
2026-02-17 13:30:41 -08:00
Junio C Hamano
5779c47fa0 Merge branch 'pc/lockfile-pid'
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
2026-02-17 13:30:41 -08:00
Christian Couder
ef2f1845ec 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>
2026-02-17 11:46:41 -08:00
Christian Couder
e15a6b2f8b promisor-remote: change promisor_remote_reply()'s signature
The `promisor_remote_reply()` function performs two tasks:
1. It uses filter_promisor_remote() to parse the server's
   "promisor-remote" advertisement and to mark accepted remotes in the
   repository configuration.
2. It assembles a reply string containing the accepted remote names to
   send back to the server.

In a following commit, the fetch-pack logic will need to trigger the
side effect (1) to ensure the repository state is correct, but it will
not need to send a reply (2).

To avoid assembling a reply string when it is not needed, let's change
the signature of promisor_remote_reply(). It will now return `void` and
accept a second `char **accepted_out` argument. Only if that argument
is not NULL will a reply string be assembled and returned back to the
caller via that argument.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-02-17 11:46:41 -08:00
Christian Couder
257f2db5d3 promisor-remote: keep advertised filters 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 also 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`
  added in this commit, and
- generates a single filter spec for them.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-02-17 11:46:41 -08:00
Christian Couder
cd1a89838a 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 by the current command.
- 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.

Also note that the new `allow_auto_filter` flag depends on the command,
not user choices, so it should be reset to the command default when
`struct list_objects_filter_options` instances are reset.

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>
2026-02-17 11:46:40 -08:00
Christian Couder
190438b62f 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 this option. To ensure consistency across
commands, let's reuse the exact description currently found in
`git clone`.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-02-17 11:46:40 -08:00
Christian Couder
f7565410e1 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>
2026-02-17 11:46:40 -08:00
Christian Couder
fe53359743 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>
2026-02-17 11:46:40 -08:00
Christian Couder
3e20258d11 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.

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

Note that for a partial clone filter, it's less interesting to have
it stored on the client. This is because a filter should be used
right away and we already pass a `--filter=<filter-spec>` option to
`git clone` when starting a partial clone. Storing the filter could
perhaps still be interesting for information purposes.

Like "promisor.checkFields" and "promisor.sendFields", the new
configuration variable 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>
2026-02-17 11:46:40 -08:00
Christian Couder
a7d430d5b5 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>
2026-02-17 11:46:40 -08:00
Junio C Hamano
aa94ba7d80 CodingGuidelines: document NEEDSWORK comments
We often say things like /* NEEDSWORK: further _do_ _this_ */ in
comments, but it is a short-hand to say "We might later want to do
this.  We might not.  We do not have to decide it right now at this
moment in the commit this comment was added.  If somebody is
inclined to work in this area further, the first thing they need to
do is to figure out if it truly makes sense to do so, before blindly
doing it."

This seems to have never been documented.  Do so now.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-02-14 07:37:33 -08:00
Junio C Hamano
852829b3dd The 4th batch
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-02-13 13:39:26 -08:00
Junio C Hamano
03dfe4e1af Merge branch 'sb/merge-ours-sparse'
"git merge-ours" is taught to work better in a sparse checkout.

* sb/merge-ours-sparse:
  merge-ours: integrate with sparse-index
  merge-ours: drop USE_THE_REPOSITORY_VARIABLE
2026-02-13 13:39:26 -08:00
Junio C Hamano
94336d77bc Merge branch 'sd/doc-my1c-api-config-reference-fix'
Docfix.

* sd/doc-my1c-api-config-reference-fix:
  doc: fix repo_config documentation reference
2026-02-13 13:39:26 -08:00
Junio C Hamano
e10d5fcad0 Merge branch 'jc/ci-test-contrib-too'
Test contrib/ things in CI to catch breakages before they enter the
"next" branch.

* jc/ci-test-contrib-too:
  : Some of our downstream folks run more tests than we do and catch
  : breakages in them, namely, where contrib/*/Makefile has "test" target.
  : Let's make sure we fail upon accepting a new topic that break them in
  : 'seen'.
  ci: ubuntu: use GNU coreutils for dirname
  test: optionally test contrib in CI
2026-02-13 13:39:26 -08:00
Junio C Hamano
29722ee3a3 Merge branch 'jt/odb-transaction-per-source'
Transaction to create objects (or not) is currently tied to the
repository, but in the future a repository can have multiple object
sources, which may have different transaction mechanisms.  Make the
odb transaction API per object source.

* jt/odb-transaction-per-source:
  odb: transparently handle common transaction behavior
  odb: prepare `struct odb_transaction` to become generic
  object-file: rename transaction functions
  odb: store ODB source in `struct odb_transaction`
2026-02-13 13:39:26 -08:00
Junio C Hamano
5288202433 Merge branch 'ps/commit-list-functions-renamed'
Rename three functions around the commit_list data structure.

* ps/commit-list-functions-renamed:
  commit: rename `free_commit_list()` to conform to coding guidelines
  commit: rename `reverse_commit_list()` to conform to coding guidelines
  commit: rename `copy_commit_list()` to conform to coding guidelines
2026-02-13 13:39:25 -08:00
Junio C Hamano
70cc3bca87 Merge branch 'tc/last-modified-not-a-tree'
Giving "git last-modified" a tree (not a commit-ish) died an
uncontrolled death, which has been corrected.

* tc/last-modified-not-a-tree:
  last-modified: verify revision argument is a commit-ish
  last-modified: remove double error message
  last-modified: fix memory leak when more than one commit is given
  last-modified: rewrite error message when more than one commit given
2026-02-13 13:39:25 -08:00
Junio C Hamano
f036245819 Merge branch 'mc/doc-send-email-signed-off-by-cc'
Docfix.

* mc/doc-send-email-signed-off-by-cc:
  doc: send-email: correct --no-signed-off-by-cc misspelling
2026-02-13 13:39:25 -08:00
Junio C Hamano
7855effc95 Merge branch 'cf/c23-const-preserving-strchr-updates-0'
ISO C23 redefines strchr and friends that tradiotionally took
a const pointer and returned a non-const pointer derived from it to
preserve constness (i.e., if you ask for a substring in a const
string, you get a const pointer to the substring).  Update code
paths that used non-const pointer to receive their results that did
not have to be non-const to adjust.

* cf/c23-const-preserving-strchr-updates-0:
  gpg-interface: remove an unnecessary NULL initialization
  global: constify some pointers that are not written to
2026-02-13 13:39:25 -08:00
Junio C Hamano
a91de2172d Merge branch 'jc/diff-highlight-main-master-testfix'
Test fix (in contrib/)

* jc/diff-highlight-main-master-testfix:
  diff-highlight: allow testing with Git 3.0 breaking changes
2026-02-13 13:39:24 -08:00
Junio C Hamano
448a65c93b Merge branch 'cs/subtree-reftable-testfix'
Test fix (in contrib/)

* cs/subtree-reftable-testfix:
  contrib/subtree: fix tests with reftable backend
2026-02-13 13:39:24 -08:00
Junio C Hamano
b852412523 Merge branch 'tc/memzero-array'
Coccinelle rules update.

* tc/memzero-array:
  cocci: extend MEMZERO_ARRAY() rules
2026-02-13 13:39:24 -08:00
Matthew John Cheetham
3c8c638df6 t0213: add trace2 cmd_ancestry tests
Add a new test script t0213-trace2-ancestry.sh that verifies
cmd_ancestry events across all three trace2 output formats (normal,
perf, and event).

The tests use the "400ancestry" test helper to spawn child processes
with controlled trace2 environments. Git alias resolution (which
spawns a child git process) creates a predictable multi-level process
tree. Filter functions extract cmd_ancestry events from each format,
truncating the ancestor list at the outermost "test-tool" so that only
the controlled portion of the tree is verified, regardless of the test
runner environment.

A runtime prerequisite (TRACE2_ANCESTRY) is used to detect whether the
platform has a real procinfo implementation; platforms with only the
stub are skipped.

We must pay attention to an extra ancestor on Windows (MINGW) when
running without the bin-wrappers (such as we do in CI). In this
situation we see an extra "sh.exe" ancestor after "test-tool.exe".

Also update the comment in t0210-trace2-normal.sh to reflect that
ancestry testing now has its own dedicated test script.

Signed-off-by: Matthew John Cheetham <mjcheetham@outlook.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-02-13 12:18:32 -08:00