describe tests: improve test for --work-tree & --dirty

Improve tests added in 9f67d2e8279 (Teach "git describe" --dirty option, 2009-10-21) and 2ed5c8e174d (describe: setup working tree for --dirty, 2019-02-03) so that they make sense in combination with each other. The "check_describe" being removed here was the earlier test, we then later added these --work-tree tests which really just wanted to check if we got the exact same output from "describe", but the test wasn't structured to test for that. Let's change it to do that, which both improves test coverage and makes it more obvious what's going on here. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ævar Arnfjörð Bjarmason committed Apr 12, 2021 at 13:21 UTC 2df546e17fa1c28ac44c886f59ba39ea2f00124a
1 file changed +6 -6
t/t6120-describe.sh
+6 -6
@@ -151,24 +151,24 @@ test_expect_success 'set-up dirty work tree' '
151 echo >>file
152 '
153
154 -check_describe "A-*[0-9a-f]-dirty" --dirty
155 -
154 test_expect_success 'describe --dirty with --work-tree (dirty)' '
155 + git describe --dirty >expected &&
156 (
157 cd "$TEST_DIRECTORY" &&
158 git --git-dir "$TRASH_DIRECTORY/.git" --work-tree "$TRASH_DIRECTORY" describe --dirty >"$TRASH_DIRECTORY/out"
159 ) &&
161 - grep -E "^A-[1-9][0-9]?-g[0-9a-f]+-dirty$" out
160 + grep -E "^A-[1-9][0-9]?-g[0-9a-f]+-dirty$" out &&
161 + test_cmp expected out
162 '
163
164 -check_describe "A-*[0-9a-f].mod" --dirty=.mod
165 -
164 test_expect_success 'describe --dirty=.mod with --work-tree (dirty)' '
165 + git describe --dirty=.mod >expected &&
166 (
167 cd "$TEST_DIRECTORY" &&
168 git --git-dir "$TRASH_DIRECTORY/.git" --work-tree "$TRASH_DIRECTORY" describe --dirty=.mod >"$TRASH_DIRECTORY/out"
169 ) &&
171 - grep -E "^A-[1-9][0-9]?-g[0-9a-f]+.mod$" out
170 + grep -E "^A-[1-9][0-9]?-g[0-9a-f]+.mod$" out &&
171 + test_cmp expected out
172 '
173
174 test_expect_success 'describe --dirty HEAD' '