git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 08/16] t/t5516-fetch-push: use test_config()

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 21, 2013, 22:32 UTC
Message-ID
<7vobazjdrf.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1371813160-4200-9-git-send-email-artagnon@gmail.com>
Ramkumar Ramachandra <artagnon@gmail.com> writes:
> Replace the 'git config' calls in tests with test_config for greater
> robustness.
That may be a good thing in principle, but I _think_
	mk_empty testrepo &&
        (
        	cd testrepo &&
                do whatever to its config &&
                run test
	)

sequence is used so that we do not even have to worry about what leftover configuration values are in the testrepo/.git/config; so does it really matter?

If this conversion had something more than "s/git config/test_config/" replacement, that would indicate that you uncovered a bug in the existing test and found a good fix, but that does not seem to be the case for this particular patch.

Show 168 quoted lines
>
> Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
> ---
>  t/t5516-fetch-push.sh | 46 +++++++++++++++++++++++-----------------------
>  1 file changed, 23 insertions(+), 23 deletions(-)
>
> diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh
> index 6e9fa84..afb25c4 100755
> --- a/t/t5516-fetch-push.sh
> +++ b/t/t5516-fetch-push.sh
> @@ -142,8 +142,8 @@ test_expect_success 'fetch with wildcard' '
>  	mk_empty testrepo &&
>  	(
>  		cd testrepo &&
> -		git config remote.up.url .. &&
> -		git config remote.up.fetch "refs/heads/*:refs/remotes/origin/*" &&
> +		test_config remote.up.url .. &&
> +		test_config remote.up.fetch "refs/heads/*:refs/remotes/origin/*" &&
>  		git fetch up &&
>  
>  		echo "$the_commit commit	refs/remotes/origin/master" >expect &&
> @@ -157,9 +157,9 @@ test_expect_success 'fetch with insteadOf' '
>  	(
>  		TRASH=$(pwd)/ &&
>  		cd testrepo &&
> -		git config "url.$TRASH.insteadOf" trash/ &&
> -		git config remote.up.url trash/. &&
> -		git config remote.up.fetch "refs/heads/*:refs/remotes/origin/*" &&
> +		test_config "url.$TRASH.insteadOf" trash/ &&
> +		test_config remote.up.url trash/. &&
> +		test_config remote.up.fetch "refs/heads/*:refs/remotes/origin/*" &&
>  		git fetch up &&
>  
>  		echo "$the_commit commit	refs/remotes/origin/master" >expect &&
> @@ -173,9 +173,9 @@ test_expect_success 'fetch with pushInsteadOf (should not rewrite)' '
>  	(
>  		TRASH=$(pwd)/ &&
>  		cd testrepo &&
> -		git config "url.trash/.pushInsteadOf" "$TRASH" &&
> -		git config remote.up.url "$TRASH." &&
> -		git config remote.up.fetch "refs/heads/*:refs/remotes/origin/*" &&
> +		test_config "url.trash/.pushInsteadOf" "$TRASH" &&
> +		test_config remote.up.url "$TRASH." &&
> +		test_config remote.up.fetch "refs/heads/*:refs/remotes/origin/*" &&
>  		git fetch up &&
>  
>  		echo "$the_commit commit	refs/remotes/origin/master" >expect &&
> @@ -780,7 +780,7 @@ test_expect_success 'mixed ref updates, deletes, invalid deletes trigger hooks w
>  
>  test_expect_success 'allow deleting a ref using --delete' '
>  	mk_test testrepo heads/master &&
> -	(cd testrepo && git config receive.denyDeleteCurrent warn) &&
> +	(cd testrepo && test_config receive.denyDeleteCurrent warn) &&
>  	git push testrepo --delete master &&
>  	(cd testrepo && test_must_fail git rev-parse --verify refs/heads/master)
>  '
> @@ -809,7 +809,7 @@ test_expect_success 'warn on push to HEAD of non-bare repository' '
>  	(
>  		cd testrepo &&
>  		git checkout master &&
> -		git config receive.denyCurrentBranch warn
> +		test_config receive.denyCurrentBranch warn
>  	) &&
>  	git push testrepo master 2>stderr &&
>  	grep "warning: updating the current branch" stderr
> @@ -820,7 +820,7 @@ test_expect_success 'deny push to HEAD of non-bare repository' '
>  	(
>  		cd testrepo &&
>  		git checkout master &&
> -		git config receive.denyCurrentBranch true
> +		test_config receive.denyCurrentBranch true
>  	) &&
>  	test_must_fail git push testrepo master
>  '
> @@ -830,8 +830,8 @@ test_expect_success 'allow push to HEAD of bare repository (bare)' '
>  	(
>  		cd testrepo &&
>  		git checkout master &&
> -		git config receive.denyCurrentBranch true &&
> -		git config core.bare true
> +		test_config receive.denyCurrentBranch true &&
> +		test_config core.bare true
>  	) &&
>  	git push testrepo master 2>stderr &&
>  	! grep "warning: updating the current branch" stderr
> @@ -842,7 +842,7 @@ test_expect_success 'allow push to HEAD of non-bare repository (config)' '
>  	(
>  		cd testrepo &&
>  		git checkout master &&
> -		git config receive.denyCurrentBranch false
> +		test_config receive.denyCurrentBranch false
>  	) &&
>  	git push testrepo master 2>stderr &&
>  	! grep "warning: updating the current branch" stderr
> @@ -918,7 +918,7 @@ test_expect_success 'push into aliased refs (consistent)' '
>  		cd child1 &&
>  		git branch foo &&
>  		git symbolic-ref refs/heads/bar refs/heads/foo
> -		git config receive.denyCurrentBranch false
> +		test_config receive.denyCurrentBranch false
>  	) &&
>  	(
>  		cd child2 &&
> @@ -940,7 +940,7 @@ test_expect_success 'push into aliased refs (inconsistent)' '
>  		cd child1 &&
>  		git branch foo &&
>  		git symbolic-ref refs/heads/bar refs/heads/foo
> -		git config receive.denyCurrentBranch false
> +		test_config receive.denyCurrentBranch false
>  	) &&
>  	(
>  		cd child2 &&
> @@ -1006,7 +1006,7 @@ test_expect_success 'push --porcelain rejected' '
>  	git push testrepo refs/heads/master:refs/remotes/origin/master &&
>  	(cd testrepo &&
>  		git reset --hard origin/master^
> -		git config receive.denyCurrentBranch true) &&
> +		test_config receive.denyCurrentBranch true) &&
>  
>  	echo >.git/foo  "To testrepo"  &&
>  	echo >>.git/foo "!	refs/heads/master:refs/heads/master	[remote rejected] (branch is currently checked out)" &&
> @@ -1020,7 +1020,7 @@ test_expect_success 'push --porcelain --dry-run rejected' '
>  	git push testrepo refs/heads/master:refs/remotes/origin/master &&
>  	(cd testrepo &&
>  		git reset --hard origin/master
> -		git config receive.denyCurrentBranch true) &&
> +		test_config receive.denyCurrentBranch true) &&
>  
>  	echo >.git/foo  "To testrepo"  &&
>  	echo >>.git/foo "!	refs/heads/master^:refs/heads/master	[rejected] (non-fast-forward)" &&
> @@ -1052,7 +1052,7 @@ do
>  		mk_test testrepo heads/master hidden/one hidden/two hidden/three &&
>  		(
>  			cd testrepo &&
> -			git config $configsection.hiderefs refs/hidden
> +			test_config $configsection.hiderefs refs/hidden
>  		) &&
>  
>  		# push to unhidden ref succeeds normally
> @@ -1078,7 +1078,7 @@ test_expect_success 'fetch exact SHA1' '
>  	git push testrepo master:refs/hidden/one &&
>  	(
>  		cd testrepo &&
> -		git config transfer.hiderefs refs/hidden
> +		test_config transfer.hiderefs refs/hidden
>  	) &&
>  	check_push_result testrepo $the_commit hidden/one &&
>  
> @@ -1098,7 +1098,7 @@ test_expect_success 'fetch exact SHA1' '
>  		# the server side can allow it to succeed
>  		(
>  			cd ../testrepo &&
> -			git config uploadpack.allowtipsha1inwant true
> +			test_config uploadpack.allowtipsha1inwant true
>  		) &&
>  
>  		git fetch -v ../testrepo $the_commit:refs/heads/copy &&
> @@ -1126,8 +1126,8 @@ test_expect_success 'fetch follows tags by default' '
>  	(
>  		cd dst &&
>  		git remote add origin ../src &&
> -		git config branch.master.remote origin &&
> -		git config branch.master.merge refs/heads/master &&
> +		test_config branch.master.remote origin &&
> +		test_config branch.master.merge refs/heads/master &&
>  		git pull &&
>  		git for-each-ref >../actual
>  	) &&
Previous: Ramkumar RamachandraNext: Ramkumar Ramachandra
Message 25 of 43 in “Cleanup {branches,remotes}-file cruft”
  1. 00/16 Cleanup {branches,remotes}-file cruftRamkumar Ramachandra, Jun 21, 2013
  2. 01/16 t/t5505-remote: modernize subshell-style of one testRamkumar Ramachandra, Jun 21, 2013
  3. Junio C HamanoJun 21, 2013
  4. Ramkumar RamachandraJun 22, 2013
  5. 02/16 t/t5505-remote: test push-refspec in branches-fileRamkumar Ramachandra, Jun 21, 2013
  6. Junio C HamanoJun 21, 2013
  7. 03/16 t/t5505-remote: use test_path_is_missingRamkumar Ramachandra, Jun 21, 2013
  8. 04/16 t/t5505-remote: remove dependency on $origin_urlRamkumar Ramachandra, Jun 21, 2013
  9. Junio C HamanoJun 21, 2013
  10. Ramkumar RamachandraJun 22, 2013
  11. Junio C HamanoJun 22, 2013
  12. Ramkumar RamachandraJun 23, 2013
  13. 05/16 remote: remove dead code in read_branches_file()Ramkumar Ramachandra, Jun 21, 2013
  14. Junio C HamanoJun 21, 2013
  15. Ramkumar RamachandraJun 22, 2013
  16. Junio C HamanoJun 23, 2013
  17. Ramkumar RamachandraJun 23, 2013
  18. Junio C HamanoJun 23, 2013
  19. 06/16 t/t5505-remote: test url-with-# in branches-fileRamkumar Ramachandra, Jun 21, 2013
  20. Junio C HamanoJun 21, 2013
  21. Ramkumar RamachandraJun 22, 2013
  22. 07/16 t/t5516-fetch-push: don't use branches-fileRamkumar Ramachandra, Jun 21, 2013
  23. Junio C HamanoJun 21, 2013
  24. 08/16 t/t5516-fetch-push: use test_config()Ramkumar Ramachandra, Jun 21, 2013
  25. Junio C HamanoJun 21, 2013
  26. Ramkumar RamachandraJun 22, 2013
  27. Johannes SixtJun 22, 2013
  28. 09/16 ls-remote doc: fix example invocation on git.gitRamkumar Ramachandra, Jun 21, 2013
  29. Junio C HamanoJun 21, 2013
  30. 10/16 ls-remote doc: rewrite <repository> paragraphRamkumar Ramachandra, Jun 21, 2013
  31. Junio C HamanoJun 21, 2013
  32. 11/16 ls-remote doc: don't encourage use of branches-fileRamkumar Ramachandra, Jun 21, 2013
  33. 12/16 t/t5505-remote: modernize subshell-style of one testRamkumar Ramachandra, Jun 21, 2013
  34. 13/16 t/t5505-remote: test multiple push/pull in remotes-fileRamkumar Ramachandra, Jun 21, 2013
  35. Eric SunshineJun 21, 2013
  36. Ramkumar RamachandraJun 22, 2013
  37. 14/16 t/t5510-fetch: don't use remotes-fileRamkumar Ramachandra, Jun 21, 2013
  38. 15/16 t/t5515-fetch-merge-logic: don't use {branches,remotes}-fileRamkumar Ramachandra, Jun 21, 2013
  39. 16/16 remote: deprecate read_{branches,remotes}_fileRamkumar Ramachandra, Jun 21, 2013
  40. Junio C HamanoJun 21, 2013
  41. Ramkumar RamachandraJun 21, 2013
  42. Junio C HamanoJun 21, 2013
  43. Ramkumar RamachandraJun 21, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.