]> git.ipfire.org Git - thirdparty/git.git/commitdiff
builtin/ls-tree: convert to struct object_id
authorbrian m. carlson <sandals@crustytoothpaste.net>
Sat, 6 May 2017 22:10:34 +0000 (22:10 +0000)
committerJunio C Hamano <gitster@pobox.com>
Mon, 8 May 2017 06:12:58 +0000 (15:12 +0900)
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>
builtin/ls-tree.c

index d7ebeb4ce6b1f1a0491f8db8a66001968a41b641..5baac3ef2fa5d3d9ebabd2dd699f89e0d3115846 100644 (file)
@@ -119,7 +119,7 @@ static int show_tree(const unsigned char *sha1, struct strbuf *base,
 
 int cmd_ls_tree(int argc, const char **argv, const char *prefix)
 {
-       unsigned char sha1[20];
+       struct object_id oid;
        struct tree *tree;
        int i, full_tree = 0;
        const struct option ls_tree_options[] = {
@@ -164,7 +164,7 @@ int cmd_ls_tree(int argc, const char **argv, const char *prefix)
 
        if (argc < 1)
                usage_with_options(ls_tree_usage, ls_tree_options);
-       if (get_sha1(argv[0], sha1))
+       if (get_oid(argv[0], &oid))
                die("Not a valid object name %s", argv[0]);
 
        /*
@@ -180,7 +180,7 @@ int cmd_ls_tree(int argc, const char **argv, const char *prefix)
        for (i = 0; i < pathspec.nr; i++)
                pathspec.items[i].nowildcard_len = pathspec.items[i].len;
        pathspec.has_wildcard = 0;
-       tree = parse_tree_indirect(sha1);
+       tree = parse_tree_indirect(oid.hash);
        if (!tree)
                die("not a tree object");
        return !!read_tree_recursive(tree, "", 0, 0, &pathspec, show_tree, NULL);