diff options
author | Junio C Hamano <gitster@pobox.com> | 2020-03-26 17:11:21 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-03-26 17:11:21 -0700 |
commit | 0f0625a630081d532d528d87ba236a6385bbbac1 (patch) | |
tree | e6c3e6c57219732b8165105970590a7d09cec91d /t | |
parent | Merge branch 'at/rebase-fork-point-regression-fix' (diff) | |
parent | describe: force long format for a name based on a mislocated tag (diff) | |
download | tgif-0f0625a630081d532d528d87ba236a6385bbbac1.tar.xz |
Merge branch 'jc/describe-misnamed-annotated-tag'
When "git describe C" finds an annotated tag with tagname A to be
the best name to explain commit C, and the tag is stored in a
"wrong" place in the refs/tags hierarchy, e.g. refs/tags/B, the
command gave a warning message but used A (not B) to describe C.
If C is exactly at the tag, the describe output would be "A", but
"git rev-parse A^0" would not be equal as "git rev-parse C^0". The
behavior of the command has been changed to use the "long" form
i.e. A-0-gOBJECTNAME, which is correctly interpreted by rev-parse.
* jc/describe-misnamed-annotated-tag:
describe: force long format for a name based on a mislocated tag
Diffstat (limited to 't')
-rwxr-xr-x | t/t6120-describe.sh | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/t/t6120-describe.sh b/t/t6120-describe.sh index 34502e3a50..f822d5d328 100755 --- a/t/t6120-describe.sh +++ b/t/t6120-describe.sh @@ -129,12 +129,30 @@ test_expect_success 'rename tag A to Q locally' ' mv .git/refs/tags/A .git/refs/tags/Q ' cat - >err.expect <<EOF -warning: tag 'A' is really 'Q' here +warning: tag 'Q' is externally known as 'A' EOF check_describe A-* HEAD test_expect_success 'warning was displayed for Q' ' test_i18ncmp err.expect err.actual ' +test_expect_success 'misnamed annotated tag forces long output' ' + description=$(git describe --no-long Q^0) && + expr "$description" : "A-0-g[0-9a-f]*$" && + git rev-parse --verify "$description" >actual && + git rev-parse --verify Q^0 >expect && + test_cmp expect actual +' + +test_expect_success 'abbrev=0 will not break misplaced tag (1)' ' + description=$(git describe --abbrev=0 Q^0) && + expr "$description" : "A-0-g[0-9a-f]*$" +' + +test_expect_success 'abbrev=0 will not break misplaced tag (2)' ' + description=$(git describe --abbrev=0 c^0) && + expr "$description" : "A-1-g[0-9a-f]*$" +' + test_expect_success 'rename tag Q back to A' ' mv .git/refs/tags/Q .git/refs/tags/A ' |