Re: [PATCH 06/10] hook tests: get rid of unnecessary sub-shells
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Mar 2, 2022, 21:31 UTC
- Message-ID
- <xmqqo82ohwih.fsf@gitster.g>
- In-Reply-To
- <patch-06.10-d86ee06b46e-20220302T131859Z-avarab@gmail.com>
Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
Show 7 quoted lines
> Refactor the repository setup code for tests that test hooks the use > of sub-shells when setting up the test repository and hooks. > > A subsequent commit will change the hook setup to use a helper that > makes use of "test_when_finished", which cannot be used in > sub-shells. Let's change that setup code, and the adjacent and similar > "mk_empty" code.
Makes sense.
Show 17 quoted lines
> diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh
> index 1a20e54adc1..e4bb7581568 100755
> --- a/t/t5516-fetch-push.sh
> +++ b/t/t5516-fetch-push.sh
> @@ -24,12 +24,8 @@ D=$(pwd)
> mk_empty () {
> repo_name="$1"
> rm -fr "$repo_name" &&
> - mkdir "$repo_name" &&
> - (
> - cd "$repo_name" &&
> - git init &&
> - git config receive.denyCurrentBranch warn
> - )
> + git init "$repo_name" &&
> + git -C "$repo_name" config receive.denyCurrentBranch warn
> }I thought of this exact change when I saw a change to this part in this series in an earlier step. Excellent.