Skip to content

Commit a9b5f5b

Browse files
bk2204gitster
authored andcommitted
builtin/ls-tree: convert to struct object_id
This is a prerequisite to convert do_diff_cache, which is required to convert parse_tree_indirect. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent f06e90d commit a9b5f5b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

builtin/ls-tree.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ static int show_tree(const unsigned char *sha1, struct strbuf *base,
119119

120120
int cmd_ls_tree(int argc, const char **argv, const char *prefix)
121121
{
122-
unsigned char sha1[20];
122+
struct object_id oid;
123123
struct tree *tree;
124124
int i, full_tree = 0;
125125
const struct option ls_tree_options[] = {
@@ -164,7 +164,7 @@ int cmd_ls_tree(int argc, const char **argv, const char *prefix)
164164

165165
if (argc < 1)
166166
usage_with_options(ls_tree_usage, ls_tree_options);
167-
if (get_sha1(argv[0], sha1))
167+
if (get_oid(argv[0], &oid))
168168
die("Not a valid object name %s", argv[0]);
169169

170170
/*
@@ -180,7 +180,7 @@ int cmd_ls_tree(int argc, const char **argv, const char *prefix)
180180
for (i = 0; i < pathspec.nr; i++)
181181
pathspec.items[i].nowildcard_len = pathspec.items[i].len;
182182
pathspec.has_wildcard = 0;
183-
tree = parse_tree_indirect(sha1);
183+
tree = parse_tree_indirect(oid.hash);
184184
if (!tree)
185185
die("not a tree object");
186186
return !!read_tree_recursive(tree, "", 0, 0, &pathspec, show_tree, NULL);

0 commit comments

Comments
 (0)