Merge branch 'bc/hash-transition-part-15'
authorJunio C Hamano <gitster@pobox.com>
Tue, 30 Oct 2018 06:43:42 +0000 (15:43 +0900)
committerJunio C Hamano <gitster@pobox.com>
Tue, 30 Oct 2018 06:43:42 +0000 (15:43 +0900)
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'

1  2 
apply.c
pack-bitmap-write.c
packfile.c
rerere.c
transport.c
upload-pack.c
diff --cc apply.c
Simple merge
Simple merge
diff --cc packfile.c
Simple merge
diff --cc rerere.c
index 887e26d45bfa1071736ef016d82c69de90b14f8d,ceb98015ffa0617f11894dc00c62b174f45c5e4c..b5b2357411f145867eb1918cbc79f77c6192db1a
+++ b/rerere.c
@@@ -462,8 -465,7 +465,8 @@@ static int handle_path(unsigned char *h
   * Scan the path for conflicts, do the "handle_path()" thing above, and
   * return the number of conflict hunks found.
   */
- static int handle_file(struct index_state *istate, const char *path,
-                      unsigned char *sha1, const char *output)
 -static int handle_file(const char *path, unsigned char *hash, const char *output)
++static int handle_file(struct index_state *istate,
++                     const char *path, unsigned char *hash, const char *output)
  {
        int has_conflicts = 0;
        struct rerere_io_file io;
@@@ -830,7 -826,7 +833,7 @@@ static int do_plain_rerere(struct repos
                 * conflict ID.  No need to write anything out
                 * yet.
                 */
-               ret = handle_file(r->index, path, sha1, NULL);
 -              ret = handle_file(path, hash, NULL);
++              ret = handle_file(r->index, path, hash, NULL);
                if (ret != 0 && string_list_has_string(rr, path)) {
                        remove_variant(string_list_lookup(rr, path)->util);
                        string_list_remove(rr, path, 1);
@@@ -949,8 -945,7 +952,8 @@@ static int rerere_mem_getline(struct st
        return 0;
  }
  
- static int handle_cache(struct index_state *istate, const char *path,
-                       unsigned char *sha1, const char *output)
 -static int handle_cache(const char *path, unsigned char *hash, const char *output)
++static int handle_cache(struct index_state *istate,
++                      const char *path, unsigned char *hash, const char *output)
  {
        mmfile_t mmfile[3] = {{NULL}};
        mmbuffer_t result = {NULL, 0};
@@@ -1031,7 -1023,7 +1034,7 @@@ static int rerere_forget_one_path(struc
         * Recreate the original conflict from the stages in the
         * index and compute the conflict ID
         */
-       ret = handle_cache(istate, path, sha1, NULL);
 -      ret = handle_cache(path, hash, NULL);
++      ret = handle_cache(istate, path, hash, NULL);
        if (ret < 1)
                return error(_("could not parse conflict hunks in '%s'"), path);
  
                if (!has_rerere_resolution(id))
                        continue;
  
-               handle_cache(istate, path, sha1, rerere_path(id, "thisimage"));
 -              handle_cache(path, hash, rerere_path(id, "thisimage"));
++              handle_cache(istate, path, hash, rerere_path(id, "thisimage"));
                if (read_mmfile(&cur, rerere_path(id, "thisimage"))) {
                        free(cur.ptr);
                        error(_("failed to update conflicted state in '%s'"), path);
         * conflict in the working tree, run us again to record
         * the postimage.
         */
-       handle_cache(istate, path, sha1, rerere_path(id, "preimage"));
 -      handle_cache(path, hash, rerere_path(id, "preimage"));
++      handle_cache(istate, path, hash, rerere_path(id, "preimage"));
        fprintf_ln(stderr, _("Updated preimage for '%s'"), path);
  
        /*
diff --cc transport.c
index f4ffbd96cb65fdbac3c74d3d60c253bc3a8884f6,44b9ddf670531d8f27f8aaca9bee8ebadc2df6e7..01ce11a32575fc8ca889ba99f610983ef150688d
@@@ -1413,9 -1346,10 +1413,9 @@@ static void read_alternate_refs(const c
        fh = xfdopen(cmd.out, "r");
        while (strbuf_getline_lf(&line, fh) != EOF) {
                struct object_id oid;
+               const char *p;
  
-               if (get_oid_hex(line.buf, &oid) ||
-                   line.buf[GIT_SHA1_HEXSZ]) {
 -              if (parse_oid_hex(line.buf, &oid, &p) ||
 -                  *p != ' ') {
++              if (parse_oid_hex(line.buf, &oid, &p) || *p) {
                        warning(_("invalid line while parsing alternate refs: %s"),
                                line.buf);
                        break;
diff --cc upload-pack.c
Simple merge