index-pack: avoid excessive re-reading of pack directory
[gitweb.git] / sha1_file.c
index a38854ce553c1e59294d5542a37a5404ccd66dc5..18d0bfb8aca038b6387449efdd5e0ca46749cebf 100644 (file)
@@ -3017,7 +3017,7 @@ int has_sha1_pack(const unsigned char *sha1)
        return find_pack_entry(sha1, &e);
 }
 
-int has_sha1_file(const unsigned char *sha1)
+int has_sha1_file_with_flags(const unsigned char *sha1, int flags)
 {
        struct pack_entry e;
 
@@ -3025,6 +3025,8 @@ int has_sha1_file(const unsigned char *sha1)
                return 1;
        if (has_loose_object(sha1))
                return 1;
+       if (flags & HAS_SHA1_QUICK)
+               return 0;
        reprepare_packed_git();
        return find_pack_entry(sha1, &e);
 }