aboutsummaryrefslogtreecommitdiff
path: root/t/t6120-describe.sh
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2010-04-12 16:25:29 -0700
committerJunio C Hamano <gitster@pobox.com>2010-04-13 13:04:50 -0700
commit03e8b541b38d95d1cd7b287963c82617a0469f80 (patch)
tree715169882f024461276fd9facb849eac0c6a7860 /t/t6120-describe.sh
parente451d06bf39df35d1106ad9bde5e38505533d805 (diff)
downloadgit-03e8b541b38d95d1cd7b287963c82617a0469f80.tar.gz
git-03e8b541b38d95d1cd7b287963c82617a0469f80.tar.xz
describe: Break annotated tag ties by tagger date
If more than one annotated tag points at the same commit, use the tag whose tagger field has a more recent date stamp. This resolves non-deterministic cases where the maintainer has done: $ git tag -a -m "2.1-rc1" v2.1-rc1 deadbeef $ git tag -a -m "2.1" v2.1 deadbeef If the tag is an older-style annotated tag with no tagger date, we assume a date stamp at the UNIX epoch. This will cause us to prefer an annotated tag that has a valid date. We could also try to consider the tag object chain, favoring a tag that "includes" another one: $ git tag -a -m "2.1-rc0" v2.1-rc1 deadbeef $ git tag -a -m "2.1" v2.1 v2.1-rc1 However traversing the tag's object chain looking for inclusion is much more complicated. Its already very likely that even in these cases the v2.1 tag will have a more recent tagger date than v2.1-rc1, so with this change describe should still resolve this by selecting the more recent v2.1. Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t6120-describe.sh')
-rwxr-xr-xt/t6120-describe.sh8
1 files changed, 5 insertions, 3 deletions
diff --git a/t/t6120-describe.sh b/t/t6120-describe.sh
index 065deadc2..876d1ab74 100755
--- a/t/t6120-describe.sh
+++ b/t/t6120-describe.sh
@@ -8,7 +8,7 @@ test_description='test describe
o----o----o----o----o----. /
\ A c /
.------------o---o---o
- D e
+ D,R e
'
. ./test-lib.sh
@@ -68,6 +68,8 @@ test_expect_success setup '
echo D >another && git add another && git commit -m D &&
test_tick &&
git tag -a -m D D &&
+ test_tick &&
+ git tag -a -m R R &&
test_tick &&
echo DD >another && git commit -a -m another &&
@@ -89,10 +91,10 @@ test_expect_success setup '
check_describe A-* HEAD
check_describe A-* HEAD^
-check_describe D-* HEAD^^
+check_describe R-* HEAD^^
check_describe A-* HEAD^^2
check_describe B HEAD^^2^
-check_describe D-* HEAD^^^
+check_describe R-* HEAD^^^
check_describe c-* --tags HEAD
check_describe c-* --tags HEAD^