i18n: git-checkout describe_detached_head messages
[gitweb.git] / sha1_file.c
index 9fd7e166d1451da7957fe45d1adf7f9a7767fc7e..27730c334cb433ef749a0efc5353a7f38032559c 100644 (file)
@@ -52,7 +52,7 @@ static struct cached_object {
 static int cached_object_nr, cached_object_alloc;
 
 static struct cached_object empty_tree = {
-       EMPTY_TREE_SHA1_BIN,
+       EMPTY_TREE_SHA1_BIN_LITERAL,
        OBJ_TREE,
        "",
        0
@@ -2020,9 +2020,17 @@ static int sha1_loose_object_info(const unsigned char *sha1, unsigned long *size
 
 int sha1_object_info(const unsigned char *sha1, unsigned long *sizep)
 {
+       struct cached_object *co;
        struct pack_entry e;
        int status;
 
+       co = find_cached_object(sha1);
+       if (co) {
+               if (sizep)
+                       *sizep = co->size;
+               return co->type;
+       }
+
        if (!find_pack_entry(sha1, &e)) {
                /* Most likely it's a loose object. */
                status = sha1_loose_object_info(sha1, sizep);