git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 3/3] Add git-describe test for "verify annotated tag names on output"
@ 2008-03-04  1:09 Shawn O. Pearce
  0 siblings, 0 replies; only message in thread
From: Shawn O. Pearce @ 2008-03-04  1:09 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

Back in 212945d4 ("Teach git-describe to verify annotated tag names
before output") I taught git-describe to output the name shown in the
"tag" header of an annotated tag, rather than the name it is actually
stored under in this repository's ref namespace.

This test case verifies this is working correctly by renaming the ref
for an annotated tag to a different name that what is recorded in the
tag body, and verifying that tag is returned.  We also verify there is
a message shown on stderr to inform the user that the tag is possibly
stored under the wrong name locally.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
 t/t6120-describe.sh |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/t/t6120-describe.sh b/t/t6120-describe.sh
index cc24477..22425d5 100755
--- a/t/t6120-describe.sh
+++ b/t/t6120-describe.sh
@@ -15,8 +15,9 @@ test_description='test describe
 check_describe () {
 	expect="$1"
 	shift
-	R=$(git describe "$@")
+	R=$(git describe "$@" 2>err.actual)
 	S=$?
+	cat err.actual >&3
 	test_expect_success "describe $*" '
 	test $S = 0 &&
 	case "$R" in
@@ -98,6 +99,20 @@ check_describe B --tags HEAD^^2^
 
 check_describe B-0-* --long HEAD^^2^
 
+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
+EOF
+check_describe A-* HEAD
+test_expect_success 'warning was displayed for Q' '
+	git diff err.expect err.actual
+'
+test_expect_success 'rename tag Q back to A' '
+	mv .git/refs/tags/Q .git/refs/tags/A
+'
+
 test_expect_success 'pack tag refs' 'git pack-refs'
 check_describe A-* HEAD
 
-- 
1.5.4.3.529.gb25fb

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2008-03-04  1:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-04  1:09 [PATCH 3/3] Add git-describe test for "verify annotated tag names on output" Shawn O. Pearce

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).