diff options
author | Junio C Hamano <gitster@pobox.com> | 2018-02-27 10:33:57 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-02-27 10:33:57 -0800 |
commit | 1ba6846a19b0358ddf4098d44ba5804646c36412 (patch) | |
tree | bf9e5dd01b954d84c3b54ff3ec412eb090188d48 | |
parent | Merge branch 'rs/check-ignore-multi' (diff) | |
parent | describe: confirm that blobs actually exist (diff) | |
download | tgif-1ba6846a19b0358ddf4098d44ba5804646c36412.tar.xz |
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
-rw-r--r-- | builtin/describe.c | 2 | ||||
-rwxr-xr-x | t/t6120-describe.sh | 8 |
2 files changed, 9 insertions, 1 deletions
diff --git a/builtin/describe.c b/builtin/describe.c index c428984706..e4869df7b4 100644 --- a/builtin/describe.c +++ b/builtin/describe.c @@ -502,7 +502,7 @@ static void describe(const char *arg, int last_one) if (cmit) describe_commit(&oid, &sb); - else if (lookup_blob(&oid)) + else if (sha1_object_info(oid.hash, NULL) == OBJ_BLOB) describe_blob(oid, &sb); else die(_("%s is neither a commit nor blob"), arg); diff --git a/t/t6120-describe.sh b/t/t6120-describe.sh index a5d9015024..bae78c4e89 100755 --- a/t/t6120-describe.sh +++ b/t/t6120-describe.sh @@ -378,4 +378,12 @@ check_describe tags/A --all A check_describe tags/c --all c 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 |