Skip to content

Commit 75f5ac0

Browse files
committed
commit-tree: the command wants a tree and commits
Signed-off-by: Junio C Hamano <[email protected]>
1 parent da3ac0c commit 75f5ac0

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

builtin/commit-tree.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,16 @@ int cmd_commit_tree(int argc, const char **argv, const char *prefix)
4848
if (argc < 2 || !strcmp(argv[1], "-h"))
4949
usage(commit_tree_usage);
5050

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]);
5353

5454
for (i = 1; i < argc; i++) {
5555
const char *arg = argv[i];
5656
if (!strcmp(arg, "-p")) {
5757
unsigned char sha1[20];
5858
if (argc <= ++i)
5959
usage(commit_tree_usage);
60-
if (get_sha1(argv[i], sha1))
60+
if (get_sha1_commit(argv[i], sha1))
6161
die("Not a valid object name %s", argv[i]);
6262
assert_sha1_type(sha1, OBJ_COMMIT);
6363
new_parent(lookup_commit(sha1), &parents);
@@ -104,7 +104,7 @@ int cmd_commit_tree(int argc, const char **argv, const char *prefix)
104104
continue;
105105
}
106106

107-
if (get_sha1(arg, tree_sha1))
107+
if (get_sha1_tree(arg, tree_sha1))
108108
die("Not a valid object name %s", arg);
109109
if (got_tree)
110110
die("Cannot give more than one trees");

t/t1512-rev-parse-disambiguation.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ test_expect_success 'disambiguate blob' '
7575
test_cmp a0blgqsjc actual
7676
'
7777

78-
test_expect_failure 'disambiguate tree' '
78+
test_expect_success 'disambiguate tree' '
7979
commit=$(echo "d7xm" | git commit-tree 000000000) &&
8080
test $(git rev-parse $commit^{tree}) = $(git rev-parse 0000000000cdc)
8181
'
@@ -97,7 +97,7 @@ test_expect_success 'disambiguate commit-ish' '
9797
git rev-parse --verify 000000000^0
9898
'
9999

100-
test_expect_failure 'disambiguate commit' '
100+
test_expect_success 'disambiguate commit' '
101101
commit=$(echo "j9xqh" | git commit-tree 0000000000cdc -p 000000000) &&
102102
test $(git rev-parse $commit^) = $(git rev-parse 0000000000e4f)
103103
'

0 commit comments

Comments
 (0)