diff options
author | Ævar Arnfjörð Bjarmason <avarab@gmail.com> | 2021-04-12 13:21:47 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-05-11 05:48:09 +0200 |
commit | 64568c717159b31b5a37d2c1bb284c71e6cd011f (patch) | |
tree | 6fef10c2b67bd44b873ec25f6ace05dbef3aed0f /t/t6120-describe.sh | |
parent | describe tests: fix nested "test_expect_success" call (diff) | |
download | git-64568c717159b31b5a37d2c1bb284c71e6cd011f.tar.xz git-64568c717159b31b5a37d2c1bb284c71e6cd011f.zip |
describe tests: support -C in "check_describe"
Change a subshell added in a preceding commit to instead use a new
"-C" option to "check_describe". The idiom for this is copied as-is
from the "test_commit" function in test-lib-functions.sh
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-x | t/t6120-describe.sh | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/t/t6120-describe.sh b/t/t6120-describe.sh index 9dc07782ea..1a501ee09e 100755 --- a/t/t6120-describe.sh +++ b/t/t6120-describe.sh @@ -17,11 +17,26 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME . ./test-lib.sh check_describe () { + indir= && + while test $# != 0 + do + case "$1" in + -C) + indir="$2" + shift + ;; + *) + break + ;; + esac + shift + done && + indir=${indir:+"$indir"/} && expect="$1" shift describe_opts="$@" test_expect_success "describe $describe_opts" ' - git describe $describe_opts >raw && + git ${indir:+ -C "$indir"} describe $describe_opts >raw && sed -e "s/-g[0-9a-f]*\$/-gHASH/" <raw >actual && echo "$expect" >expect && test_cmp expect actual @@ -486,10 +501,7 @@ test_expect_success 'setup: describe commits with disjoint bases' ' ) ' -( - cd disjoint1 && - check_describe "A-3-gHASH" HEAD -) +check_describe -C disjoint1 "A-3-gHASH" HEAD # B # o---o---o------------. @@ -515,9 +527,6 @@ test_expect_success 'setup: describe commits with disjoint bases 2' ' ) ' -( - cd disjoint2 && - check_describe "B-3-gHASH" HEAD -) +check_describe -C disjoint2 "B-3-gHASH" HEAD test_done |