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>

brian m. carlson committed May 6, 2017 at 22:10 UTC a9b5f5bfd50bfd0a96e464ccf926092ffe03163a
1 file changed +3 -3
builtin/ls-tree.c
+3 -3
@@ -119,7 +119,7 @@ static int show_tree(const unsigned char *sha1, struct strbuf *base,
119
120 int cmd_ls_tree(int argc, const char **argv, const char *prefix)
121 {
122 - unsigned char sha1[20];
122 + struct object_id oid;
123 struct tree *tree;
124 int i, full_tree = 0;
125 const struct option ls_tree_options[] = {
@@ -164,7 +164,7 @@ int cmd_ls_tree(int argc, const char **argv, const char *prefix)
164
165 if (argc < 1)
166 usage_with_options(ls_tree_usage, ls_tree_options);
167 - if (get_sha1(argv[0], sha1))
167 + if (get_oid(argv[0], &oid))
168 die("Not a valid object name %s", argv[0]);
169
170 /*
@@ -180,7 +180,7 @@ int cmd_ls_tree(int argc, const char **argv, const char *prefix)
180 for (i = 0; i < pathspec.nr; i++)
181 pathspec.items[i].nowildcard_len = pathspec.items[i].len;
182 pathspec.has_wildcard = 0;
183 - tree = parse_tree_indirect(sha1);
183 + tree = parse_tree_indirect(oid.hash);
184 if (!tree)
185 die("not a tree object");
186 return !!read_tree_recursive(tree, "", 0, 0, &pathspec, show_tree, NULL);