Merge branch 'sb/describe-blob'
"git describe $garbage" stopped giving any errors when the garbage happens to be a string with 40 hexadecimal letters. * sb/describe-blob: describe: confirm that blobs actually exist
This commit is contained in:
commit
1ba6846a19
@ -502,7 +502,7 @@ static void describe(const char *arg, int last_one)
|
|||||||
|
|
||||||
if (cmit)
|
if (cmit)
|
||||||
describe_commit(&oid, &sb);
|
describe_commit(&oid, &sb);
|
||||||
else if (lookup_blob(&oid))
|
else if (sha1_object_info(oid.hash, NULL) == OBJ_BLOB)
|
||||||
describe_blob(oid, &sb);
|
describe_blob(oid, &sb);
|
||||||
else
|
else
|
||||||
die(_("%s is neither a commit nor blob"), arg);
|
die(_("%s is neither a commit nor blob"), arg);
|
||||||
|
@ -378,4 +378,12 @@ check_describe tags/A --all A
|
|||||||
check_describe tags/c --all c
|
check_describe tags/c --all c
|
||||||
check_describe heads/branch_A --all --match='branch_*' branch_A
|
check_describe heads/branch_A --all --match='branch_*' branch_A
|
||||||
|
|
||||||
|
test_expect_success 'describe complains about tree object' '
|
||||||
|
test_must_fail git describe HEAD^{tree}
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_success 'describe complains about missing object' '
|
||||||
|
test_must_fail git describe $_z40
|
||||||
|
'
|
||||||
|
|
||||||
test_done
|
test_done
|
||||||
|
Loading…
Reference in New Issue
Block a user