]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
2 months agorefs: implement batch reference update support
Karthik Nayak [Tue, 8 Apr 2025 08:51:10 +0000 (10:51 +0200)] 
refs: implement batch reference update support

Git supports making reference updates with or without transactions.
Updates with transactions are generally better optimized. But
transactions are all or nothing. This means, if a user wants to batch
updates to take advantage of the optimizations without the hard
requirement that all updates must succeed, there is no way currently to
do so. Particularly with the reftable backend where batching multiple
reference updates is more efficient than performing them sequentially.

Introduce batched update support with a new flag,
'REF_TRANSACTION_ALLOW_FAILURE'. Batched updates while different from
transactions, use the transaction infrastructure under the hood. When
enabled, this flag allows individual reference updates that would
typically cause the entire transaction to fail due to non-system-related
errors to be marked as rejected while permitting other updates to
proceed. System errors referred by 'REF_TRANSACTION_ERROR_GENERIC'
continue to result in the entire transaction failing. This approach
enhances flexibility while preserving transactional integrity where
necessary.

The implementation introduces several key components:

  - Add 'rejection_err' field to struct `ref_update` to track failed
    updates with failure reason.

  - Add a new struct `ref_transaction_rejections` and a field within
    `ref_transaction` to this struct to allow quick iteration over
    rejected updates.

  - Modify reference backends (files, packed, reftable) to handle
    partial transactions by using `ref_transaction_set_rejected()`
    instead of failing the entire transaction when
    `REF_TRANSACTION_ALLOW_FAILURE` is set.

  - Add `ref_transaction_for_each_rejected_update()` to let callers
    examine which updates were rejected and why.

This foundational change enables batched update support throughout the
reference subsystem. A following commit will expose this capability to
users by adding a `--batch-updates` flag to 'git-update-ref(1)',
providing both a user-facing feature and a testable implementation.

Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Acked-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agorefs: introduce enum-based transaction error types
Karthik Nayak [Tue, 8 Apr 2025 08:51:09 +0000 (10:51 +0200)] 
refs: introduce enum-based transaction error types

Replace preprocessor-defined transaction errors with a strongly-typed
enum `ref_transaction_error`. This change:

  - Improves type safety and function signature clarity.
  - Makes error handling more explicit and discoverable.
  - Maintains existing error cases, while adding new error cases for
    common scenarios.

This refactoring paves the way for more comprehensive error handling
which we will utilize in the upcoming commits to add batch reference
update support.

Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Acked-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agorefs/reftable: extract code from the transaction preparation
Karthik Nayak [Tue, 8 Apr 2025 08:51:08 +0000 (10:51 +0200)] 
refs/reftable: extract code from the transaction preparation

Extract the core logic for preparing individual reference updates from
`reftable_be_transaction_prepare()` into `prepare_single_update()`. This
dedicated function now handles all validation and preparation steps for
each reference update in the transaction, including object ID
verification, HEAD reference handling, and symref processing.

The refactoring consolidates all reference update validation into a
single logical block, which improves code maintainability and
readability. More importantly, this restructuring lays the groundwork
for implementing batched reference update support in the reftable
backend, which will be introduced in a followup commit.

No functional changes are included in this commit - it is purely a code
reorganization to support future enhancements.

Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Acked-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agorefs/files: remove duplicate duplicates check
Karthik Nayak [Tue, 8 Apr 2025 08:51:07 +0000 (10:51 +0200)] 
refs/files: remove duplicate duplicates check

Within the files reference backend's transaction's 'finish' phase, a
verification step is currently performed wherein the refnames list is
sorted and examined for multiple updates targeting the same refname.

It has been observed that this verification is redundant, as an
identical check is already executed during the transaction's 'prepare'
stage. Since the refnames list remains unmodified following the
'prepare' stage, this secondary verification can be safely eliminated.

The duplicate check has been removed accordingly, and the
`ref_update_reject_duplicates()` function has been marked as static, as
its usage is now confined to 'refs.c'.

Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Acked-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agorefs: move duplicate refname update check to generic layer
Karthik Nayak [Tue, 8 Apr 2025 08:51:06 +0000 (10:51 +0200)] 
refs: move duplicate refname update check to generic layer

Move the tracking of refnames in `affected_refnames` from individual
backends into the generic layer in 'refs.c'. This centralizes the
duplicate refname detection that was previously handled separately by
each backend.

Make some changes to accommodate this move:

  - Add a `string_list` field `refnames` to `ref_transaction` to contain
    all the references in a transaction. This field is updated whenever
    a new update is added via `ref_transaction_add_update`, so manual
    additions in reference backends are dropped.

  - Modify the backends to use this field internally as needed. The
    backends need to check if an update for refname already exists when
    splitting symrefs or adding an update for 'HEAD'.

  - In the reftable backend, within `reftable_be_transaction_prepare()`,
    move the `string_list_has_string()` check above
    `ref_transaction_add_update()`. Since `ref_transaction_add_update()`
    automatically adds the refname to `transaction->refnames`,
    performing the check after will always return true, so we perform
    the check before adding the update.

This helps reduce duplication of functionality between the backends and
makes it easier to make changes in a more centralized manner.

Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Acked-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agorefs/files: remove redundant check in split_symref_update()
Karthik Nayak [Tue, 8 Apr 2025 08:51:05 +0000 (10:51 +0200)] 
refs/files: remove redundant check in split_symref_update()

In `split_symref_update()`, there were two checks for duplicate
refnames:

  - At the start, `string_list_has_string()` ensures the refname is not
    already in `affected_refnames`, preventing duplicates from being
    added.

  - After adding the refname, another check verifies whether the newly
    inserted item has a `util` value.

The second check is unnecessary because the first one guarantees that
`string_list_insert()` will never encounter a preexisting entry.

The `item->util` field is assigned to validate that a rename doesn't
already exist in the list. The validation is done after the first check.
As this check is removed, clean up the validation and the assignment of
this field in `split_head_update()` and `files_transaction_prepare()`.

Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Acked-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoMerge branch 'ps/refname-avail-check-optim' into kn/non-transactional-batch-updates
Junio C Hamano [Wed, 12 Mar 2025 18:55:05 +0000 (11:55 -0700)] 
Merge branch 'ps/refname-avail-check-optim' into kn/non-transactional-batch-updates

* ps/refname-avail-check-optim: (43 commits)
  refs: reuse iterators when determining refname availability
  refs/iterator: implement seeking for files iterators
  refs/iterator: implement seeking for packed-ref iterators
  refs/iterator: implement seeking for ref-cache iterators
  refs/iterator: implement seeking for reftable iterators
  refs/iterator: implement seeking for merged iterators
  refs/iterator: provide infrastructure to re-seek iterators
  refs/iterator: separate lifecycle from iteration
  refs: stop re-verifying common prefixes for availability
  refs/files: batch refname availability checks for initial transactions
  refs/files: batch refname availability checks for normal transactions
  refs/reftable: batch refname availability checks
  refs: introduce function to batch refname availability checks
  builtin/update-ref: skip ambiguity checks when parsing object IDs
  object-name: allow skipping ambiguity checks in `get_oid()` family
  object-name: introduce `repo_get_oid_with_flags()`
  Git 2.49-rc0
  The fourteenth batch
  mailmap: fix check-mailmap with full mailmap line
  The thirteenth batch
  ...

3 months agorefs: reuse iterators when determining refname availability
Patrick Steinhardt [Wed, 12 Mar 2025 15:56:22 +0000 (16:56 +0100)] 
refs: reuse iterators when determining refname availability

When verifying whether refnames are available we have to verify whether
any reference exists that is nested under the current reference. E.g.
given a reference "refs/heads/foo", we must make sure that there is no
other reference "refs/heads/foo/*".

This check is performed using a ref iterator with the prefix set to the
nested reference namespace. Until now it used to not be possible to
reseek iterators, so we always had to reallocate the iterator for every
single reference we're about to check. This keeps us from reusing state
that the iterator may have and that may make it work more efficiently.

Refactor the logic to reseek iterators. This leads to a sizeable speedup
with the "reftable" backend:

    Benchmark 1: update-ref: create many refs (refformat = reftable, preexisting = 100000, new = 10000, revision = HEAD~)
      Time (mean ± σ):      39.8 ms ±   0.9 ms    [User: 29.7 ms, System: 9.8 ms]
      Range (min … max):    38.4 ms …  42.0 ms    62 runs

    Benchmark 2: update-ref: create many refs (refformat = reftable, preexisting = 100000, new = 10000, revision = HEAD)
      Time (mean ± σ):      31.9 ms ±   1.1 ms    [User: 27.0 ms, System: 4.5 ms]
      Range (min … max):    29.8 ms …  34.3 ms    74 runs

    Summary
      update-ref: create many refs (refformat = reftable, preexisting = 100000, new = 10000, revision = HEAD) ran
        1.25 ± 0.05 times faster than update-ref: create many refs (refformat = reftable, preexisting = 100000, new = 10000, revision = HEAD~)

The "files" backend doesn't really show a huge impact:

    Benchmark 1: update-ref: create many refs (refformat = files, preexisting = 100000, new = 10000, revision = HEAD~)
      Time (mean ± σ):     392.3 ms ±   7.1 ms    [User: 59.7 ms, System: 328.8 ms]
      Range (min … max):   384.6 ms … 404.5 ms    10 runs

    Benchmark 2: update-ref: create many refs (refformat = files, preexisting = 100000, new = 10000, revision = HEAD)
      Time (mean ± σ):     387.7 ms ±   7.4 ms    [User: 54.6 ms, System: 329.6 ms]
      Range (min … max):   377.0 ms … 397.7 ms    10 runs

    Summary
      update-ref: create many refs (refformat = files, preexisting = 100000, new = 10000, revision = HEAD) ran
        1.01 ± 0.03 times faster than update-ref: create many refs (refformat = files, preexisting = 100000, new = 10000, revision = HEAD~)

This is mostly because it is way slower to begin with because it has to
create a separate file for each new reference, so the milliseconds we
shave off by reseeking the iterator doesn't really translate into a
significant relative improvement.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agorefs/iterator: implement seeking for files iterators
Patrick Steinhardt [Wed, 12 Mar 2025 15:56:21 +0000 (16:56 +0100)] 
refs/iterator: implement seeking for files iterators

Implement seeking for "files" iterators. As we simply use a ref-cache
iterator under the hood the implementation is straight-forward. Note
that we do not implement seeking on reflog iterators, same as with the
"reftable" backend.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agorefs/iterator: implement seeking for packed-ref iterators
Patrick Steinhardt [Wed, 12 Mar 2025 15:56:20 +0000 (16:56 +0100)] 
refs/iterator: implement seeking for packed-ref iterators

Implement seeking of `packed-ref` iterators. The implementation is again
straight forward, except that we cannot continue to use the prefix
iterator as we would otherwise not be able to reseek the iterator
anymore in case one first asks for an empty and then for a non-empty
prefix. Instead, we open-code the logic to in `advance()`.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agorefs/iterator: implement seeking for ref-cache iterators
Patrick Steinhardt [Wed, 12 Mar 2025 15:56:19 +0000 (16:56 +0100)] 
refs/iterator: implement seeking for ref-cache iterators

Implement seeking of ref-cache iterators. This is done by splitting most
of the logic to seek iterators out of `cache_ref_iterator_begin()` and
putting it into `cache_ref_iterator_seek()` so that we can reuse the
logic.

Note that we cannot use the optimization anymore where we return an
empty ref iterator when there aren't any references, as otherwise it
wouldn't be possible to reseek the iterator to a different prefix that
may exist. This shouldn't be much of a performance concern though as we
now start to bail out early in case `advance()` sees that there are no
more directories to be searched.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agorefs/iterator: implement seeking for reftable iterators
Patrick Steinhardt [Wed, 12 Mar 2025 15:56:18 +0000 (16:56 +0100)] 
refs/iterator: implement seeking for reftable iterators

Implement seeking of reftable iterators. As the low-level reftable
iterators already support seeking this change is straight-forward. Two
notes though:

  - We do not support seeking on reflog iterators. It is unclear what
    seeking would even look like in this context, as you typically would
    want to seek to a specific entry in the reflog for a specific ref.
    There is currently no use case for this, but if one arises in the
    future, we can still implement seeking at that later point.

  - We start to check whether `reftable_stack_init_ref_iterator()` is
    successful.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agorefs/iterator: implement seeking for merged iterators
Patrick Steinhardt [Wed, 12 Mar 2025 15:56:17 +0000 (16:56 +0100)] 
refs/iterator: implement seeking for merged iterators

Implement seeking on merged iterators. The implementation is rather
straight forward, with the only exception that we must not deallocate
the underlying iterators once they have been exhausted.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agorefs/iterator: provide infrastructure to re-seek iterators
Patrick Steinhardt [Wed, 12 Mar 2025 15:56:16 +0000 (16:56 +0100)] 
refs/iterator: provide infrastructure to re-seek iterators

Reftable iterators need to be scrapped after they have either been
exhausted or aren't useful to the caller anymore, and it is explicitly
not possible to reuse them for iterations. But enabling for reuse of
iterators may allow us to tune them by reusing internal state of an
iterator. The reftable iterators for example can already be reused
internally, but we're not able to expose this to any users outside of
the reftable backend.

Introduce a new `.seek` function in the ref iterator vtable that allows
callers to seek an iterator multiple times. It is expected to be
functionally the same as calling `refs_ref_iterator_begin()` with a
different (or the same) prefix.

Note that it is not possible to adjust parameters other than the seeked
prefix for now, so exclude patterns, trimmed prefixes and flags will
remain unchanged. We do not have a usecase for changing these parameters
right now, but if we ever find one we can adapt accordingly.

Implement the callback for trivial cases. The other iterators will be
implemented in subsequent commits.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agorefs/iterator: separate lifecycle from iteration
Patrick Steinhardt [Wed, 12 Mar 2025 15:56:15 +0000 (16:56 +0100)] 
refs/iterator: separate lifecycle from iteration

The ref and reflog iterators have their lifecycle attached to iteration:
once the iterator reaches its end, it is automatically released and the
caller doesn't have to care about that anymore. When the iterator should
be released before it has been exhausted, callers must explicitly abort
the iterator via `ref_iterator_abort()`.

This lifecycle is somewhat unusual in the Git codebase and creates two
problems:

  - Callsites need to be very careful about when exactly they call
    `ref_iterator_abort()`, as calling the function is only valid when
    the iterator itself still is. This leads to somewhat awkward calling
    patterns in some situations.

  - It is impossible to reuse iterators and re-seek them to a different
    prefix. This feature isn't supported by any iterator implementation
    except for the reftable iterators anyway, but if it was implemented
    it would allow us to optimize cases where we need to search for
    specific references repeatedly by reusing internal state.

Detangle the lifecycle from iteration so that we don't deallocate the
iterator anymore once it is exhausted. Instead, callers are now expected
to always call a newly introduce `ref_iterator_free()` function that
deallocates the iterator and its internal state.

Note that the `dir_iterator` is somewhat special because it does not
implement the `ref_iterator` interface, but is only used to implement
other iterators. Consequently, we have to provide `dir_iterator_free()`
instead of `dir_iterator_release()` as the allocated structure itself is
managed by the `dir_iterator` interfaces, as well, and not freed by
`ref_iterator_free()` like in all the other cases.

While at it, drop the return value of `ref_iterator_abort()`, which
wasn't really required by any of the iterator implementations anyway.
Furthermore, stop calling `base_ref_iterator_free()` in any of the
backends, but instead call it in `ref_iterator_free()`.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agorefs: stop re-verifying common prefixes for availability
Patrick Steinhardt [Wed, 12 Mar 2025 15:56:14 +0000 (16:56 +0100)] 
refs: stop re-verifying common prefixes for availability

One of the checks done by `refs_verify_refnames_available()` is whether
any of the prefixes of a reference already exists. For example, given a
reference "refs/heads/main", we'd check whether "refs/heads" or "refs"
already exist, and if so we'd abort the transaction.

When updating multiple references at once, this check is performed for
each of the references individually. Consequently, because references
tend to have common prefixes like "refs/heads/" or refs/tags/", we
evaluate the availability of these prefixes repeatedly. Naturally this
is a waste of compute, as the availability of those prefixes should in
general not change in the middle of a transaction. And if it would,
backends would notice at a later point in time.

Optimize this pattern by storing prefixes in a `strset` so that we can
trivially track those prefixes that we have already checked. This leads
to a significant speedup with the "reftable" backend when creating many
references that all share a common prefix:

    Benchmark 1: update-ref: create many refs (refformat = reftable, preexisting = 100000, new = 10000, revision = HEAD~)
      Time (mean ± σ):      63.1 ms ±   1.8 ms    [User: 41.0 ms, System: 21.6 ms]
      Range (min … max):    60.6 ms …  69.5 ms    38 runs

    Benchmark 2: update-ref: create many refs (refformat = reftable, preexisting = 100000, new = 10000, revision = HEAD)
      Time (mean ± σ):      40.0 ms ±   1.3 ms    [User: 29.3 ms, System: 10.3 ms]
      Range (min … max):    38.1 ms …  47.3 ms    61 runs

    Summary
      update-ref: create many refs (refformat = reftable, preexisting = 100000, new = 10000, revision = HEAD) ran
        1.58 ± 0.07 times faster than update-ref: create many refs (refformat = reftable, preexisting = 100000, new = 10000, revision = HEAD~)

For the "files" backend we see an improvement, but a much smaller one:

    Benchmark 1: update-ref: create many refs (refformat = files, preexisting = 100000, new = 10000, revision = HEAD~)
      Time (mean ± σ):     395.8 ms ±   5.3 ms    [User: 63.6 ms, System: 330.5 ms]
      Range (min … max):   387.0 ms … 404.6 ms    10 runs

    Benchmark 2: update-ref: create many refs (refformat = files, preexisting = 100000, new = 10000, revision = HEAD)
      Time (mean ± σ):     386.0 ms ±   4.0 ms    [User: 51.5 ms, System: 332.8 ms]
      Range (min … max):   380.8 ms … 392.6 ms    10 runs

    Summary
      update-ref: create many refs (refformat = files, preexisting = 100000, new = 10000, revision = HEAD) ran
        1.03 ± 0.02 times faster than update-ref: create many refs (refformat = files, preexisting = 100000, new = 10000, revision = HEAD~)

This change also leads to a modest improvement when writing references
with "initial" semantics, for example when migrating references. The
following benchmarks are migrating 1m references from the "reftable" to
the "files" backend:

    Benchmark 1: migrate reftable:files (refcount = 1000000, revision = HEAD~)
      Time (mean ± σ):     836.6 ms ±   5.6 ms    [User: 645.2 ms, System: 185.2 ms]
      Range (min … max):   829.6 ms … 845.9 ms    10 runs

    Benchmark 2: migrate reftable:files (refcount = 1000000, revision = HEAD)
      Time (mean ± σ):     759.8 ms ±   5.1 ms    [User: 574.9 ms, System: 178.9 ms]
      Range (min … max):   753.1 ms … 768.8 ms    10 runs

    Summary
      migrate reftable:files (refcount = 1000000, revision = HEAD) ran
        1.10 ± 0.01 times faster than migrate reftable:files (refcount = 1000000, revision = HEAD~)

And vice versa:

    Benchmark 1: migrate files:reftable (refcount = 1000000, revision = HEAD~)
      Time (mean ± σ):     870.7 ms ±   5.7 ms    [User: 735.2 ms, System: 127.4 ms]
      Range (min … max):   861.6 ms … 883.2 ms    10 runs

    Benchmark 2: migrate files:reftable (refcount = 1000000, revision = HEAD)
      Time (mean ± σ):     799.1 ms ±   8.5 ms    [User: 661.1 ms, System: 130.2 ms]
      Range (min … max):   787.5 ms … 812.6 ms    10 runs

    Summary
      migrate files:reftable (refcount = 1000000, revision = HEAD) ran
        1.09 ± 0.01 times faster than migrate files:reftable (refcount = 1000000, revision = HEAD~)

The impact here is significantly smaller given that we don't perform any
reference reads with "initial" semantics, so the speedup only comes from
us doing less string list lookups.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agorefs/files: batch refname availability checks for initial transactions
Patrick Steinhardt [Wed, 12 Mar 2025 15:56:13 +0000 (16:56 +0100)] 
refs/files: batch refname availability checks for initial transactions

The "files" backend explicitly carves out special logic for its initial
transaction so that it can avoid writing out every single reference as
a loose reference. While the assumption is that there shouldn't be any
preexisting references, we still have to verify that none of the newly
written references will conflict with any other new reference in the
same transaction.

Refactor the initial transaction to use batched refname availability
checks. This does not yet have an effect on performance as we still call
`refs_verify_refname_available()` in a loop. But this will change in
subsequent commits and then impact performance when cloning a repository
with many references or when migrating references to the "files" format.

This will improve performance when cloning a repository with many
references or when migrating references from any format to the "files"
format once the availability checks have learned to optimize checks for
many references in a subsequent commit.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agorefs/files: batch refname availability checks for normal transactions
Patrick Steinhardt [Wed, 12 Mar 2025 15:56:12 +0000 (16:56 +0100)] 
refs/files: batch refname availability checks for normal transactions

Same as the "reftable" backend that we have adapted in the preceding
commit to use batched refname availability checks we can also do so for
the "files" backend. Things are a bit more intricate here though, as we
call `refs_verify_refname_available()` in a set of different contexts:

  1. `lock_raw_ref()` when it hits either EEXISTS or EISDIR when creating
     a new reference, mostly to create a nice, user-readable error
     message. This is nothing we have to care about too much, as we only
     hit this code path at most once when we hit a conflict.

  2. `lock_raw_ref()` when it _could_ create the lockfile to check
     whether it is conflicting with any packed refs. In the general case,
     this code path will be hit once for every (successful) reference
     update.

  3. `lock_ref_oid_basic()`, but it is only executed when copying or
     renaming references or when expiring reflogs. It will thus not be
     called in contexts where we have many references queued up.

  4. `refs_refname_ref_available()`, but again only when copying or
     renaming references. It is thus not interesting due to the same
     reason as the previous case.

  5. `files_transaction_finish_initial()`, which is only executed when
     creating a new repository or migrating references.

So out of these, only (2) and (5) are viable candidates to use the
batched checks.

Adapt `lock_raw_ref()` accordingly by queueing up reference names that
need to be checked for availability and then checking them after we have
processed all updates. This check is done before we (optionally) lock
the `packed-refs` file, which is somewhat flawed because it means that
the `packed-refs` could still change after the availability check and
thus create an undetected conflict. But unconditionally locking the file
would change semantics that users are likely to rely on, so we keep the
current locking sequence intact, even if it's suboptmial.

The refactoring of `files_transaction_finish_initial()` will be done in
the next commit.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agorefs/reftable: batch refname availability checks
Patrick Steinhardt [Wed, 12 Mar 2025 15:56:11 +0000 (16:56 +0100)] 
refs/reftable: batch refname availability checks

Refactor the "reftable" backend to batch the availability check for
refnames. This does not yet have an effect on performance as
`refs_verify_refnames_available()` effectively still performs the
availability check for each refname individually. But this will be
optimized in subsequent commits, where we learn to optimize some parts
of the logic when checking multiple refnames for availability.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agorefs: introduce function to batch refname availability checks
Patrick Steinhardt [Wed, 12 Mar 2025 15:56:10 +0000 (16:56 +0100)] 
refs: introduce function to batch refname availability checks

The `refs_verify_refname_available()` functions checks whether a
reference update can be committed or whether it would conflict with
either a prefix or suffix thereof. This function needs to be called once
per reference that one wants to check, which requires us to redo a
couple of checks every time the function is called.

Introduce a new function `refs_verify_refnames_available()` that does
the same, but for a list of references. For now, the new function uses
the exact same implementation, except that we loop through all refnames
provided by the caller. This will be tuned in subsequent commits.

The existing `refs_verify_refname_available()` function is reimplemented
on top of the new function. As such, the diff is best viewed with the
`--ignore-space-change option`.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agobuiltin/update-ref: skip ambiguity checks when parsing object IDs
Patrick Steinhardt [Wed, 12 Mar 2025 15:56:09 +0000 (16:56 +0100)] 
builtin/update-ref: skip ambiguity checks when parsing object IDs

Most of the commands in git-update-ref(1) accept an old and/or new
object ID to update a specific reference to. These object IDs get parsed
via `repo_get_oid()`, which not only handles plain object IDs, but also
those that have a suffix like "~" or "^2". More surprisingly though, it
even knows to resolve arbitrary revisions, despite the fact that its
manpage does not mention this fact even once.

One consequence of this is that we also check for ambiguous references:
when parsing a full object ID where the DWIM mechanism would also cause
us to resolve it as a branch, we'd end up printing a warning. While this
check makes sense to have in general, it is arguably less useful in the
context of git-update-ref(1). This is due to multiple reasons:

  - The manpage is explicitly structured around object IDs. So if we see
    a fully blown object ID, the intent should be quite clear in
    general.

  - The command is part of our plumbing layer and not a tool that users
    would generally use in interactive workflows. As such, the warning
    will likely not be visible to anybody in the first place.

  - Users can and should use the fully-qualified refname in case there
    is any potential for ambiguity. And given that this command is part
    of our plumbing layer, one should always try to be as defensive as
    possible and use fully-qualified refnames.

Furthermore, this check can be quite expensive when updating lots of
references via `--stdin`, because we try to read multiple references per
object ID that we parse according to the DWIM rules. This effect can be
seen both with the "files" and "reftable" backend.

The issue is not unique to git-update-ref(1), but was also an issue in
git-cat-file(1), where it was addressed by disabling the ambiguity check
in 25fba78d36b (cat-file: disable object/refname ambiguity check for
batch mode, 2013-07-12).

Disable the warning in git-update-ref(1), which provides a significant
speedup with both backends. The user-visible outcome is unchanged even
when ambiguity exists, except that we don't show the warning anymore.

The following benchmark creates 10000 new references with a 100000
preexisting refs with the "files" backend:

    Benchmark 1: update-ref: create many refs (refformat = files, preexisting = 100000, new = 10000, revision = HEAD~)
      Time (mean ± σ):     467.3 ms ±   5.1 ms    [User: 100.0 ms, System: 365.1 ms]
      Range (min … max):   461.9 ms … 479.3 ms    10 runs

    Benchmark 2: update-ref: create many refs (refformat = files, preexisting = 100000, new = 10000, revision = HEAD)
      Time (mean ± σ):     394.1 ms ±   5.8 ms    [User: 63.3 ms, System: 327.6 ms]
      Range (min … max):   384.9 ms … 405.7 ms    10 runs

    Summary
      update-ref: create many refs (refformat = files, preexisting = 100000, new = 10000, revision = HEAD) ran
        1.19 ± 0.02 times faster than update-ref: create many refs (refformat = files, preexisting = 100000, new = 10000, revision = HEAD~)

And with the "reftable" backend:

    Benchmark 1: update-ref: create many refs (refformat = reftable, preexisting = 100000, new = 10000, revision = HEAD~)
      Time (mean ± σ):     146.9 ms ±   2.2 ms    [User: 90.4 ms, System: 56.0 ms]
      Range (min … max):   142.7 ms … 150.8 ms    19 runs

    Benchmark 2: update-ref: create many refs (refformat = reftable, preexisting = 100000, new = 10000, revision = HEAD)
      Time (mean ± σ):      63.2 ms ±   1.1 ms    [User: 41.0 ms, System: 21.8 ms]
      Range (min … max):    61.1 ms …  66.6 ms    41 runs

    Summary
      update-ref: create many refs (refformat = reftable, preexisting = 100000, new = 10000, revision = HEAD) ran
        2.32 ± 0.05 times faster than update-ref: create many refs (refformat = reftable, preexisting = 100000, new = 10000, revision = HEAD~)

Note that the absolute improvement with both backends is roughly in the
same ballpark, but the relative improvement for the "reftable" backend
is more significant because writing the new table to disk is faster in
the first place.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoobject-name: allow skipping ambiguity checks in `get_oid()` family
Patrick Steinhardt [Wed, 12 Mar 2025 15:56:08 +0000 (16:56 +0100)] 
object-name: allow skipping ambiguity checks in `get_oid()` family

When reading an object ID via `get_oid_basic()` or any of its related
functions we perform a check whether the object ID is ambiguous, which
can be the case when a reference with the same name exists. While the
check is generally helpful, there are cases where it only adds to the
runtime overhead without providing much of a benefit.

Add a new flag that allows us to disable the check. The flag 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 agoobject-name: introduce `repo_get_oid_with_flags()`
Patrick Steinhardt [Wed, 12 Mar 2025 15:56:07 +0000 (16:56 +0100)] 
object-name: introduce `repo_get_oid_with_flags()`

Introduce a new function `repo_get_oid_with_flags()`. This function
behaves the same as `repo_get_oid()`, except that it takes an extra
`flags` parameter that it ends up passing to `get_oid_with_context()`.

This 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 agoGit 2.49-rc0 v2.49.0-rc0
Junio C Hamano [Wed, 26 Feb 2025 16:55:18 +0000 (08:55 -0800)] 
Git 2.49-rc0

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoMerge branch 'jk/check-mailmap-wo-name-fix'
Junio C Hamano [Wed, 26 Feb 2025 16:51:00 +0000 (08:51 -0800)] 
Merge branch 'jk/check-mailmap-wo-name-fix'

"git check-mailmap" segfault fix.

* jk/check-mailmap-wo-name-fix:
  mailmap: fix check-mailmap with full mailmap line

3 months agoMerge branch 'ek/mingw-rename-symlink'
Junio C Hamano [Wed, 26 Feb 2025 16:50:37 +0000 (08:50 -0800)] 
Merge branch 'ek/mingw-rename-symlink'

Symlink renaming fix.

* ek/mingw-rename-symlink:
  compat/mingw: rename the symlink, not the target

3 months agoThe fourteenth batch
Junio C Hamano [Tue, 25 Feb 2025 19:54:57 +0000 (11:54 -0800)] 
The fourteenth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoMerge branch 'po/meson-perl-fix'
Junio C Hamano [Tue, 25 Feb 2025 22:19:37 +0000 (14:19 -0800)] 
Merge branch 'po/meson-perl-fix'

Upgrade the minimum Perl version enforced by meson-based build to
match what Makefile-based build uses.

* po/meson-perl-fix:
  meson: fix Perl version check for Meson versions before 1.7.0
  meson: bump minimum required Perl version to 5.26.0

3 months agoMerge branch 'ms/rename-match-name-with-pattern'
Junio C Hamano [Tue, 25 Feb 2025 22:19:36 +0000 (14:19 -0800)] 
Merge branch 'ms/rename-match-name-with-pattern'

Code renaming.

* ms/rename-match-name-with-pattern:
  refspec: clarify function naming and documentation

3 months agoMerge branch 'ad/set-default-target-in-makefiles'
Junio C Hamano [Tue, 25 Feb 2025 22:19:36 +0000 (14:19 -0800)] 
Merge branch 'ad/set-default-target-in-makefiles'

Correct the default target in Documentation/Makefile, and
future-proof all Makefiles from similar breakages by declaring the
default target (which happens to be "all") upfront.

* ad/set-default-target-in-makefiles:
  Makefile: set default goals in makefiles

3 months agoMerge branch 'pw/merge-tree-stdin-deadlock-fix'
Junio C Hamano [Tue, 25 Feb 2025 22:19:36 +0000 (14:19 -0800)] 
Merge branch 'pw/merge-tree-stdin-deadlock-fix'

"git merge-tree --stdin" has been improved (including a workaround
for a deadlock).

* pw/merge-tree-stdin-deadlock-fix:
  merge-tree: fix link formatting in html docs
  merge-tree: improve docs for --stdin
  merge-tree: only use basic merge config
  merge-tree: remove redundant code
  merge-tree --stdin: flush stdout to avoid deadlock

3 months agoMerge branch 'mh/doc-commit-title-not-subject'
Junio C Hamano [Tue, 25 Feb 2025 22:19:36 +0000 (14:19 -0800)] 
Merge branch 'mh/doc-commit-title-not-subject'

The documentation of "git commit" and "git rebase" now refer to
commit titles as such, not "subject".

* mh/doc-commit-title-not-subject:
  doc: use 'title' consistently

3 months agoMerge branch 'bc/diff-reject-empty-arg-to-pickaxe'
Junio C Hamano [Tue, 25 Feb 2025 22:19:35 +0000 (14:19 -0800)] 
Merge branch 'bc/diff-reject-empty-arg-to-pickaxe'

The -G/-S options to the "diff" family of commands caused us to hit
a BUG() when they get no values; they have been corrected.

* bc/diff-reject-empty-arg-to-pickaxe:
  diff: don't crash with empty argument to -G or -S

3 months agoMerge branch 'tb/new-make-fix'
Junio C Hamano [Tue, 25 Feb 2025 22:19:35 +0000 (14:19 -0800)] 
Merge branch 'tb/new-make-fix'

Workaround the overly picky HT/SP rule in newer GNU Make.

* tb/new-make-fix:
  Makefile: remove accidental recipe prefix in conditional

3 months agoMerge branch 'da/xdiff-w-sign-compare-workaround'
Junio C Hamano [Tue, 25 Feb 2025 22:19:35 +0000 (14:19 -0800)] 
Merge branch 'da/xdiff-w-sign-compare-workaround'

Noises from "-Wsign-compare" in the borrowed xdiff code has been
squelched.

* da/xdiff-w-sign-compare-workaround:
  xdiff: avoid signed vs. unsigned comparisons in xutils.c
  xdiff: avoid signed vs. unsigned comparisons in xpatience.c
  xdiff: avoid signed vs. unsigned comparisons in xhistogram.c
  xdiff: avoid signed vs. unsigned comparisons in xemit.c
  xdiff: avoid signed vs. unsigned comparisons in xdiffi.c
  xdiff: move sign comparison warning guard into each file

4 months agomailmap: fix check-mailmap with full mailmap line
Jacob Keller [Fri, 21 Feb 2025 23:47:58 +0000 (15:47 -0800)] 
mailmap: fix check-mailmap with full mailmap line

I recently had reported to me a crash from a coworker using the recently
added sendemail mailmap support:

  3724814 Segmentation fault      (core dumped) git check-mailmap "bugs@company.xx"

This appears to happen because of the NULL pointer name passed into
map_user(). Fix this by passing "" instead of NULL so that we have a
valid pointer.

Signed-off-by: Jacob Keller <jacob.keller@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 months agoThe thirteenth batch
Junio C Hamano [Fri, 21 Feb 2025 18:35:39 +0000 (10:35 -0800)] 
The thirteenth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 months agoMerge branch 'ac/doc-http-ssl-type-config'
Junio C Hamano [Fri, 21 Feb 2025 18:35:53 +0000 (10:35 -0800)] 
Merge branch 'ac/doc-http-ssl-type-config'

Two configuration variables about SSL authentication material that
weren't mentioned in the documentations are now mentioned.

* ac/doc-http-ssl-type-config:
  docs: indicate http.sslCertType and sslKeyType

4 months agoMerge branch 'jc/doc-boolean-synonyms'
Junio C Hamano [Fri, 21 Feb 2025 18:35:53 +0000 (10:35 -0800)] 
Merge branch 'jc/doc-boolean-synonyms'

Doc updates.

* jc/doc-boolean-synonyms:
  doc: centrally document various ways tospell `true` and `false`

4 months agoMerge branch 'en/doc-renormalize'
Junio C Hamano [Fri, 21 Feb 2025 18:35:53 +0000 (10:35 -0800)] 
Merge branch 'en/doc-renormalize'

Doc updates.

* en/doc-renormalize:
  doc: clarify the intent of the renormalize option in the merge machinery

4 months agoMerge branch 'ua/update-server-info-sans-the-repository'
Junio C Hamano [Fri, 21 Feb 2025 18:35:52 +0000 (10:35 -0800)] 
Merge branch 'ua/update-server-info-sans-the-repository'

Code clean-up.

* ua/update-server-info-sans-the-repository:
  builtin/update-server-info: remove the_repository global variable

4 months agocompat/mingw: rename the symlink, not the target
Eliah Kagan [Fri, 21 Feb 2025 12:01:36 +0000 (12:01 +0000)] 
compat/mingw: rename the symlink, not the target

Since 183ea3ea (Merge branch 'ps/mingw-rename', 2024-11-13),
a new technique is used on Windows to rename files, where supported.
The first step of this technique is to open the file with
`CreateFileW`. At that time, `FILE_ATTRIBUTE_NORMAL` was passed as
the value of the `dwFlagsAndAttributes` argument. In b30404df [2], this
was improved by passing `FILE_FLAG_BACKUP_SEMANTICS`, to support
directories as well as regular files.

However, neither value of `dwFlagsAndAttributes` is sufficient to open
a symbolic link with the correct semantics to rename it. Symlinks on
Windows are reparse points. Attempting to open a reparse point with
`CreateFileW` dereferences the reparse point and opens the target
instead, unless `FILE_FLAG_OPEN_REPARSE_POINT` is included in
`dwFlagsAndAttributes`. This is documented for that flag and in the
"Symbolic Link Behavior" section of the `CreateFileW` docs [3].

This produces a regression where attempting to rename a symlink on
Windows renames its target to the intended new name and location of the
symlink. For example, if `symlink` points to `file`, then running

    git mv symlink symlink-renamed

leaves `symlink` in place and unchanged, but renames `file` to
`symlink-renamed` [4].

This regression is detectable by existing tests in `t7001-mv.sh`, but
the tests must be run by a Windows user with the ability to create
symlinks, and the `ln -s` command used to create the initial symlink
must also be able to create a real symlink (such as by setting the
`MSYS` environment variable to `winsymlinks:nativestrict`). Then
these two tests fail if the regression is present, and pass otherwise:

    38 - git mv should overwrite file with a symlink
    39 - check moved symlink

Let's fix this, so that renaming a symlink again renames the symlink
itself and leaves the target unchanged, by passing

    FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OPEN_REPARSE_POINT

as the `dwFlagsAndAttributes` argument. This is sufficient (and safe)
because including `FILE_FLAG_OPEN_REPARSE_POINT` causes no harm even
when used to open a file or directory that is not a reparse point. In
that case, as noted in [3], this flag is simply ignored.

[1]: https://github.com/git-for-windows/git/commit/183ea3eabf81822506d2cd3aa1dc0727099ebccd
[2]: https://github.com/git-for-windows/git/commit/b30404dfc04a4b087b630aea4ab88a51cd3a7459
[3]: https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-createfilew
[4]: https://github.com/git-for-windows/git/issues/5436

Signed-off-by: Eliah Kagan <eliah.kagan@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 months agoMerge branch 'master' of https://github.com/j6t/gitk
Junio C Hamano [Thu, 20 Feb 2025 13:59:56 +0000 (05:59 -0800)] 
Merge branch 'master' of https://github.com/j6t/gitk

* 'master' of https://github.com/j6t/gitk:
  gitk: introduce support for the Meson build system
  gitk: extract script to build executable
  gitk: make the "list references" default window width wider
  gitk: fix arrow keys in input fields with Tcl/Tk >= 8.6
  gitk: Use an external icon file on Windows
  gitk: Unicode file name support
  gitk(Windows): avoid inadvertently calling executables in the worktree

4 months agoMerge branch 'pks-meson-support' of https://github.com/pks-t/gitk
Johannes Sixt [Thu, 20 Feb 2025 09:54:37 +0000 (10:54 +0100)] 
Merge branch 'pks-meson-support' of https://github.com/pks-t/gitk

* 'pks-meson-support' of https://github.com/pks-t/gitk:
  gitk: introduce support for the Meson build system
  gitk: extract script to build executable

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
4 months agoMerge branch 'g4w-gitk' of https://github.com/dscho/gitk
Johannes Sixt [Thu, 20 Feb 2025 09:53:53 +0000 (10:53 +0100)] 
Merge branch 'g4w-gitk' of https://github.com/dscho/gitk

* 'g4w-gitk' of https://github.com/dscho/gitk:
  gitk: make the "list references" default window width wider
  gitk: fix arrow keys in input fields with Tcl/Tk >= 8.6
  gitk: Use an external icon file on Windows
  gitk: Unicode file name support
  gitk(Windows): avoid inadvertently calling executables in the worktree

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
4 months agogitk: introduce support for the Meson build system
Patrick Steinhardt [Wed, 19 Feb 2025 12:42:50 +0000 (13:42 +0100)] 
gitk: introduce support for the Meson build system

Upstream Git has introduced support for the Meson build system.
Introduce support for Meson into gitk, as well, so that Git can easily
build its vendored copy of Gitk via a `subproject()` directive. The
instructions can be set up as follows:

  $ meson setup build
  $ meson compile -C build
  $ meson install -C build

Specific options, like for example where Gitk shall be installed to, can
be specified at setup time via `-D`. Available options can be discovered
by running `meson configure` either in the source or build directory.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
4 months agogitk: extract script to build executable
Patrick Steinhardt [Wed, 19 Feb 2025 12:34:30 +0000 (13:34 +0100)] 
gitk: extract script to build executable

Extract the scrip that "builds" Gitk from our Makefile so that we can
reuse it in Meson.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
4 months agomeson: fix Perl version check for Meson versions before 1.7.0
Peter Oliver [Tue, 18 Feb 2025 15:30:43 +0000 (15:30 +0000)] 
meson: fix Perl version check for Meson versions before 1.7.0

Command `perl --version` says, e.g., “This is perl 5, version 26,
subversion 0 (v5.26.0)”, which older versions of Meson interpret as
version 26.

This will be fixed in Meson 1.7.0, but at the time of writing that isn’t
yet released.

If we run `perl -V:version` we get the unambiguous response
“version='5.26.0';”, but we need at least Meson 1.5.0 to be able to do that.

Note that Perl are seriously considering dropping the leading 5 entirely
in the near future (https://perl.github.io/PPCs/ppc0025-perl-version/),
but that shouldn’t affect us.

Signed-off-by: Peter Oliver <git@mavit.org.uk>
Co-authored-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 months agomeson: bump minimum required Perl version to 5.26.0
Peter Oliver [Tue, 18 Feb 2025 15:30:42 +0000 (15:30 +0000)] 
meson: bump minimum required Perl version to 5.26.0

Commit 702d8c1f3b (Require Perl 5.26.0, 2024-10-23) dropped support
for Perl versions older than 5.26.0. The Meson build system, which
has been developed in parallel to that commit, hasn't been bumped
accordingly and thus still requires Perl 5.8.1 or newer.

Fix this by requiring Perl 5.26.0 or newer with Meson.

Signed-off-by: Peter Oliver <git@mavit.org.uk>
Reviewed-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 months agoThe twelfth batch
Junio C Hamano [Tue, 18 Feb 2025 23:02:31 +0000 (15:02 -0800)] 
The twelfth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 months agoMerge branch 'bc/contrib-thunderbird-patch-inline-fix'
Junio C Hamano [Tue, 18 Feb 2025 23:30:33 +0000 (15:30 -0800)] 
Merge branch 'bc/contrib-thunderbird-patch-inline-fix'

A thunderbird helper script lost its bashism.

* bc/contrib-thunderbird-patch-inline-fix:
  thunderbird-patch-inline: avoid bashism

4 months agoMerge branch 'lo/t7603-path-is-file-update'
Junio C Hamano [Tue, 18 Feb 2025 23:30:33 +0000 (15:30 -0800)] 
Merge branch 'lo/t7603-path-is-file-update'

Test clean-up.

* lo/t7603-path-is-file-update:
  t7603: replace test -f by test_path_is_file

4 months agoMerge branch 'da/difftool-sans-the-repository'
Junio C Hamano [Tue, 18 Feb 2025 23:30:32 +0000 (15:30 -0800)] 
Merge branch 'da/difftool-sans-the-repository'

"git difftool" code clean-up.

* da/difftool-sans-the-repository:
  difftool: eliminate use of USE_THE_REPOSITORY_VARIABLE
  difftool: eliminate use of the_repository
  difftool: eliminate use of global variables

4 months agoMerge branch 'jt/rev-list-missing-print-info'
Junio C Hamano [Tue, 18 Feb 2025 23:30:32 +0000 (15:30 -0800)] 
Merge branch 'jt/rev-list-missing-print-info'

"git rev-list --missing=" learned to accept "print-info" that gives
known details expected of the missing objects, like path and type.

* jt/rev-list-missing-print-info:
  rev-list: extend print-info to print missing object type
  rev-list: add print-info action to print missing object path

4 months agoMerge branch 'ps/send-pack-unhide-error-in-atomic-push'
Junio C Hamano [Tue, 18 Feb 2025 23:30:32 +0000 (15:30 -0800)] 
Merge branch 'ps/send-pack-unhide-error-in-atomic-push'

"git push --atomic --porcelain" used to ignore failures from the
other side, losing the error status from the child process, which
has been corrected.

* ps/send-pack-unhide-error-in-atomic-push:
  send-pack: gracefully close the connection for atomic push
  t5543: atomic push reports exit code failure
  send-pack: new return code "ERROR_SEND_PACK_BAD_REF_STATUS"
  t5548: add porcelain push test cases for dry-run mode
  t5548: add new porcelain test cases
  t5548: refactor test cases by resetting upstream
  t5548: refactor to reuse setup_upstream() function
  t5504: modernize test by moving heredocs into test bodies

4 months agoMerge branch 'ds/backfill'
Junio C Hamano [Tue, 18 Feb 2025 23:30:31 +0000 (15:30 -0800)] 
Merge branch 'ds/backfill'

Lazy-loading missing files in a blobless clone on demand is costly
as it tends to be one-blob-at-a-time.  "git backfill" is introduced
to help bulk-download necessary files beforehand.

* ds/backfill:
  backfill: assume --sparse when sparse-checkout is enabled
  backfill: add --sparse option
  backfill: add --min-batch-size=<n> option
  backfill: basic functionality and tests
  backfill: add builtin boilerplate

4 months agodiff: don't crash with empty argument to -G or -S
brian m. carlson [Mon, 17 Feb 2025 17:57:59 +0000 (17:57 +0000)] 
diff: don't crash with empty argument to -G or -S

The pickaxe options, -G and -S, need either a regex or a string to look
through the history for.  An empty value isn't very useful since it
would either match everything or nothing, and what's worse, we presently
crash with a BUG like so when the user provides one:

    BUG: diffcore-pickaxe.c:241: should have needle under -G or -S

Since it's not very nice of us to crash and this wouldn't do anything
useful anyway, let's simply inform the user that they must provide a
non-empty argument and exit with an error if they provide an empty one
instead.

Reported-by: Jared Van Bortel <cebtenzzre@gmail.com>
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Acked-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 months agodoc: use 'title' consistently
M Hickford [Sun, 16 Feb 2025 21:02:41 +0000 (21:02 +0000)] 
doc: use 'title' consistently

The first line of a commit message is variously called 'title' or
'subject'.

Prefer 'title' unless discussing email.

Signed-off-by: M Hickford <mirth.hickford@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 months agomerge-tree: fix link formatting in html docs
Phillip Wood [Tue, 18 Feb 2025 16:24:39 +0000 (16:24 +0000)] 
merge-tree: fix link formatting in html docs

In the html documentation the link to the "OUTPUT" section is surrounded
by square brackets. Fix this by adding explicit link text to the cross
reference.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Acked-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 months agomerge-tree: improve docs for --stdin
Phillip Wood [Tue, 18 Feb 2025 16:24:38 +0000 (16:24 +0000)] 
merge-tree: improve docs for --stdin

Add a section for --stdin in the list of options and document that it
implies -z so readers know how to parse the output. Also correct the
merge status documentation for --stdin as if the status is less than
zero "git merge-tree" dies before printing it.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Acked-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 months agomerge-tree: only use basic merge config
Phillip Wood [Tue, 18 Feb 2025 16:24:37 +0000 (16:24 +0000)] 
merge-tree: only use basic merge config

Commit 9c93ba4d0ae (merge-recursive: honor diff.algorithm, 2024-07-13)
replaced init_merge_options() with init_basic_merge_config() for use in
plumbing commands and init_ui_merge_config() for use in porcelain
commands. As "git merge-tree" is a plumbing command it should call
init_basic_merge_config() rather than init_ui_merge_config(). The merge
ort machinery ignores "diff.algorithm" so the behavior is unchanged by
this commit but it future proofs us against any future changes to
init_ui_merge_config().

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Acked-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 months agomerge-tree: remove redundant code
Phillip Wood [Tue, 18 Feb 2025 16:24:36 +0000 (16:24 +0000)] 
merge-tree: remove redundant code

real_merge() only ever returns "0" or "1" as it dies if the merge status
is less than zero. Therefore the check for "result < 0" is redundant and
the result variable is not needed. The return value of real_merge() is
ignored because exit status of "git merge-tree --stdin" is "0" for both
successful and conflicted merges (the status of each merge is written to
stdout). The return type of real_merge() is not changed as it is used
for the program's exit status when "--stdin" is not given.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Acked-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 months agomerge-tree --stdin: flush stdout to avoid deadlock
Phillip Wood [Tue, 18 Feb 2025 16:24:35 +0000 (16:24 +0000)] 
merge-tree --stdin: flush stdout to avoid deadlock

If a process tries to read the output from "git merge-tree --stdin"
before it closes merge-tree's stdin then it deadlocks. This happens
because merge-tree does not flush its output before trying to read
another line of input and means that it is not possible to cherry-pick a
sequence of commits using "git merge-tree --stdin". Fix this by calling
maybe_flush_or_die() before trying to read the next line of
input. Flushing the output after each merge does not seem to affect the
performance, any difference is lost in the noise even after increasing
the number of runs.

$ git rev-list --merges --parents -n100 origin/master |
sed 's/^[^ ]* //' >/tmp/merges
$ hyperfine -L flush 0,1 --warmup 1 --runs 30 \
'GIT_FLUSH={flush} ./git merge-tree --stdin </tmp/merges'
Benchmark 1: GIT_FLUSH=0 ./git merge-tree --stdin </tmp/merges
  Time (mean ± σ):     546.6 ms ±  11.7 ms    [User: 503.2 ms, System: 40.9 ms]
  Range (min … max):   535.9 ms … 567.7 ms    30 runs

Benchmark 2: GIT_FLUSH=1 ./git merge-tree --stdin </tmp/merges
  Time (mean ± σ):     546.9 ms ±  12.0 ms    [User: 505.9 ms, System: 38.9 ms]
  Range (min … max):   529.8 ms … 570.0 ms    30 runs

Summary
  'GIT_FLUSH=0 ./git merge-tree --stdin </tmp/merges' ran
    1.00 ± 0.03 times faster than 'GIT_FLUSH=1 ./git merge-tree --stdin </tmp/merges'

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Acked-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 months agorefspec: clarify function naming and documentation
Meet Soni [Sat, 15 Feb 2025 08:45:39 +0000 (14:15 +0530)] 
refspec: clarify function naming and documentation

Rename `match_name_with_pattern()` to `match_refname_with_pattern()` to
better reflect its purpose and improve documentation comment clarity.
The previous function name and parameter names were inconsistent, making
it harder to understand their roles in refspec matching.

- Rename parameters:
  - `key` -> `pattern` (globbing pattern to match)
  - `name` -> `refname` (refname to check)
  - `value` -> `replacement` (replacement mapping pattern)

Signed-off-by: Meet Soni <meetsoni3017@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 months agoMakefile: set default goals in makefiles
Adam Dinwoodie [Sat, 15 Feb 2025 21:19:03 +0000 (21:19 +0000)] 
Makefile: set default goals in makefiles

Explicitly set the default goal at the very top of various makefiles.
This is already present in some makefiles, but not all of them.

In particular, this corrects a regression introduced in a38edab7c8
(Makefile: generate doc versions via GIT-VERSION-GEN, 2024-12-06).  That
commit added some config files as build targets for the Documentation
directory, and put the target configuration in a sensible place.
Unfortunately, that sensible place was above any other build target
definitions, meaning the default goal changed to being those
configuration files only, rather than the HTML and man page
documentation.

Signed-off-by: Adam Dinwoodie <adam@dinwoodie.org>
Helped-by: Junio C Hamano <gitster@pobox.com>
Acked-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 months agoThe eleventh batch
Junio C Hamano [Sat, 15 Feb 2025 01:53:32 +0000 (17:53 -0800)] 
The eleventh batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 months agoMerge branch 'ps/doc-http-upload-archive-service'
Junio C Hamano [Sat, 15 Feb 2025 01:53:49 +0000 (17:53 -0800)] 
Merge branch 'ps/doc-http-upload-archive-service'

Doc update.

* ps/doc-http-upload-archive-service:
  doc: documentation for http.uploadarchive config option

4 months agoMerge branch 'kn/reflog-migration-fix-followup'
Junio C Hamano [Sat, 15 Feb 2025 01:53:48 +0000 (17:53 -0800)] 
Merge branch 'kn/reflog-migration-fix-followup'

Code clean-up.

* kn/reflog-migration-fix-followup:
  reftable: prevent 'update_index' changes after adding records
  refs: use 'uint64_t' for 'ref_update.index'
  refs: mark `ref_transaction_update_reflog()` as static

4 months agoMerge branch 'bf/fetch-set-head-fix'
Junio C Hamano [Sat, 15 Feb 2025 01:53:48 +0000 (17:53 -0800)] 
Merge branch 'bf/fetch-set-head-fix'

Fetching into a bare repository incorrectly assumed it always used
a mirror layout when deciding to update remote-tracking HEAD, which
has been corrected.

* bf/fetch-set-head-fix:
  fetch set_head: fix non-mirror remotes in bare repositories
  fetch set_head: refactor to use remote directly

4 months agoMerge branch 'op/worktree-is-main-bare-fix'
Junio C Hamano [Sat, 15 Feb 2025 01:53:48 +0000 (17:53 -0800)] 
Merge branch 'op/worktree-is-main-bare-fix'

Going into a secondary worktree and asking "is the main worktree
bare?" did not work correctly when per-worktree configuration
option was in use, which has been corrected.

* op/worktree-is-main-bare-fix:
  worktree: detect from secondary worktree if main worktree is bare

4 months agoMerge branch 'tc/clone-single-revision'
Junio C Hamano [Sat, 15 Feb 2025 01:53:47 +0000 (17:53 -0800)] 
Merge branch 'tc/clone-single-revision'

"git clone" learned to make a shallow clone for a single commit
that is not necessarily be at the tip of any branch.

* tc/clone-single-revision:
  builtin/clone: teach git-clone(1) the --revision= option
  parse-options: introduce die_for_incompatible_opt2()
  clone: introduce struct clone_opts in builtin/clone.c
  clone: add tags refspec earlier to fetch refspec
  clone: refactor wanted_peer_refs()
  clone: make it possible to specify --tags
  clone: cut down on global variables in clone.c

4 months agoMerge branch 'bc/doc-adoc-not-txt'
Junio C Hamano [Sat, 15 Feb 2025 01:53:47 +0000 (17:53 -0800)] 
Merge branch 'bc/doc-adoc-not-txt'

All the documentation .txt files have been renamed to .adoc to help
content aware editors.

* bc/doc-adoc-not-txt:
  Remove obsolete ".txt" extensions for AsciiDoc files
  doc: use .adoc extension for AsciiDoc files
  gitattributes: mark AsciiDoc files as LF-only
  editorconfig: add .adoc extension
  doc: update gitignore for .adoc extension

4 months agoMakefile: remove accidental recipe prefix in conditional
Taylor Blau [Thu, 13 Feb 2025 20:25:50 +0000 (15:25 -0500)] 
Makefile: remove accidental recipe prefix in conditional

Back in 728b9ac0c3 (Makefile(s): avoid recipe prefix in conditional
statements, 2024-04-08), we prepared our Makefiles for a forthcoming
change in upstream Make that would ban the recipe prefix within a
conditional statement by replacing tabs (the prefix) with eight spaces.

In b9d6f64393 (compat/zlib: allow use of zlib-ng as backend,
2025-01-28), a handful of recipe prefix characters were introduced in a
conditional statement ('ifdef ZLIB_NG'), causing 'make' to fail on my
system, which uses GNU Make 4.4.90.

Remove the recipe prefix characters by replacing them with the same
script as is mentioned in 728b9ac0c3.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 months agoThe tenth batch
Junio C Hamano [Wed, 12 Feb 2025 18:09:08 +0000 (10:09 -0800)] 
The tenth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 months agoMerge branch 'da/help-autocorrect-one-fix'
Junio C Hamano [Wed, 12 Feb 2025 18:08:55 +0000 (10:08 -0800)] 
Merge branch 'da/help-autocorrect-one-fix'

"git -c help.autocorrect=0 psuh" shows the suggested typofix,
unlike the previous attempt in the base topic.

* da/help-autocorrect-one-fix:
  help: add "show" as a valid configuration value
  help: show the suggested command when help.autocorrect is false

4 months agoMerge branch 'sc/help-autocorrect-one'
Junio C Hamano [Wed, 12 Feb 2025 18:08:54 +0000 (10:08 -0800)] 
Merge branch 'sc/help-autocorrect-one'

"[help] autocorrect = 1" used to be a way to say "please wait for
0.1 second after suggesting a typofix of the command name before
running that command"; now it means "yes, if there is a plausible
typofix for the command name, please run it immediately".

* sc/help-autocorrect-one:
  help: interpret boolean string values for help.autocorrect

4 months agoMerge branch 'ms/remote-valid-remote-name'
Junio C Hamano [Wed, 12 Feb 2025 18:08:54 +0000 (10:08 -0800)] 
Merge branch 'ms/remote-valid-remote-name'

Code shuffling.

* ms/remote-valid-remote-name:
  remote: relocate valid_remote_name

4 months agoMerge branch 'ms/refspec-cleanup'
Junio C Hamano [Wed, 12 Feb 2025 18:08:54 +0000 (10:08 -0800)] 
Merge branch 'ms/refspec-cleanup'

Code clean-up.  cf. <Z6G-toOJjMmK8iJG@pks.im>

* ms/refspec-cleanup:
  refspec: relocate apply_refspecs and related funtions
  refspec: relocate matching related functions
  remote: rename query_refspecs functions
  refspec: relocate refname_matches_negative_refspec_item
  remote: rename function omit_name_by_refspec

4 months agoMerge branch 'jp/doc-trailer-config'
Junio C Hamano [Wed, 12 Feb 2025 18:08:53 +0000 (10:08 -0800)] 
Merge branch 'jp/doc-trailer-config'

Documentaiton updates.

* jp/doc-trailer-config:
  config.txt: add trailer.* variables

4 months agoMerge branch 'zh/gc-expire-to'
Junio C Hamano [Wed, 12 Feb 2025 18:08:53 +0000 (10:08 -0800)] 
Merge branch 'zh/gc-expire-to'

"git gc" learned the "--expire-to" option and passes it down to
underlying "git repack".

* zh/gc-expire-to:
  gc: add `--expire-to` option

4 months agoMerge branch 'js/libgit-rust'
Junio C Hamano [Wed, 12 Feb 2025 18:08:53 +0000 (10:08 -0800)] 
Merge branch 'js/libgit-rust'

Foreign language interface for Rust into our code base has been added.

* js/libgit-rust:
  libgit: add higher-level libgit crate
  libgit-sys: also export some config_set functions
  libgit-sys: introduce Rust wrapper for libgit.a
  common-main: split init and exit code into new files

4 months agoMerge branch 'ac/t5401-use-test-path-is-file'
Junio C Hamano [Wed, 12 Feb 2025 18:08:52 +0000 (10:08 -0800)] 
Merge branch 'ac/t5401-use-test-path-is-file'

Test clean-up.

* ac/t5401-use-test-path-is-file:
  t5401: prefer test_path_is_* helper function

4 months agoMerge branch 'ac/t6423-unhide-git-exit-status'
Junio C Hamano [Wed, 12 Feb 2025 18:08:52 +0000 (10:08 -0800)] 
Merge branch 'ac/t6423-unhide-git-exit-status'

Test clean-up.

* ac/t6423-unhide-git-exit-status:
  t6423: fix suppression of Git’s exit code in tests

4 months agoMerge branch 'ps/repack-keep-unreachable-in-unpacked-repo'
Junio C Hamano [Wed, 12 Feb 2025 18:08:51 +0000 (10:08 -0800)] 
Merge branch 'ps/repack-keep-unreachable-in-unpacked-repo'

"git repack --keep-unreachable" to send unreachable objects to the
main pack "git repack -ad" produces did not work when there is no
existing packs, which has been corrected.

* ps/repack-keep-unreachable-in-unpacked-repo:
  builtin/repack: fix `--keep-unreachable` when there are no packs

4 months agoMerge branch 'ds/name-hash-tweaks'
Junio C Hamano [Wed, 12 Feb 2025 18:08:51 +0000 (10:08 -0800)] 
Merge branch 'ds/name-hash-tweaks'

"git pack-objects" and its wrapper "git repack" learned an option
to use an alternative path-hash function to improve delta-base
selection to produce a packfile with deeper history than window
size.

* ds/name-hash-tweaks:
  pack-objects: prevent name hash version change
  test-tool: add helper for name-hash values
  p5313: add size comparison test
  pack-objects: add GIT_TEST_NAME_HASH_VERSION
  repack: add --name-hash-version option
  pack-objects: add --name-hash-version option
  pack-objects: create new name-hash function version

4 months agoxdiff: avoid signed vs. unsigned comparisons in xutils.c
David Aguilar [Wed, 12 Feb 2025 06:04:18 +0000 (22:04 -0800)] 
xdiff: avoid signed vs. unsigned comparisons in xutils.c

The comparisons all involve comparisons against unsigned values.

Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 months agoxdiff: avoid signed vs. unsigned comparisons in xpatience.c
David Aguilar [Wed, 12 Feb 2025 06:04:17 +0000 (22:04 -0800)] 
xdiff: avoid signed vs. unsigned comparisons in xpatience.c

The loop iteration variable is non-negative and used in comparisons
against a size_t value. Use size_t to eliminate the mismatch.

Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 months agoxdiff: avoid signed vs. unsigned comparisons in xhistogram.c
David Aguilar [Wed, 12 Feb 2025 06:04:16 +0000 (22:04 -0800)] 
xdiff: avoid signed vs. unsigned comparisons in xhistogram.c

The comparisons all involve unsigned variables. Cast the comparison
to unsigned to eliminate the mismatch.

Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 months agoxdiff: avoid signed vs. unsigned comparisons in xemit.c
David Aguilar [Wed, 12 Feb 2025 06:04:15 +0000 (22:04 -0800)] 
xdiff: avoid signed vs. unsigned comparisons in xemit.c

The unsigned `ignored` variable causes expressions to promote to
unsigned. Use a signed value to make comparisons use the same types.

Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 months agoxdiff: avoid signed vs. unsigned comparisons in xdiffi.c
David Aguilar [Wed, 12 Feb 2025 06:04:14 +0000 (22:04 -0800)] 
xdiff: avoid signed vs. unsigned comparisons in xdiffi.c

The loop iteration variable is non-negative and only used in comparisons
against other size_t values.

Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 months agoxdiff: move sign comparison warning guard into each file
David Aguilar [Wed, 12 Feb 2025 06:04:13 +0000 (22:04 -0800)] 
xdiff: move sign comparison warning guard into each file

Allow each file to fix the warnings guarded by the macro separately by
moving the definition from the shared xinclude.h into each file that
needs it.

xmerge.c and xprepare.c do not contain any signed vs. unsigned
comparisons so the definition was not included in these files.

Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 months agodoc: clarify the intent of the renormalize option in the merge machinery
Elijah Newren [Tue, 11 Feb 2025 21:01:52 +0000 (21:01 +0000)] 
doc: clarify the intent of the renormalize option in the merge machinery

The -X renormalize (or merge.renormalize config) option is intended to
reduce conflicts due to normalization of newer versions of history.  It
does so by renormalizing files that it is about to do a three-way
content merge on.  Some folks thought it would renormalize all files
throughout the tree, and the previous wording wasn't clear enough to
dispell that misconception.  Update the docs to make it clear that the
merge machinery will only apply renormalization to files which need a
three-way content merge.

(Technically, the merge machinery also does renormalization on
modify/delete conflicts, in order to see if the modification was merely
a normalization; if so, it can accept the delete and not report a
conflict.  But it's not clear that this piece needs to be explained to
users, and trying to distinguish it might feel like splitting hairs and
overcomplicating the explanation, so we leave it out.)

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 months agodoc: centrally document various ways tospell `true` and `false`
Junio C Hamano [Tue, 11 Feb 2025 17:20:07 +0000 (09:20 -0800)] 
doc: centrally document various ways tospell `true` and `false`

We do not seem to centrally document exhaustively ways to spell
Boolean values.

The description in the Environment Variables of git(1) section
assumes that the reader is already familiar with how "Boolean valued
configuration variables" are specified, without referring to
anything, so there is no way for the readers to find out more.

The description of `bool` in the section on "--type
<type>" in "git config --help" might be the place to do so, but it
is not telling us all that much.

The description of Boolean valued placeholders in the pretty formats
section of "git log --help" enumerates the possible values with "etc."
implying there may be other synonyms; shrink the list of samples and
instead refer to the canonical and authoritative source of truth, which
now is git-config(1).

Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 months agobuiltin/update-server-info: remove the_repository global variable
Usman Akinyemi [Mon, 10 Feb 2025 18:10:30 +0000 (23:40 +0530)] 
builtin/update-server-info: remove the_repository global variable

Remove the_repository global variable in favor of the repository
argument that gets passed in "builtin/update-server-info.c".

When `-h` is passed to the command outside a Git repository, the
`run_builtin()` will call the `cmd_update_server_info()` function
with `repo` set to NULL and then early in the function, "parse_options()"
call will give the options help and exit, without having to consult much
of the configuration file. So it is safe to omit reading the config when
`repo` argument the caller gave us is NULL.

Mentored-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Usman Akinyemi <usmanakinyemi202@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 months agothunderbird-patch-inline: avoid bashism
brian m. carlson [Mon, 10 Feb 2025 23:49:47 +0000 (23:49 +0000)] 
thunderbird-patch-inline: avoid bashism

The use of "echo -e" is not portable and not specified by POSIX.  dash
does not support any options except "-n", and so this script will not
work on operating systems which use that as /bin/sh.

Fortunately, the solution is easy: switch to printf(1), which is
specified by POSIX and allows the escape sequences we want to use.  This
will allow the script to work with any POSIX shell.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 months agoThe ninth batch
Junio C Hamano [Mon, 10 Feb 2025 18:18:17 +0000 (10:18 -0800)] 
The ninth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 months agoMerge branch 'jk/ci-coverity-update'
Junio C Hamano [Mon, 10 Feb 2025 18:18:31 +0000 (10:18 -0800)] 
Merge branch 'jk/ci-coverity-update'

CI update to make Coverity job work again.

* jk/ci-coverity-update:
  ci: set CI_JOB_IMAGE for coverity job

4 months agoMerge branch 'sk/unit-tests-0130'
Junio C Hamano [Mon, 10 Feb 2025 18:18:31 +0000 (10:18 -0800)] 
Merge branch 'sk/unit-tests-0130'

Convert a handful of unit tests to work with the clar framework.

* sk/unit-tests-0130:
  t/unit-tests: convert strcmp-offset test to use clar test framework
  t/unit-tests: convert strbuf test to use clar test framework
  t/unit-tests: adapt example decorate test to use clar test framework
  t/unit-tests: convert hashmap test to use clar test framework

4 months agoMerge branch 'ps/hash-cleanup'
Junio C Hamano [Mon, 10 Feb 2025 18:18:30 +0000 (10:18 -0800)] 
Merge branch 'ps/hash-cleanup'

Further code clean-up on the use of hash functions.  Now the
context object knows what hash function it is working with.

* ps/hash-cleanup:
  global: adapt callers to use generic hash context helpers
  hash: provide generic wrappers to update hash contexts
  hash: stop typedeffing the hash context
  hash: convert hashing context to a structure

4 months agoMerge branch 'jt/gitlab-ci-base-fix'
Junio C Hamano [Mon, 10 Feb 2025 18:18:30 +0000 (10:18 -0800)] 
Merge branch 'jt/gitlab-ci-base-fix'

Two CI tasks, whitespace check and style check, work on the
difference from the base version and the version being checked, but
the base was computed incorrectly in GitLab CI in some cases, which
has been corrected.

* jt/gitlab-ci-base-fix:
  ci: fix base commit fallback for check-whitespace and check-style