Merge branch 'jk/get-oid-indexed-object-name'
authorJunio C Hamano <gitster@pobox.com>
Sun, 19 May 2019 07:45:35 +0000 (16:45 +0900)
committerJunio C Hamano <gitster@pobox.com>
Sun, 19 May 2019 07:45:35 +0000 (16:45 +0900)
The codepath to parse :<path> that obtains the object name for an
indexed object has been made more robust.

* jk/get-oid-indexed-object-name:
get_oid: handle NULL repo->index

1  2 
sha1-name.c
diff --combined sha1-name.c
index b4f5cadae745e54d03729f135a2208a3067ad0fa,455e9fb1eaa20e781aa63e67a7ffe41525c9ac57..728e6f1f61ea4641272e59e6287b6b47bfe0c74e
@@@ -157,9 -157,6 +157,9 @@@ static void unique_in_pack(struct packe
        uint32_t num, i, first = 0;
        const struct object_id *current = NULL;
  
 +      if (p->multi_pack_index)
 +              return;
 +
        if (open_pack_index(p) || !p->num_objects)
                return;
  
@@@ -628,9 -625,6 +628,9 @@@ static void find_abbrev_len_for_pack(st
        struct object_id oid;
        const struct object_id *mad_oid;
  
 +      if (p->multi_pack_index)
 +              return;
 +
        if (open_pack_index(p) || !p->num_objects)
                return;
  
@@@ -1843,7 -1837,7 +1843,7 @@@ static enum get_oid_result get_oid_with
                if (flags & GET_OID_RECORD_PATH)
                        oc->path = xstrdup(cp);
  
-               if (!repo->index->cache)
+               if (!repo->index || !repo->index->cache)
                        repo_read_index(repo);
                pos = index_name_pos(repo->index, cp, namelen);
                if (pos < 0)