diff options
| author | Eric W. Biederman <ebiederm@xmission.com> | 2023-10-01 21:40:07 -0500 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2023-10-02 14:57:38 -0700 |
| commit | 52fca06db28a23fcea159431c1c9dafca26d609c (patch) | |
| tree | bdb3341d6f511c7b85836272cf6a8b3a193ace77 /hash-ll.h | |
| parent | oid-array: teach oid-array to handle multiple kinds of oids (diff) | |
| download | git-52fca06db28a23fcea159431c1c9dafca26d609c.tar.gz git-52fca06db28a23fcea159431c1c9dafca26d609c.zip | |
object-names: support input of oids in any supported hash
Support short oids encoded in any algorithm, while ensuring enough of
the oid is specified to disambiguate between all of the oids in the
repository encoded in any algorithm.
By default have the code continue to only accept oids specified in the
storage hash algorithm of the repository, but when something is
ambiguous display all of the possible oids from any accepted oid
encoding.
A new flag is added GET_OID_HASH_ANY that when supplied causes the
code to accept oids specified in any hash algorithm, and to return the
oids that were resolved.
This implements the functionality that allows both SHA-1 and SHA-256
object names, from the "Object names on the command line" section of
the hash function transition document.
Care is taken in get_short_oid so that when the result is ambiguous
the output remains the same if GIT_OID_HASH_ANY was not supplied. If
GET_OID_HASH_ANY was supplied objects of any hash algorithm that match
the prefix are displayed.
This required updating repo_for_each_abbrev to give it a parameter so
that it knows to look at all hash algorithms.
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'hash-ll.h')
| -rw-r--r-- | hash-ll.h | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -145,6 +145,7 @@ struct object_id { #define GET_OID_RECORD_PATH 0200 #define GET_OID_ONLY_TO_DIE 04000 #define GET_OID_REQUIRE_PATH 010000 +#define GET_OID_HASH_ANY 020000 #define GET_OID_DISAMBIGUATORS \ (GET_OID_COMMIT | GET_OID_COMMITTISH | \ |
