Re: [PATCH 06/10] hook tests: get rid of unnecessary sub-shells

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ævar Arnfjörð Bjarmason  <avarab@xxxxxxxxx> writes:

> 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.

> 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.





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux