sha1_file: rename LOOKUP_UNKNOWN_OBJECT
[gitweb.git] / builtin / cat-file.c
index 1890d7a6390dcae719af33ce5cb59e74832a80e8..209374b3caf1d9268f54c4d8dd2ac932fb6b62b7 100644 (file)
@@ -5,6 +5,7 @@
  */
 #include "cache.h"
 #include "builtin.h"
+#include "diff.h"
 #include "parse-options.h"
 #include "userdiff.h"
 #include "streaming.h"
@@ -59,9 +60,10 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name,
        const char *path = force_path;
 
        if (unknown_type)
-               flags |= LOOKUP_UNKNOWN_OBJECT;
+               flags |= OBJECT_INFO_ALLOW_UNKNOWN_TYPE;
 
-       if (get_sha1_with_context(obj_name, 0, oid.hash, &obj_context))
+       if (get_sha1_with_context(obj_name, GET_SHA1_RECORD_PATH,
+                                 oid.hash, &obj_context))
                die("Not a valid object name %s", obj_name);
 
        if (!path)
@@ -165,6 +167,8 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name,
                die("git cat-file %s: bad file", obj_name);
 
        write_or_die(1, buf, size);
+       free(buf);
+       free(obj_context.path);
        return 0;
 }