Merge branch 'bc/hash-transition-16'
authorJunio C Hamano <gitster@pobox.com>
Thu, 25 Apr 2019 07:41:17 +0000 (16:41 +0900)
committerJunio C Hamano <gitster@pobox.com>
Thu, 25 Apr 2019 07:41:17 +0000 (16:41 +0900)
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
  ...

12 files changed:
1  2 
builtin/am.c
builtin/difftool.c
dir.c
fast-import.c
http-walker.c
http.c
http.h
pack-bitmap.c
packfile.c
read-cache.c
remote-curl.c
submodule.c

diff --cc builtin/am.c
Simple merge
Simple merge
diff --cc dir.c
Simple merge
diff --cc fast-import.c
Simple merge
diff --cc http-walker.c
Simple merge
diff --cc http.c
Simple merge
diff --cc http.h
Simple merge
diff --cc 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 packfile.c
Simple merge
diff --cc read-cache.c
Simple merge
diff --cc 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);
diff --cc submodule.c
Simple merge