diff options
| author | Junio C Hamano <gitster@pobox.com> | 2018-10-30 15:43:42 +0900 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2018-10-30 15:43:42 +0900 |
| commit | d829d491eebddc2eefcaa9279ac4b67c7eefbd52 (patch) | |
| tree | cb639ce3f677d995b42a3537d00ee74b8b4797c6 /builtin/fetch-pack.c | |
| parent | 7dc3e5a3be73cf0cbb5f3af6d8e3bb10c70cca3e (diff) | |
| parent | 0d7c419a94b7524ac854d5a6002b7541abab4f12 (diff) | |
| download | git-d829d491eebddc2eefcaa9279ac4b67c7eefbd52.tar.xz | |
Merge branch 'bc/hash-transition-part-15'
More codepaths are moving away from hardcoded hash sizes.
* bc/hash-transition-part-15:
rerere: convert to use the_hash_algo
submodule: make zero-oid comparison hash function agnostic
apply: rename new_sha1_prefix and old_sha1_prefix
apply: replace hard-coded constants
tag: express constant in terms of the_hash_algo
transport: use parse_oid_hex instead of a constant
upload-pack: express constants in terms of the_hash_algo
refs/packed-backend: express constants using the_hash_algo
packfile: express constants in terms of the_hash_algo
pack-revindex: express constants in terms of the_hash_algo
builtin/fetch-pack: remove constants with parse_oid_hex
builtin/mktree: remove hard-coded constant
builtin/repack: replace hard-coded constants
pack-bitmap-write: use GIT_MAX_RAWSZ for allocation
object_id.cocci: match only expressions of type 'struct object_id'
Diffstat (limited to 'builtin/fetch-pack.c')
| -rw-r--r-- | builtin/fetch-pack.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/builtin/fetch-pack.c b/builtin/fetch-pack.c index 1a1bc63566..63e69a5801 100644 --- a/builtin/fetch-pack.c +++ b/builtin/fetch-pack.c @@ -16,13 +16,14 @@ static void add_sought_entry(struct ref ***sought, int *nr, int *alloc, { struct ref *ref; struct object_id oid; + const char *p; - if (!get_oid_hex(name, &oid)) { - if (name[GIT_SHA1_HEXSZ] == ' ') { - /* <sha1> <ref>, find refname */ - name += GIT_SHA1_HEXSZ + 1; - } else if (name[GIT_SHA1_HEXSZ] == '\0') { - ; /* <sha1>, leave sha1 as name */ + if (!parse_oid_hex(name, &oid, &p)) { + if (*p == ' ') { + /* <oid> <ref>, find refname */ + name = p + 1; + } else if (*p == '\0') { + ; /* <oid>, leave oid as name */ } else { /* <ref>, clear cruft from oid */ oidclr(&oid); |
