Skip to content

Commit 2df546e

Browse files
avargitster
authored andcommitted
describe tests: improve test for --work-tree & --dirty
Improve tests added in 9f67d2e (Teach "git describe" --dirty option, 2009-10-21) and 2ed5c8e (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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f0d4d39 commit 2df546e

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

t/t6120-describe.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -151,24 +151,24 @@ test_expect_success 'set-up dirty work tree' '
151151
echo >>file
152152
'
153153

154-
check_describe "A-*[0-9a-f]-dirty" --dirty
155-
156154
test_expect_success 'describe --dirty with --work-tree (dirty)' '
155+
git describe --dirty >expected &&
157156
(
158157
cd "$TEST_DIRECTORY" &&
159158
git --git-dir "$TRASH_DIRECTORY/.git" --work-tree "$TRASH_DIRECTORY" describe --dirty >"$TRASH_DIRECTORY/out"
160159
) &&
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
162162
'
163163

164-
check_describe "A-*[0-9a-f].mod" --dirty=.mod
165-
166164
test_expect_success 'describe --dirty=.mod with --work-tree (dirty)' '
165+
git describe --dirty=.mod >expected &&
167166
(
168167
cd "$TEST_DIRECTORY" &&
169168
git --git-dir "$TRASH_DIRECTORY/.git" --work-tree "$TRASH_DIRECTORY" describe --dirty=.mod >"$TRASH_DIRECTORY/out"
170169
) &&
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
172172
'
173173

174174
test_expect_success 'describe --dirty HEAD' '

0 commit comments

Comments
 (0)