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>
. ./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
)
'
-(
- cd disjoint1 &&
- check_describe "A-3-gHASH" HEAD
-)
+check_describe -C disjoint1 "A-3-gHASH" HEAD
# B
# o---o---o------------.
)
'
-(
- cd disjoint2 &&
- check_describe "B-3-gHASH" HEAD
-)
+check_describe -C disjoint2 "B-3-gHASH" HEAD
test_done