Merge branch 'cc/shared-index-permfix'
[gitweb.git] / builtin / cat-file.c
index 9af863e7915d21aee7af3cb4d01ebbad2efbcb59..7efbc4019ac59a16ae4f147889e6f489dac1e661 100644 (file)
@@ -4,7 +4,9 @@
  * Copyright (C) Linus Torvalds, 2005
  */
 #include "cache.h"
+#include "config.h"
 #include "builtin.h"
+#include "diff.h"
 #include "parse-options.h"
 #include "userdiff.h"
 #include "streaming.h"
@@ -61,7 +63,8 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name,
        if (unknown_type)
                flags |= LOOKUP_UNKNOWN_OBJECT;
 
-       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)
@@ -166,6 +169,7 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name,
 
        write_or_die(1, buf, size);
        free(buf);
+       free(obj_context.path);
        return 0;
 }