From: Junio C Hamano Date: Thu, 25 Apr 2019 07:41:17 +0000 (+0900) Subject: Merge branch 'bc/hash-transition-16' X-Git-Tag: v2.22.0-rc0~58 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d4e568b2a31d7b2fe45dac9165bb077b570fc96a;p=git Merge branch 'bc/hash-transition-16' Conversion from unsigned char[20] to struct object_id continues. * bc/hash-transition-16: (35 commits) gitweb: make hash size independent Git.pm: make hash size independent read-cache: read data in a hash-independent way dir: make untracked cache extension hash size independent builtin/difftool: use parse_oid_hex refspec: make hash size independent archive: convert struct archiver_args to object_id builtin/get-tar-commit-id: make hash size independent get-tar-commit-id: parse comment record hash: add a function to lookup hash algorithm by length remote-curl: make hash size independent http: replace sha1_to_hex http: compute hash of downloaded objects using the_hash_algo http: replace hard-coded constant with the_hash_algo http-walker: replace sha1_to_hex http-push: remove remaining uses of sha1_to_hex http-backend: allow 64-character hex names http-push: convert to use the_hash_algo builtin/pull: make hash-size independent builtin/am: make hash size independent ... --- d4e568b2a31d7b2fe45dac9165bb077b570fc96a diff --cc pack-bitmap.c index 3960ad94c8,70d51f4f50..6069b2fe55 --- a/pack-bitmap.c +++ b/pack-bitmap.c @@@ -306,10 -306,9 +306,10 @@@ static int load_pack_bitmap(struct bitm { assert(bitmap_git->map); - bitmap_git->bitmaps = kh_init_sha1(); - bitmap_git->ext_index.positions = kh_init_sha1_pos(); + bitmap_git->bitmaps = kh_init_oid_map(); + bitmap_git->ext_index.positions = kh_init_oid_pos(); - load_pack_revindex(bitmap_git->pack); + if (load_pack_revindex(bitmap_git->pack)) + goto failed; if (!(bitmap_git->commits = read_bitmap_1(bitmap_git)) || !(bitmap_git->trees = read_bitmap_1(bitmap_git)) || diff --cc remote-curl.c index 8bba57270b,cc74ff3ec1..a1bf4f68c7 --- a/remote-curl.c +++ b/remote-curl.c @@@ -250,9 -249,9 +250,9 @@@ static struct ref *parse_info_refs(stru if (data[i] == '\t') mid = &data[i]; if (data[i] == '\n') { - if (mid - start != 40) + if (mid - start != the_hash_algo->hexsz) - die("%sinfo/refs not valid: is this a git repository?", - url.buf); + die(_("%sinfo/refs not valid: is this a git repository?"), + transport_anonymize_url(url.buf)); data[i] = 0; ref_name = mid + 1; ref = alloc_ref(ref_name); @@@ -1114,15 -1107,16 +1114,16 @@@ static void parse_fetch(struct strbuf * const char *name; struct ref *ref; struct object_id old_oid; + const char *q; - if (get_oid_hex(p, &old_oid)) + if (parse_oid_hex(p, &old_oid, &q)) - die("protocol error: expected sha/ref, got %s'", p); + die(_("protocol error: expected sha/ref, got %s'"), p); - if (p[GIT_SHA1_HEXSZ] == ' ') - name = p + GIT_SHA1_HEXSZ + 1; - else if (!p[GIT_SHA1_HEXSZ]) + if (*q == ' ') + name = q + 1; + else if (!*q) name = ""; else - die("protocol error: expected sha/ref, got %s'", p); + die(_("protocol error: expected sha/ref, got %s'"), p); ref = alloc_ref(name); oidcpy(&ref->old_oid, &old_oid);