git-init-db: set up the full default environment
[gitweb.git] / read-tree.c
index 604884a983e087e25afccc1c52beff3883036e58..283f4d8577261645d0f5e2d85b7f74f13b848f79 100644 (file)
@@ -11,11 +11,14 @@ static int unpack_tree(unsigned char *sha1)
 {
        void *buffer;
        unsigned long size;
+       int ret;
 
-       buffer = read_object_with_reference(sha1, "tree", &size, 0);
+       buffer = read_object_with_reference(sha1, "tree", &size, NULL);
        if (!buffer)
                return -1;
-       return read_tree(buffer, size, stage);
+       ret = read_tree(buffer, size, stage);
+       free(buffer);
+       return ret;
 }
 
 static char *lockfile_name;
@@ -156,7 +159,7 @@ static void merge_stat_info(struct cache_entry **src, int nr)
        }
 }
 
-static char *read_tree_usage = "read-tree (<sha> | -m <sha1> [<sha2> <sha3>])";
+static char *read_tree_usage = "git-read-tree (<sha> | -m <sha1> [<sha2> <sha3>])";
 
 int main(int argc, char **argv)
 {
@@ -191,7 +194,7 @@ int main(int argc, char **argv)
                        merge = 1;
                        continue;
                }
-               if (get_sha1_hex(arg, sha1) < 0)
+               if (get_sha1(arg, sha1) < 0)
                        usage(read_tree_usage);
                if (stage > 3)
                        usage(read_tree_usage);