<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/refs.c, branch jch</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=jch</id>
<link rel='self' href='https://git.shady.money/git/atom?h=jch'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2026-04-17T04:27:17Z</updated>
<entry>
<title>Merge branch 'sp/refs-reduce-the-repository' into jch</title>
<updated>2026-04-17T04:27:17Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2026-04-17T04:27:17Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=7280faf28d4c2ee928bfcd9ebce975b9f24eb687'/>
<id>urn:sha1:7280faf28d4c2ee928bfcd9ebce975b9f24eb687</id>
<content type='text'>
Code clean-up to use the right instance of a repository instance in
calls inside refs subsystem.

* sp/refs-reduce-the-repository:
  refs/reftable-backend: drop uses of the_repository
  refs: remove the_hash_algo global state
  refs: add struct repository parameter in get_files_ref_lock_timeout_ms()
</content>
</entry>
<entry>
<title>Merge branch 'ps/odb-cleanup'</title>
<updated>2026-04-08T17:19:17Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2026-04-08T17:19:17Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=9797fed6cea706f65de64396222545d545226e15'/>
<id>urn:sha1:9797fed6cea706f65de64396222545d545226e15</id>
<content type='text'>
Various code clean-up around odb subsystem.

* ps/odb-cleanup:
  odb: drop unneeded headers and forward decls
  odb: rename `odb_has_object()` flags
  odb: use enum for `odb_write_object` flags
  odb: rename `odb_write_object()` flags
  treewide: use enum for `odb_for_each_object()` flags
  CodingGuidelines: document our style for flags
</content>
</entry>
<entry>
<title>refs: remove the_hash_algo global state</title>
<updated>2026-04-08T16:58:10Z</updated>
<author>
<name>Shreyansh Paliwal</name>
<email>shreyanshpaliwalcmsmn@gmail.com</email>
</author>
<published>2026-04-04T13:58:39Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=9a03f165a41d708c672e18e69d43f69689981e7d'/>
<id>urn:sha1:9a03f165a41d708c672e18e69d43f69689981e7d</id>
<content type='text'>
refs.c uses the_hash_algo in multiple places, relying on global state for
the object hash algorithm. Replace these uses with the appropriate
repository-specific hash_algo. In transaction-related functions
(ref_transaction_create, ref_transaction_delete, migrate_one_ref, and
transaction_hook_feed_stdin), use transaction-&gt;ref_store-&gt;repo-&gt;hash_algo.
In other cases, such as repo_get_submodule_ref_store(), use
repo-&gt;hash_algo.

Signed-off-by: Shreyansh Paliwal &lt;shreyanshpaliwalcmsmn@gmail.com&gt;
Acked-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>refs: add struct repository parameter in get_files_ref_lock_timeout_ms()</title>
<updated>2026-04-08T16:58:09Z</updated>
<author>
<name>Shreyansh Paliwal</name>
<email>shreyanshpaliwalcmsmn@gmail.com</email>
</author>
<published>2026-04-04T13:58:38Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=b886f0b5dc71030bc9dcf58376533cf8e1098e9a'/>
<id>urn:sha1:b886f0b5dc71030bc9dcf58376533cf8e1098e9a</id>
<content type='text'>
get_files_ref_lock_timeout_ms() calls repo_config_get_int() using
the_repository, as no repository instance is available in its scope. Add a
struct repository parameter and use it instead of the_repository.

Update all callers accordingly. In files-backend.c, lock_raw_ref() can
obtain repository instance from the struct ref_transaction via
transaction-&gt;ref_store-&gt;repo and pass it down. For create_reflock(), which
is used as a callback, introduce a small wrapper struct to pass both struct
lock_file and struct repository through the callback data.

This reduces reliance on the_repository global, though the function
still uses static variables and is not yet fully repository-scoped.
This can be addressed in a follow-up change.

Signed-off-by: Shreyansh Paliwal &lt;shreyanshpaliwalcmsmn@gmail.com&gt;
Acked-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'ar/config-hook-cleanups'</title>
<updated>2026-04-03T20:01:09Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2026-04-03T20:01:08Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=0cd4fb9f46eb0ebd0d243a886ce9a52210e0723e'/>
<id>urn:sha1:0cd4fb9f46eb0ebd0d243a886ce9a52210e0723e</id>
<content type='text'>
Code clean-up around the recent "hooks defined in config" topic.

* ar/config-hook-cleanups:
  hook: reject unknown hook names in git-hook(1)
  hook: show disabled hooks in "git hook list"
  hook: show config scope in git hook list
  hook: introduce hook_config_cache_entry for per-hook data
  t1800: add test to verify hook execution ordering
  hook: make consistent use of friendly-name in docs
  hook: replace hook_list_clear() -&gt; string_list_clear_func()
  hook: detect &amp; emit two more bugs
  hook: rename cb_data_free/alloc -&gt; hook_data_free/alloc
  hook: fix minor style issues
  builtin/receive-pack: properly init receive_hook strbuf
  hook: move unsorted_string_list_remove() to string-list.[ch]
</content>
</entry>
<entry>
<title>odb: rename `odb_has_object()` flags</title>
<updated>2026-04-01T03:43:14Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2026-03-31T23:57:50Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c63911b052dc286de5daddba8d4a20fd59348cee'/>
<id>urn:sha1:c63911b052dc286de5daddba8d4a20fd59348cee</id>
<content type='text'>
Rename `odb_has_object()` flags to be properly prefixed with the
function name.

Signed-off-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'jw/object-name-bitset-to-enum'</title>
<updated>2026-03-30T20:57:02Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2026-03-30T20:57:02Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a1d7a8fef1114c5808c3c148661243b7ce0723b9'/>
<id>urn:sha1:a1d7a8fef1114c5808c3c148661243b7ce0723b9</id>
<content type='text'>
The unsigned integer that is used as an bitset to specify the kind
of branches interpret_branch_name() function has been changed to
use a dedicated enum type.

* jw/object-name-bitset-to-enum:
  object-name: turn INTERPRET_BRANCH_* constants into enum values
</content>
</entry>
<entry>
<title>hook: fix minor style issues</title>
<updated>2026-03-25T21:00:45Z</updated>
<author>
<name>Adrian Ratiu</name>
<email>adrian.ratiu@collabora.com</email>
</author>
<published>2026-03-25T19:54:54Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=b06770e5d8948c7cad76d7507423376eacf1e005'/>
<id>urn:sha1:b06770e5d8948c7cad76d7507423376eacf1e005</id>
<content type='text'>
Fix some minor style nits pointed out by Patrick, Junio and Eric:
  * Use CALLOC_ARRAY instead of xcalloc.
  * Init struct members during declaration.
  * Simplify if condition boolean logic.
  * Missing curly braces in if/else stmts.
  * Unnecessary header includes.
  * Capitalization and full-stop in error/warn messages.
  * Curly brace on separate line when defining struct.
  * Comment spelling: free'd -&gt; freed.
  * Sort the included headers.
  * Blank line fixes to improve readability.

These contain no logic changes, the code behaves the same as before.

Suggested-by: Eric Sunshine &lt;sunshine@sunshineco.com&gt;
Suggested-by: Junio C Hamano &lt;gitster@pobox.com&gt;
Suggested-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Adrian Ratiu &lt;adrian.ratiu@collabora.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>object-name: turn INTERPRET_BRANCH_* constants into enum values</title>
<updated>2026-03-18T19:52:29Z</updated>
<author>
<name>Jialong Wang</name>
<email>jerrywang183@yahoo.com</email>
</author>
<published>2026-03-18T19:09:42Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c5fc44f54595f123c277e5839cbafa1bc9c8c050'/>
<id>urn:sha1:c5fc44f54595f123c277e5839cbafa1bc9c8c050</id>
<content type='text'>
Replace the INTERPRET_BRANCH_* preprocessor constants with enum
values and use that type where these flags are stored or passed
around.

These flags describe which kinds of branches may be considered during
branch-name interpretation, so represent them as an enum describing
branch kinds while keeping the existing bitmask semantics and
INTERPRET_BRANCH_* element names.

Signed-off-by: Jialong Wang &lt;jerrywang183@yahoo.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>refs: add 'preparing' phase to the reference-transaction hook</title>
<updated>2026-03-17T04:00:44Z</updated>
<author>
<name>Eric Ju</name>
<email>eric.peijian@gmail.com</email>
</author>
<published>2026-03-17T02:36:24Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=60d8c1e97d62c27ef60db0bc3d5deadd6dfdb98d'/>
<id>urn:sha1:60d8c1e97d62c27ef60db0bc3d5deadd6dfdb98d</id>
<content type='text'>
The "reference-transaction" hook is invoked multiple times during a ref
transaction. Each invocation corresponds to a different phase:

- The "prepared" phase indicates that references have been locked.
- The "committed" phase indicates that all updates have been written to disk.
- The "aborted" phase indicates that the transaction has been aborted and that
  all changes have been rolled back.

This hook can be used to learn about the updates that Git wants to perform.
For example, forges use it to coordinate reference updates across multiple
nodes.

However, the phases are insufficient for some specific use cases. The earliest
observable phase in the "reference-transaction" hook is "prepared", at which
point Git has already taken exclusive locks on every affected reference. This
makes it suitable for last-chance validation, but not for serialization. So by
the time a hook sees the "prepared" phase, it has no way to defer locking, and
thus it cannot rearrange multiple concurrent ref transactions relative to one
another.

Introduce a new "preparing" phase that runs before the "prepared" phase, that
is before Git acquires any reference lock on disk. This gives callers a
well-defined window to perform validation, enable higher-level ordering of
concurrent transactions, or reject the transaction entirely, all without
interfering with the locking state.

This change is strictly speaking not backwards compatible. Existing hook
scripts that do not know how to handle unknown phases may treat 'preparing'
as an error and return non-zero. But the hook is considered to expose
internal implementation details of how Git works, and as such we have
been a bit more lenient with changing its exact semantics, like for example
in a8ae923f85 (refs: support symrefs in 'reference-transaction' hook, 2024-05-07).

An alternative would be to introduce a "reference-transaction-v2" hook that
knows about the new phase. This feels like a rather heavy-weight option though,
and was thus discarded.

Helped-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Helped-by: Justin Tobler &lt;jltobler@gmail.com&gt;
Helped-by: Karthik Nayak &lt;karthik.188@gmail.com&gt;
Signed-off-by: Eric Ju &lt;eric.peijian@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
