Skip to content

Commit 7f07c1c

Browse files
avargitster
authored andcommitted
describe tests: don't rely on err.actual from "check_describe"
Convert the one test that relied on the "err.actual" file produced by check_describe() to instead do its own check of "git describe" output. This means that the two tests won't have an inter-dependency (e.g. if the earlier test is skipped). An earlier version of this patch instead asserted that no other test had any output on stderr. We're not doing that here out of fear that "gc --auto" or another future change to "git describe" will cause it to legitimately emit output on stderr unexpectedly[1]. I'd think that inverting the test added in 3291fe4 (Add git-describe test for "verify annotated tag names on output", 2008-03-03) to make checking that we don't have warnings the rule rather than the exception would be the sort of thing the describe tests should be catching, but for now let's leave it as it is. 1. http://lore.kernel.org/git/[email protected] Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent a46a848 commit 7f07c1c

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed

t/t6120-describe.sh

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ check_describe () {
2121
shift
2222
describe_opts="$@"
2323
test_expect_success "describe $describe_opts" '
24-
git describe $describe_opts 2>err.actual >raw &&
24+
git describe $describe_opts >raw &&
2525
sed -e "s/-g[0-9a-f]*\$/-gHASH/" <raw >actual &&
2626
echo "$expect" >expect &&
2727
test_cmp expect actual
@@ -90,20 +90,17 @@ test_expect_success 'describe --contains defaults to HEAD without commit-ish' '
9090
'
9191

9292
check_describe tags/A --all A^0
93-
test_expect_success 'no warning was displayed for A' '
94-
test_must_be_empty err.actual
95-
'
9693

97-
test_expect_success 'rename tag A to Q locally' '
98-
mv .git/refs/tags/A .git/refs/tags/Q
99-
'
100-
cat - >err.expect <<EOF
101-
warning: tag 'Q' is externally known as 'A'
102-
EOF
103-
check_describe A-8-gHASH HEAD
104-
test_expect_success 'warning was displayed for Q' '
105-
test_cmp err.expect err.actual
106-
'
94+
test_expect_success 'renaming tag A to Q locally produces a warning' "
95+
mv .git/refs/tags/A .git/refs/tags/Q &&
96+
git describe HEAD 2>err >out &&
97+
cat >expected <<-\EOF &&
98+
warning: tag 'Q' is externally known as 'A'
99+
EOF
100+
test_cmp expected err &&
101+
grep -E '^A-8-g[0-9a-f]+$' out
102+
"
103+
107104
test_expect_success 'misnamed annotated tag forces long output' '
108105
description=$(git describe --no-long Q^0) &&
109106
expr "$description" : "A-0-g[0-9a-f]*$" &&

0 commit comments

Comments
 (0)