Re: [PATCH v2 3/4] bug: denyCurrentBranch and unborn branch with ref namespace

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

 



"Hariom Verma via GitGitGadget" <gitgitgadget@xxxxxxxxx> writes:

> +test_expect_failure 'denyCurrentBranch and unborn branch with ref namespace' '

Please do not chdir around in the test script.  The next person who
adds new test after this test will be surprised that his/her test
does not start at the top-level of the test/trash directory, but in
the "original" subdirectory.

And no, adding "&& cd .." at the end of this &&-cascade is *not* a
fix---when any of the steps chained with && fails, such a "we have
moved the process to a wrong place, so let's move back with 'cd ..'"
will not get executed.

> +	cd original &&
> +	git init unborn &&
> +	git remote add unborn-namespaced "ext::git --namespace=namespace %s unborn" &&
> +	test_must_fail git push unborn-namespaced HEAD:master &&
> +	test_config -C unborn receive.denyCurrentBranch updateInstead &&
> +	git push unborn-namespaced HEAD:master
> +'

What is often done to fix is to execute what you need to run in a
subshell, e.g.

	test_expect_success 'demonstration' '
		(
			cd original &&
			git init unborn &&
			...
			test_must_fail git push ... &&
			git -C unborn config ... &&
			git push ...
		)
	'

The use of "git config" instead of "test_config" in the above
illustration is deliberate---the latter does not work and should not
be used inside a subshell.

> +
>  test_done



[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