]> git.ipfire.org Git - thirdparty/git.git/commit
refspec: let callers pass in hash algorithm when parsing items
authorPatrick Steinhardt <ps@pks.im>
Thu, 16 Jul 2026 12:38:03 +0000 (14:38 +0200)
committerJunio C Hamano <gitster@pobox.com>
Thu, 16 Jul 2026 20:58:25 +0000 (13:58 -0700)
commitbb71c3f19e6a693fc1d32e4448be8520132d946e
tree4034fc6906f95bfd48f99b43bea61a32a152ea6a
parent991ec2741d723d0737bd5410f01b7f98b89d9186
refspec: let callers pass in hash algorithm when parsing items

When parsing a refspec item we need to know about the hash algorithm
used by the repository so that we can decide whether or not a given
string is an exact object ID. We use `the_hash_algo` for this, which
makes the code implicitly depend on `the_repository`.

Refactor `refspec_item_init_fetch()`, `refspec_item_init_push()` and
`valid_fetch_refspec()` so that callers have to pass in the hash
algorithm explicitly and adapt callers accordingly. For now, all of
the callers simply pass `the_hash_algo`, so there is no change in
behaviour.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/fetch.c
builtin/pull.c
refspec.c
refspec.h
remote.c