builtin/read-tree: convert to struct object_id
This is a caller of parse_tree_indirect, which must be converted in order to convert parse_object. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
brian m. carlson committed
May 6, 2017 at 22:10 UTC
4939e2c435529095059faa72a4004a4849fb8682
1 file changed
+5
-5
builtin/read-tree.c
+5
-5
@@ -23,13 +23,13 @@ static int read_empty;
23
static struct tree *trees[MAX_UNPACK_TREES];
24
static int recurse_submodules = RECURSE_SUBMODULES_DEFAULT;
25
26
-static int list_tree(unsigned char *sha1)
26
+static int list_tree(struct object_id *oid)
27
{
28
struct tree *tree;
29
30
if (nr_trees >= MAX_UNPACK_TREES)
31
die("I cannot read more than %d trees", MAX_UNPACK_TREES);
32
- tree = parse_tree_indirect(sha1);
32
+ tree = parse_tree_indirect(oid->hash);
33
if (!tree)
34
return -1;
35
trees[nr_trees++] = tree;
@@ -121,7 +121,7 @@ static struct lock_file lock_file;
121
int cmd_read_tree(int argc, const char **argv, const char *unused_prefix)
122
{
123
int i, stage = 0;
124
- unsigned char sha1[20];
124
+ struct object_id oid;
125
struct tree_desc t[MAX_UNPACK_TREES];
126
struct unpack_trees_options opts;
127
int prefix_set = 0;
@@ -204,9 +204,9 @@ int cmd_read_tree(int argc, const char **argv, const char *unused_prefix)
204
for (i = 0; i < argc; i++) {
205
const char *arg = argv[i];
206
207
- if (get_sha1(arg, sha1))
207
+ if (get_oid(arg, &oid))
208
die("Not a valid object name %s", arg);
209
- if (list_tree(sha1) < 0)
209
+ if (list_tree(&oid) < 0)
210
die("failed to unpack tree object %s", arg);
211
stage++;
212
}