summaryrefslogtreecommitdiff
path: root/t/t6120-describe.sh
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2021-04-12 11:21:43 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-05-11 03:48:09 (GMT)
commit2df546e17fa1c28ac44c886f59ba39ea2f00124a (patch)
treea1668fcfb00698e120dd9408bcc368ce286b03d0 /t/t6120-describe.sh
parentf0d4d398e281009bc5e34d830b37c0c1df2fb8a8 (diff)
downloadgit-2df546e17fa1c28ac44c886f59ba39ea2f00124a.zip
git-2df546e17fa1c28ac44c886f59ba39ea2f00124a.tar.gz
git-2df546e17fa1c28ac44c886f59ba39ea2f00124a.tar.bz2
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>
Diffstat (limited to 't/t6120-describe.sh')
-rwxr-xr-xt/t6120-describe.sh12
1 files changed, 6 insertions, 6 deletions
diff --git a/t/t6120-describe.sh b/t/t6120-describe.sh
index 88fddc9..a83ea15 100755
--- a/t/t6120-describe.sh
+++ b/t/t6120-describe.sh
@@ -151,24 +151,24 @@ test_expect_success 'set-up dirty work tree' '
echo >>file
'
-check_describe "A-*[0-9a-f]-dirty" --dirty
-
test_expect_success 'describe --dirty with --work-tree (dirty)' '
+ git describe --dirty >expected &&
(
cd "$TEST_DIRECTORY" &&
git --git-dir "$TRASH_DIRECTORY/.git" --work-tree "$TRASH_DIRECTORY" describe --dirty >"$TRASH_DIRECTORY/out"
) &&
- grep -E "^A-[1-9][0-9]?-g[0-9a-f]+-dirty$" out
+ grep -E "^A-[1-9][0-9]?-g[0-9a-f]+-dirty$" out &&
+ test_cmp expected out
'
-check_describe "A-*[0-9a-f].mod" --dirty=.mod
-
test_expect_success 'describe --dirty=.mod with --work-tree (dirty)' '
+ git describe --dirty=.mod >expected &&
(
cd "$TEST_DIRECTORY" &&
git --git-dir "$TRASH_DIRECTORY/.git" --work-tree "$TRASH_DIRECTORY" describe --dirty=.mod >"$TRASH_DIRECTORY/out"
) &&
- grep -E "^A-[1-9][0-9]?-g[0-9a-f]+.mod$" out
+ grep -E "^A-[1-9][0-9]?-g[0-9a-f]+.mod$" out &&
+ test_cmp expected out
'
test_expect_success 'describe --dirty HEAD' '