commit-tree: the command wants a tree and commits

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Junio C Hamano committed Jul 3, 2012 at 10:03 UTC 75f5ac04a2984fcf1e4d167047bfb63c5f385d44
2 files changed +6 -6
builtin/commit-tree.c
+4 -4
@@ -48,8 +48,8 @@ int cmd_commit_tree(int argc, const char **argv, const char *prefix)
48 if (argc < 2 || !strcmp(argv[1], "-h"))
49 usage(commit_tree_usage);
50
51 - if (get_sha1(argv[1], tree_sha1))
52 - die("Not a valid object name %s", argv[1]);
51 + if (get_sha1_tree(argv[1], tree_sha1))
52 + die("Not a valid tree object name %s", argv[1]);
53
54 for (i = 1; i < argc; i++) {
55 const char *arg = argv[i];
@@ -57,7 +57,7 @@ int cmd_commit_tree(int argc, const char **argv, const char *prefix)
57 unsigned char sha1[20];
58 if (argc <= ++i)
59 usage(commit_tree_usage);
60 - if (get_sha1(argv[i], sha1))
60 + if (get_sha1_commit(argv[i], sha1))
61 die("Not a valid object name %s", argv[i]);
62 assert_sha1_type(sha1, OBJ_COMMIT);
63 new_parent(lookup_commit(sha1), &parents);
@@ -104,7 +104,7 @@ int cmd_commit_tree(int argc, const char **argv, const char *prefix)
104 continue;
105 }
106
107 - if (get_sha1(arg, tree_sha1))
107 + if (get_sha1_tree(arg, tree_sha1))
108 die("Not a valid object name %s", arg);
109 if (got_tree)
110 die("Cannot give more than one trees");
t/t1512-rev-parse-disambiguation.sh
+2 -2
@@ -75,7 +75,7 @@ test_expect_success 'disambiguate blob' '
75 test_cmp a0blgqsjc actual
76 '
77
78 -test_expect_failure 'disambiguate tree' '
78 +test_expect_success 'disambiguate tree' '
79 commit=$(echo "d7xm" | git commit-tree 000000000) &&
80 test $(git rev-parse $commit^{tree}) = $(git rev-parse 0000000000cdc)
81 '
@@ -97,7 +97,7 @@ test_expect_success 'disambiguate commit-ish' '
97 git rev-parse --verify 000000000^0
98 '
99
100 -test_expect_failure 'disambiguate commit' '
100 +test_expect_success 'disambiguate commit' '
101 commit=$(echo "j9xqh" | git commit-tree 0000000000cdc -p 000000000) &&
102 test $(git rev-parse $commit^) = $(git rev-parse 0000000000e4f)
103 '