{"thread":{"id":"35253","subject":"[PATCH] t: branch: improve test rollback","startedAt":"2013-10-31T09:27:11Z","lastAt":"2013-10-31T18:56:49Z","messageCount":5,"participants":["Felipe Contreras","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"229895","messageId":"1383211631-9244-1-git-send-email-felipe.contreras@gmail.com","threadId":"35253","inReplyTo":null,"subject":"[PATCH] t: branch: improve test rollback","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-10-31T09:27:11Z","receivedAt":"2013-10-31T09:27:11Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"After every test the environment should be as close as to how it was\nbefore as possible.\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n t/t3200-branch.sh | 71 +++++++++++++++++++++++++++----------------------------\n 1 file changed, 35 insertions(+), 36 deletions(-)\n\ndiff --git a/t/t3200-branch.sh b/t/t3200-branch.sh\nindex 0fe7647..33673e0 100755\n--- a/t/t3200-branch.sh\n+++ b/t/t3200-branch.sh\n@@ -329,7 +329,7 @@ test_expect_success 'tracking setup fails on non-matching refspec' '\n '\n \n test_expect_success 'test tracking setup via config' '\n-\tgit config branch.autosetupmerge true &&\n+\ttest_config branch.autosetupmerge true &&\n \tgit config remote.local.url . &&\n \tgit config remote.local.fetch refs/heads/*:refs/remotes/local/* &&\n \t(git show-ref -q refs/remotes/local/master || git fetch local) &&\n@@ -339,20 +339,18 @@ test_expect_success 'test tracking setup via config' '\n '\n \n test_expect_success 'test overriding tracking setup via --no-track' '\n-\tgit config branch.autosetupmerge true &&\n+\ttest_config branch.autosetupmerge true &&\n \tgit config remote.local.url . &&\n \tgit config remote.local.fetch refs/heads/*:refs/remotes/local/* &&\n \t(git show-ref -q refs/remotes/local/master || git fetch local) &&\n \tgit branch --no-track my2 local/master &&\n-\tgit config branch.autosetupmerge false &&\n \t! test \"$(git config branch.my2.remote)\" = local &&\n \t! test \"$(git config branch.my2.merge)\" = refs/heads/master\n '\n \n test_expect_success 'no tracking without .fetch entries' '\n-\tgit config branch.autosetupmerge true &&\n+\ttest_config branch.autosetupmerge true &&\n \tgit branch my6 s &&\n-\tgit config branch.autosetupmerge false &&\n \ttest -z \"$(git config branch.my6.remote)\" &&\n \ttest -z \"$(git config branch.my6.merge)\"\n '\n@@ -387,9 +385,8 @@ test_expect_success 'test --track without .fetch entries' '\n '\n \n test_expect_success 'branch from non-branch HEAD w/autosetupmerge=always' '\n-\tgit config branch.autosetupmerge always &&\n-\tgit branch my9 HEAD^ &&\n-\tgit config branch.autosetupmerge false\n+\ttest_config branch.autosetupmerge always &&\n+\tgit branch my9 HEAD^\n '\n \n test_expect_success 'branch from non-branch HEAD w/--track causes failure' '\n@@ -406,9 +403,9 @@ test_expect_success '--set-upstream-to fails on multiple branches' '\n '\n \n test_expect_success '--set-upstream-to fails on detached HEAD' '\n+\ttest_when_finished \"git checkout -\" &&\n \tgit checkout HEAD^{} &&\n-\ttest_must_fail git branch --set-upstream-to master &&\n-\tgit checkout -\n+\ttest_must_fail git branch --set-upstream-to master\n '\n \n test_expect_success '--set-upstream-to fails on a missing dst branch' '\n@@ -460,9 +457,9 @@ test_expect_success '--unset-upstream should fail on multiple branches' '\n '\n \n test_expect_success '--unset-upstream should fail on detached HEAD' '\n+\ttest_when_finished \"git checkout -\" &&\n \tgit checkout HEAD^{} &&\n-\ttest_must_fail git branch --unset-upstream &&\n-\tgit checkout -\n+\ttest_must_fail git branch --unset-upstream\n '\n \n test_expect_success 'test --unset-upstream on a particular branch' '\n@@ -541,7 +538,8 @@ test_expect_success 'checkout -b with -l makes reflog when core.logAllRefUpdates\n '\n \n test_expect_success 'avoid ambiguous track' '\n-\tgit config branch.autosetupmerge true &&\n+\ttest_when_finished \"git remote rm ambi1 && git remote rm ambi2\" &&\n+\ttest_config branch.autosetupmerge true &&\n \tgit config remote.ambi1.url lalala &&\n \tgit config remote.ambi1.fetch refs/heads/lalala:refs/heads/master &&\n \tgit config remote.ambi2.url lilili &&\n@@ -553,7 +551,7 @@ test_expect_success 'avoid ambiguous track' '\n test_expect_success 'autosetuprebase local on a tracked local branch' '\n \tgit config remote.local.url . &&\n \tgit config remote.local.fetch refs/heads/*:refs/remotes/local/* &&\n-\tgit config branch.autosetuprebase local &&\n+\ttest_config branch.autosetuprebase local &&\n \t(git show-ref -q refs/remotes/local/o || git fetch local) &&\n \tgit branch mybase &&\n \tgit branch --track myr1 mybase &&\n@@ -565,7 +563,7 @@ test_expect_success 'autosetuprebase local on a tracked local branch' '\n test_expect_success 'autosetuprebase always on a tracked local branch' '\n \tgit config remote.local.url . &&\n \tgit config remote.local.fetch refs/heads/*:refs/remotes/local/* &&\n-\tgit config branch.autosetuprebase always &&\n+\ttest_config branch.autosetuprebase always &&\n \t(git show-ref -q refs/remotes/local/o || git fetch local) &&\n \tgit branch mybase2 &&\n \tgit branch --track myr2 mybase &&\n@@ -577,7 +575,7 @@ test_expect_success 'autosetuprebase always on a tracked local branch' '\n test_expect_success 'autosetuprebase remote on a tracked local branch' '\n \tgit config remote.local.url . &&\n \tgit config remote.local.fetch refs/heads/*:refs/remotes/local/* &&\n-\tgit config branch.autosetuprebase remote &&\n+\ttest_config branch.autosetuprebase remote &&\n \t(git show-ref -q refs/remotes/local/o || git fetch local) &&\n \tgit branch mybase3 &&\n \tgit branch --track myr3 mybase2 &&\n@@ -589,7 +587,7 @@ test_expect_success 'autosetuprebase remote on a tracked local branch' '\n test_expect_success 'autosetuprebase never on a tracked local branch' '\n \tgit config remote.local.url . &&\n \tgit config remote.local.fetch refs/heads/*:refs/remotes/local/* &&\n-\tgit config branch.autosetuprebase never &&\n+\ttest_config branch.autosetuprebase never &&\n \t(git show-ref -q refs/remotes/local/o || git fetch local) &&\n \tgit branch mybase4 &&\n \tgit branch --track myr4 mybase2 &&\n@@ -601,7 +599,7 @@ test_expect_success 'autosetuprebase never on a tracked local branch' '\n test_expect_success 'autosetuprebase local on a tracked remote branch' '\n \tgit config remote.local.url . &&\n \tgit config remote.local.fetch refs/heads/*:refs/remotes/local/* &&\n-\tgit config branch.autosetuprebase local &&\n+\ttest_config branch.autosetuprebase local &&\n \t(git show-ref -q refs/remotes/local/master || git fetch local) &&\n \tgit branch --track myr5 local/master &&\n \ttest \"$(git config branch.myr5.remote)\" = local &&\n@@ -612,7 +610,7 @@ test_expect_success 'autosetuprebase local on a tracked remote branch' '\n test_expect_success 'autosetuprebase never on a tracked remote branch' '\n \tgit config remote.local.url . &&\n \tgit config remote.local.fetch refs/heads/*:refs/remotes/local/* &&\n-\tgit config branch.autosetuprebase never &&\n+\ttest_config branch.autosetuprebase never &&\n \t(git show-ref -q refs/remotes/local/master || git fetch local) &&\n \tgit branch --track myr6 local/master &&\n \ttest \"$(git config branch.myr6.remote)\" = local &&\n@@ -623,7 +621,7 @@ test_expect_success 'autosetuprebase never on a tracked remote branch' '\n test_expect_success 'autosetuprebase remote on a tracked remote branch' '\n \tgit config remote.local.url . &&\n \tgit config remote.local.fetch refs/heads/*:refs/remotes/local/* &&\n-\tgit config branch.autosetuprebase remote &&\n+\ttest_config branch.autosetuprebase remote &&\n \t(git show-ref -q refs/remotes/local/master || git fetch local) &&\n \tgit branch --track myr7 local/master &&\n \ttest \"$(git config branch.myr7.remote)\" = local &&\n@@ -634,7 +632,7 @@ test_expect_success 'autosetuprebase remote on a tracked remote branch' '\n test_expect_success 'autosetuprebase always on a tracked remote branch' '\n \tgit config remote.local.url . &&\n \tgit config remote.local.fetch refs/heads/*:refs/remotes/local/* &&\n-\tgit config branch.autosetuprebase remote &&\n+\ttest_config branch.autosetuprebase remote &&\n \t(git show-ref -q refs/remotes/local/master || git fetch local) &&\n \tgit branch --track myr8 local/master &&\n \ttest \"$(git config branch.myr8.remote)\" = local &&\n@@ -643,7 +641,7 @@ test_expect_success 'autosetuprebase always on a tracked remote branch' '\n '\n \n test_expect_success 'autosetuprebase unconfigured on a tracked remote branch' '\n-\tgit config --unset branch.autosetuprebase &&\n+\ttest_unconfig branch.autosetuprebase &&\n \tgit config remote.local.url . &&\n \tgit config remote.local.fetch refs/heads/*:refs/remotes/local/* &&\n \t(git show-ref -q refs/remotes/local/master || git fetch local) &&\n@@ -685,7 +683,7 @@ test_expect_success 'autosetuprebase unconfigured on untracked remote branch' '\n '\n \n test_expect_success 'autosetuprebase never on an untracked local branch' '\n-\tgit config branch.autosetuprebase never &&\n+\ttest_config branch.autosetuprebase never &&\n \tgit config remote.local.url . &&\n \tgit config remote.local.fetch refs/heads/*:refs/remotes/local/* &&\n \t(git show-ref -q refs/remotes/local/master || git fetch local) &&\n@@ -696,7 +694,7 @@ test_expect_success 'autosetuprebase never on an untracked local branch' '\n '\n \n test_expect_success 'autosetuprebase local on an untracked local branch' '\n-\tgit config branch.autosetuprebase local &&\n+\ttest_config branch.autosetuprebase local &&\n \tgit config remote.local.url . &&\n \tgit config remote.local.fetch refs/heads/*:refs/remotes/local/* &&\n \t(git show-ref -q refs/remotes/local/master || git fetch local) &&\n@@ -707,7 +705,7 @@ test_expect_success 'autosetuprebase local on an untracked local branch' '\n '\n \n test_expect_success 'autosetuprebase remote on an untracked local branch' '\n-\tgit config branch.autosetuprebase remote &&\n+\ttest_config branch.autosetuprebase remote &&\n \tgit config remote.local.url . &&\n \tgit config remote.local.fetch refs/heads/*:refs/remotes/local/* &&\n \t(git show-ref -q refs/remotes/local/master || git fetch local) &&\n@@ -718,7 +716,7 @@ test_expect_success 'autosetuprebase remote on an untracked local branch' '\n '\n \n test_expect_success 'autosetuprebase always on an untracked local branch' '\n-\tgit config branch.autosetuprebase always &&\n+\ttest_config branch.autosetuprebase always &&\n \tgit config remote.local.url . &&\n \tgit config remote.local.fetch refs/heads/*:refs/remotes/local/* &&\n \t(git show-ref -q refs/remotes/local/master || git fetch local) &&\n@@ -729,7 +727,7 @@ test_expect_success 'autosetuprebase always on an untracked local branch' '\n '\n \n test_expect_success 'autosetuprebase never on an untracked remote branch' '\n-\tgit config branch.autosetuprebase never &&\n+\ttest_config branch.autosetuprebase never &&\n \tgit config remote.local.url . &&\n \tgit config remote.local.fetch refs/heads/*:refs/remotes/local/* &&\n \t(git show-ref -q refs/remotes/local/master || git fetch local) &&\n@@ -740,7 +738,7 @@ test_expect_success 'autosetuprebase never on an untracked remote branch' '\n '\n \n test_expect_success 'autosetuprebase local on an untracked remote branch' '\n-\tgit config branch.autosetuprebase local &&\n+\ttest_config branch.autosetuprebase local &&\n \tgit config remote.local.url . &&\n \tgit config remote.local.fetch refs/heads/*:refs/remotes/local/* &&\n \t(git show-ref -q refs/remotes/local/master || git fetch local) &&\n@@ -751,7 +749,7 @@ test_expect_success 'autosetuprebase local on an untracked remote branch' '\n '\n \n test_expect_success 'autosetuprebase remote on an untracked remote branch' '\n-\tgit config branch.autosetuprebase remote &&\n+\ttest_config branch.autosetuprebase remote &&\n \tgit config remote.local.url . &&\n \tgit config remote.local.fetch refs/heads/*:refs/remotes/local/* &&\n \t(git show-ref -q refs/remotes/local/master || git fetch local) &&\n@@ -762,7 +760,7 @@ test_expect_success 'autosetuprebase remote on an untracked remote branch' '\n '\n \n test_expect_success 'autosetuprebase always on an untracked remote branch' '\n-\tgit config branch.autosetuprebase always &&\n+\ttest_config branch.autosetuprebase always &&\n \tgit config remote.local.url . &&\n \tgit config remote.local.fetch refs/heads/*:refs/remotes/local/* &&\n \t(git show-ref -q refs/remotes/local/master || git fetch local) &&\n@@ -773,8 +771,8 @@ test_expect_success 'autosetuprebase always on an untracked remote branch' '\n '\n \n test_expect_success 'autosetuprebase always on detached HEAD' '\n-\tgit config branch.autosetupmerge always &&\n-\ttest_when_finished git checkout master &&\n+\ttest_when_finished \"git checkout -\" &&\n+\ttest_config branch.autosetupmerge always &&\n \tgit checkout HEAD^0 &&\n \tgit branch my11 &&\n \ttest -z \"$(git config branch.my11.remote)\" &&\n@@ -782,15 +780,15 @@ test_expect_success 'autosetuprebase always on detached HEAD' '\n '\n \n test_expect_success 'detect misconfigured autosetuprebase (bad value)' '\n-\tgit config branch.autosetuprebase garbage &&\n+\ttest_config branch.autosetuprebase garbage &&\n \ttest_must_fail git branch\n '\n \n test_expect_success 'detect misconfigured autosetuprebase (no value)' '\n-\tgit config --unset branch.autosetuprebase &&\n+\ttest_when_finished \"test_unconfig branch.autosetuprebase\" &&\n+\ttest_unconfig branch.autosetuprebase &&\n \techo \"[branch] autosetuprebase\" >>.git/config &&\n-\ttest_must_fail git branch &&\n-\tgit config --unset branch.autosetuprebase\n+\ttest_must_fail git branch\n '\n \n test_expect_success 'attempt to delete a branch without base and unmerged to HEAD' '\n@@ -857,6 +855,7 @@ test_expect_success 'detect typo in branch name when using --edit-description' '\n '\n \n test_expect_success 'refuse --edit-description on unborn branch for now' '\n+\ttest_when_finished \"git checkout -\" &&\n \twrite_script editor <<-\\EOF &&\n \t\techo \"New contents\" >\"$1\"\n \tEOF\n-- \n1.8.4.2+fc1\n"},{"id":"229941","messageId":"xmqq1u3170l1.fsf@gitster.dls.corp.google.com","threadId":"35253","inReplyTo":"1383211631-9244-1-git-send-email-felipe.contreras@gmail.com","subject":"Re: [PATCH] t: branch: improve test rollback","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-10-31T18:32:42Z","receivedAt":"2013-10-31T18:32:42Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Felipe Contreras <felipe.contreras@gmail.com> writes:\n\n> After every test the environment should be as close as to how it was\n> before as possible.\n\nAlternatively, each individual tests in a sequence of tests can\nchoose to set the test environment to its preferred state before\nproceeding.  \n\nStarting from a pristine state (i.e. the goal the above aspires to\nreach) is probably more desirable, but in practice we could go\neither way.  In any case we should consistently stick to one inside\na single test.\n\n> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n> ---\n>  t/t3200-branch.sh | 71 +++++++++++++++++++++++++++----------------------------\n>  1 file changed, 35 insertions(+), 36 deletions(-)\n>\n> diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh\n> index 0fe7647..33673e0 100755\n> --- a/t/t3200-branch.sh\n> +++ b/t/t3200-branch.sh\n> @@ -329,7 +329,7 @@ test_expect_success 'tracking setup fails on non-matching refspec' '\n>  '\n>  \n>  test_expect_success 'test tracking setup via config' '\n> -\tgit config branch.autosetupmerge true &&\n> +\ttest_config branch.autosetupmerge true &&\n>  \tgit config remote.local.url . &&\n>  \tgit config remote.local.fetch refs/heads/*:refs/remotes/local/* &&\n\nAnd \"remote.local.*\" setting does not follow that \"pristine\"\nprinciple, making the result of applying this patch inconsistent.\nIs that desirable?\n\n\n\n>  \t(git show-ref -q refs/remotes/local/master || git fetch local) &&\n> @@ -339,20 +339,18 @@ test_expect_success 'test tracking setup via config' '\n>  '\n>  \n>  test_expect_success 'test overriding tracking setup via --no-track' '\n> -\tgit config branch.autosetupmerge true &&\n> +\ttest_config branch.autosetupmerge true &&\n>  \tgit config remote.local.url . &&\n>  \tgit config remote.local.fetch refs/heads/*:refs/remotes/local/* &&\n>  \t(git show-ref -q refs/remotes/local/master || git fetch local) &&\n>  \tgit branch --no-track my2 local/master &&\n> -\tgit config branch.autosetupmerge false &&\n>  \t! test \"$(git config branch.my2.remote)\" = local &&\n>  \t! test \"$(git config branch.my2.merge)\" = refs/heads/master\n>  '\n>  \n>  test_expect_success 'no tracking without .fetch entries' '\n> -\tgit config branch.autosetupmerge true &&\n> +\ttest_config branch.autosetupmerge true &&\n>  \tgit branch my6 s &&\n> -\tgit config branch.autosetupmerge false &&\n>  \ttest -z \"$(git config branch.my6.remote)\" &&\n>  \ttest -z \"$(git config branch.my6.merge)\"\n>  '\n> @@ -387,9 +385,8 @@ test_expect_success 'test --track without .fetch entries' '\n>  '\n>  \n>  test_expect_success 'branch from non-branch HEAD w/autosetupmerge=always' '\n> -\tgit config branch.autosetupmerge always &&\n> -\tgit branch my9 HEAD^ &&\n> -\tgit config branch.autosetupmerge false\n> +\ttest_config branch.autosetupmerge always &&\n> +\tgit branch my9 HEAD^\n>  '\n>  \n>  test_expect_success 'branch from non-branch HEAD w/--track causes failure' '\n> @@ -406,9 +403,9 @@ test_expect_success '--set-upstream-to fails on multiple branches' '\n>  '\n>  \n>  test_expect_success '--set-upstream-to fails on detached HEAD' '\n> +\ttest_when_finished \"git checkout -\" &&\n>  \tgit checkout HEAD^{} &&\n> -\ttest_must_fail git branch --set-upstream-to master &&\n> -\tgit checkout -\n> +\ttest_must_fail git branch --set-upstream-to master\n>  '\n>  \n>  test_expect_success '--set-upstream-to fails on a missing dst branch' '\n> @@ -460,9 +457,9 @@ test_expect_success '--unset-upstream should fail on multiple branches' '\n>  '\n>  \n>  test_expect_success '--unset-upstream should fail on detached HEAD' '\n> +\ttest_when_finished \"git checkout -\" &&\n>  \tgit checkout HEAD^{} &&\n> -\ttest_must_fail git branch --unset-upstream &&\n> -\tgit checkout -\n> +\ttest_must_fail git branch --unset-upstream\n>  '\n>  \n>  test_expect_success 'test --unset-upstream on a particular branch' '\n> @@ -541,7 +538,8 @@ test_expect_success 'checkout -b with -l makes reflog when core.logAllRefUpdates\n>  '\n>  \n>  test_expect_success 'avoid ambiguous track' '\n> -\tgit config branch.autosetupmerge true &&\n> +\ttest_when_finished \"git remote rm ambi1 && git remote rm ambi2\" &&\n> +\ttest_config branch.autosetupmerge true &&\n>  \tgit config remote.ambi1.url lalala &&\n>  \tgit config remote.ambi1.fetch refs/heads/lalala:refs/heads/master &&\n>  \tgit config remote.ambi2.url lilili &&\n> @@ -553,7 +551,7 @@ test_expect_success 'avoid ambiguous track' '\n>  test_expect_success 'autosetuprebase local on a tracked local branch' '\n>  \tgit config remote.local.url . &&\n>  \tgit config remote.local.fetch refs/heads/*:refs/remotes/local/* &&\n> -\tgit config branch.autosetuprebase local &&\n> +\ttest_config branch.autosetuprebase local &&\n>  \t(git show-ref -q refs/remotes/local/o || git fetch local) &&\n>  \tgit branch mybase &&\n>  \tgit branch --track myr1 mybase &&\n> @@ -565,7 +563,7 @@ test_expect_success 'autosetuprebase local on a tracked local branch' '\n>  test_expect_success 'autosetuprebase always on a tracked local branch' '\n>  \tgit config remote.local.url . &&\n>  \tgit config remote.local.fetch refs/heads/*:refs/remotes/local/* &&\n> -\tgit config branch.autosetuprebase always &&\n> +\ttest_config branch.autosetuprebase always &&\n>  \t(git show-ref -q refs/remotes/local/o || git fetch local) &&\n>  \tgit branch mybase2 &&\n>  \tgit branch --track myr2 mybase &&\n> @@ -577,7 +575,7 @@ test_expect_success 'autosetuprebase always on a tracked local branch' '\n>  test_expect_success 'autosetuprebase remote on a tracked local branch' '\n>  \tgit config remote.local.url . &&\n>  \tgit config remote.local.fetch refs/heads/*:refs/remotes/local/* &&\n> -\tgit config branch.autosetuprebase remote &&\n> +\ttest_config branch.autosetuprebase remote &&\n>  \t(git show-ref -q refs/remotes/local/o || git fetch local) &&\n>  \tgit branch mybase3 &&\n>  \tgit branch --track myr3 mybase2 &&\n> @@ -589,7 +587,7 @@ test_expect_success 'autosetuprebase remote on a tracked local branch' '\n>  test_expect_success 'autosetuprebase never on a tracked local branch' '\n>  \tgit config remote.local.url . &&\n>  \tgit config remote.local.fetch refs/heads/*:refs/remotes/local/* &&\n> -\tgit config branch.autosetuprebase never &&\n> +\ttest_config branch.autosetuprebase never &&\n>  \t(git show-ref -q refs/remotes/local/o || git fetch local) &&\n>  \tgit branch mybase4 &&\n>  \tgit branch --track myr4 mybase2 &&\n> @@ -601,7 +599,7 @@ test_expect_success 'autosetuprebase never on a tracked local branch' '\n>  test_expect_success 'autosetuprebase local on a tracked remote branch' '\n>  \tgit config remote.local.url . &&\n>  \tgit config remote.local.fetch refs/heads/*:refs/remotes/local/* &&\n> -\tgit config branch.autosetuprebase local &&\n> +\ttest_config branch.autosetuprebase local &&\n>  \t(git show-ref -q refs/remotes/local/master || git fetch local) &&\n>  \tgit branch --track myr5 local/master &&\n>  \ttest \"$(git config branch.myr5.remote)\" = local &&\n> @@ -612,7 +610,7 @@ test_expect_success 'autosetuprebase local on a tracked remote branch' '\n>  test_expect_success 'autosetuprebase never on a tracked remote branch' '\n>  \tgit config remote.local.url . &&\n>  \tgit config remote.local.fetch refs/heads/*:refs/remotes/local/* &&\n> -\tgit config branch.autosetuprebase never &&\n> +\ttest_config branch.autosetuprebase never &&\n>  \t(git show-ref -q refs/remotes/local/master || git fetch local) &&\n>  \tgit branch --track myr6 local/master &&\n>  \ttest \"$(git config branch.myr6.remote)\" = local &&\n> @@ -623,7 +621,7 @@ test_expect_success 'autosetuprebase never on a tracked remote branch' '\n>  test_expect_success 'autosetuprebase remote on a tracked remote branch' '\n>  \tgit config remote.local.url . &&\n>  \tgit config remote.local.fetch refs/heads/*:refs/remotes/local/* &&\n> -\tgit config branch.autosetuprebase remote &&\n> +\ttest_config branch.autosetuprebase remote &&\n>  \t(git show-ref -q refs/remotes/local/master || git fetch local) &&\n>  \tgit branch --track myr7 local/master &&\n>  \ttest \"$(git config branch.myr7.remote)\" = local &&\n> @@ -634,7 +632,7 @@ test_expect_success 'autosetuprebase remote on a tracked remote branch' '\n>  test_expect_success 'autosetuprebase always on a tracked remote branch' '\n>  \tgit config remote.local.url . &&\n>  \tgit config remote.local.fetch refs/heads/*:refs/remotes/local/* &&\n> -\tgit config branch.autosetuprebase remote &&\n> +\ttest_config branch.autosetuprebase remote &&\n>  \t(git show-ref -q refs/remotes/local/master || git fetch local) &&\n>  \tgit branch --track myr8 local/master &&\n>  \ttest \"$(git config branch.myr8.remote)\" = local &&\n> @@ -643,7 +641,7 @@ test_expect_success 'autosetuprebase always on a tracked remote branch' '\n>  '\n>  \n>  test_expect_success 'autosetuprebase unconfigured on a tracked remote branch' '\n> -\tgit config --unset branch.autosetuprebase &&\n> +\ttest_unconfig branch.autosetuprebase &&\n>  \tgit config remote.local.url . &&\n>  \tgit config remote.local.fetch refs/heads/*:refs/remotes/local/* &&\n>  \t(git show-ref -q refs/remotes/local/master || git fetch local) &&\n> @@ -685,7 +683,7 @@ test_expect_success 'autosetuprebase unconfigured on untracked remote branch' '\n>  '\n>  \n>  test_expect_success 'autosetuprebase never on an untracked local branch' '\n> -\tgit config branch.autosetuprebase never &&\n> +\ttest_config branch.autosetuprebase never &&\n>  \tgit config remote.local.url . &&\n>  \tgit config remote.local.fetch refs/heads/*:refs/remotes/local/* &&\n>  \t(git show-ref -q refs/remotes/local/master || git fetch local) &&\n> @@ -696,7 +694,7 @@ test_expect_success 'autosetuprebase never on an untracked local branch' '\n>  '\n>  \n>  test_expect_success 'autosetuprebase local on an untracked local branch' '\n> -\tgit config branch.autosetuprebase local &&\n> +\ttest_config branch.autosetuprebase local &&\n>  \tgit config remote.local.url . &&\n>  \tgit config remote.local.fetch refs/heads/*:refs/remotes/local/* &&\n>  \t(git show-ref -q refs/remotes/local/master || git fetch local) &&\n> @@ -707,7 +705,7 @@ test_expect_success 'autosetuprebase local on an untracked local branch' '\n>  '\n>  \n>  test_expect_success 'autosetuprebase remote on an untracked local branch' '\n> -\tgit config branch.autosetuprebase remote &&\n> +\ttest_config branch.autosetuprebase remote &&\n>  \tgit config remote.local.url . &&\n>  \tgit config remote.local.fetch refs/heads/*:refs/remotes/local/* &&\n>  \t(git show-ref -q refs/remotes/local/master || git fetch local) &&\n> @@ -718,7 +716,7 @@ test_expect_success 'autosetuprebase remote on an untracked local branch' '\n>  '\n>  \n>  test_expect_success 'autosetuprebase always on an untracked local branch' '\n> -\tgit config branch.autosetuprebase always &&\n> +\ttest_config branch.autosetuprebase always &&\n>  \tgit config remote.local.url . &&\n>  \tgit config remote.local.fetch refs/heads/*:refs/remotes/local/* &&\n>  \t(git show-ref -q refs/remotes/local/master || git fetch local) &&\n> @@ -729,7 +727,7 @@ test_expect_success 'autosetuprebase always on an untracked local branch' '\n>  '\n>  \n>  test_expect_success 'autosetuprebase never on an untracked remote branch' '\n> -\tgit config branch.autosetuprebase never &&\n> +\ttest_config branch.autosetuprebase never &&\n>  \tgit config remote.local.url . &&\n>  \tgit config remote.local.fetch refs/heads/*:refs/remotes/local/* &&\n>  \t(git show-ref -q refs/remotes/local/master || git fetch local) &&\n> @@ -740,7 +738,7 @@ test_expect_success 'autosetuprebase never on an untracked remote branch' '\n>  '\n>  \n>  test_expect_success 'autosetuprebase local on an untracked remote branch' '\n> -\tgit config branch.autosetuprebase local &&\n> +\ttest_config branch.autosetuprebase local &&\n>  \tgit config remote.local.url . &&\n>  \tgit config remote.local.fetch refs/heads/*:refs/remotes/local/* &&\n>  \t(git show-ref -q refs/remotes/local/master || git fetch local) &&\n> @@ -751,7 +749,7 @@ test_expect_success 'autosetuprebase local on an untracked remote branch' '\n>  '\n>  \n>  test_expect_success 'autosetuprebase remote on an untracked remote branch' '\n> -\tgit config branch.autosetuprebase remote &&\n> +\ttest_config branch.autosetuprebase remote &&\n>  \tgit config remote.local.url . &&\n>  \tgit config remote.local.fetch refs/heads/*:refs/remotes/local/* &&\n>  \t(git show-ref -q refs/remotes/local/master || git fetch local) &&\n> @@ -762,7 +760,7 @@ test_expect_success 'autosetuprebase remote on an untracked remote branch' '\n>  '\n>  \n>  test_expect_success 'autosetuprebase always on an untracked remote branch' '\n> -\tgit config branch.autosetuprebase always &&\n> +\ttest_config branch.autosetuprebase always &&\n>  \tgit config remote.local.url . &&\n>  \tgit config remote.local.fetch refs/heads/*:refs/remotes/local/* &&\n>  \t(git show-ref -q refs/remotes/local/master || git fetch local) &&\n> @@ -773,8 +771,8 @@ test_expect_success 'autosetuprebase always on an untracked remote branch' '\n>  '\n>  \n>  test_expect_success 'autosetuprebase always on detached HEAD' '\n> -\tgit config branch.autosetupmerge always &&\n> -\ttest_when_finished git checkout master &&\n> +\ttest_when_finished \"git checkout -\" &&\n> +\ttest_config branch.autosetupmerge always &&\n>  \tgit checkout HEAD^0 &&\n>  \tgit branch my11 &&\n>  \ttest -z \"$(git config branch.my11.remote)\" &&\n> @@ -782,15 +780,15 @@ test_expect_success 'autosetuprebase always on detached HEAD' '\n>  '\n>  \n>  test_expect_success 'detect misconfigured autosetuprebase (bad value)' '\n> -\tgit config branch.autosetuprebase garbage &&\n> +\ttest_config branch.autosetuprebase garbage &&\n>  \ttest_must_fail git branch\n>  '\n>  \n>  test_expect_success 'detect misconfigured autosetuprebase (no value)' '\n> -\tgit config --unset branch.autosetuprebase &&\n> +\ttest_when_finished \"test_unconfig branch.autosetuprebase\" &&\n> +\ttest_unconfig branch.autosetuprebase &&\n>  \techo \"[branch] autosetuprebase\" >>.git/config &&\n> -\ttest_must_fail git branch &&\n> -\tgit config --unset branch.autosetuprebase\n> +\ttest_must_fail git branch\n>  '\n>  \n>  test_expect_success 'attempt to delete a branch without base and unmerged to HEAD' '\n> @@ -857,6 +855,7 @@ test_expect_success 'detect typo in branch name when using --edit-description' '\n>  '\n>  \n>  test_expect_success 'refuse --edit-description on unborn branch for now' '\n> +\ttest_when_finished \"git checkout -\" &&\n>  \twrite_script editor <<-\\EOF &&\n>  \t\techo \"New contents\" >\"$1\"\n>  \tEOF\n"},{"id":"229944","messageId":"CAMP44s01ABhU1tsqR+VKH6q6L+MNTDxHEgwfsCboxhP-euSmdA@mail.gmail.com","threadId":"35253","inReplyTo":"xmqq1u3170l1.fsf@gitster.dls.corp.google.com","subject":"Re: [PATCH] t: branch: improve test rollback","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-10-31T18:39:29Z","receivedAt":"2013-10-31T18:39:29Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"On Thu, Oct 31, 2013 at 12:32 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> Felipe Contreras <felipe.contreras@gmail.com> writes:\n\n>> diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh\n>> index 0fe7647..33673e0 100755\n>> --- a/t/t3200-branch.sh\n>> +++ b/t/t3200-branch.sh\n>> @@ -329,7 +329,7 @@ test_expect_success 'tracking setup fails on non-matching refspec' '\n>>  '\n>>\n>>  test_expect_success 'test tracking setup via config' '\n>> -     git config branch.autosetupmerge true &&\n>> +     test_config branch.autosetupmerge true &&\n>>       git config remote.local.url . &&\n>>       git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&\n>\n> And \"remote.local.*\" setting does not follow that \"pristine\"\n> principle, making the result of applying this patch inconsistent.\n> Is that desirable?\n\nThis patch is *improving* test rollback, it's not making it perfect.\n\nLet not the perfect be the enemy of the good.\n\n-- \nFelipe Contreras\n"},{"id":"229948","messageId":"xmqqsivh5l6a.fsf@gitster.dls.corp.google.com","threadId":"35253","inReplyTo":"CAMP44s01ABhU1tsqR+VKH6q6L+MNTDxHEgwfsCboxhP-euSmdA@mail.gmail.com","subject":"Re: [PATCH] t: branch: improve test rollback","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-10-31T18:50:53Z","receivedAt":"2013-10-31T18:50:53Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Felipe Contreras <felipe.contreras@gmail.com> writes:\n\n> On Thu, Oct 31, 2013 at 12:32 PM, Junio C Hamano <gitster@pobox.com> wrote:\n>> Felipe Contreras <felipe.contreras@gmail.com> writes:\n>\n>>> diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh\n>>> index 0fe7647..33673e0 100755\n>>> --- a/t/t3200-branch.sh\n>>> +++ b/t/t3200-branch.sh\n>>> @@ -329,7 +329,7 @@ test_expect_success 'tracking setup fails on non-matching refspec' '\n>>>  '\n>>>\n>>>  test_expect_success 'test tracking setup via config' '\n>>> -     git config branch.autosetupmerge true &&\n>>> +     test_config branch.autosetupmerge true &&\n>>>       git config remote.local.url . &&\n>>>       git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&\n>>\n>> And \"remote.local.*\" setting does not follow that \"pristine\"\n>> principle, making the result of applying this patch inconsistent.\n>> Is that desirable?\n>\n> This patch is *improving* test rollback, it's not making it perfect.\n>\n> Let not the perfect be the enemy of the good.\n\nThe patch is making it worse by stopping in the middle.\n"},{"id":"229950","messageId":"CAMP44s07=XDh+Ny=NdDumXzG5Pe2UCg3KNYX7Hp8UbkLcL0Kpg@mail.gmail.com","threadId":"35253","inReplyTo":"xmqqsivh5l6a.fsf@gitster.dls.corp.google.com","subject":"Re: [PATCH] t: branch: improve test rollback","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-10-31T18:56:49Z","receivedAt":"2013-10-31T18:56:49Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"On Thu, Oct 31, 2013 at 12:50 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> Felipe Contreras <felipe.contreras@gmail.com> writes:\n>\n>> On Thu, Oct 31, 2013 at 12:32 PM, Junio C Hamano <gitster@pobox.com> wrote:\n>>> Felipe Contreras <felipe.contreras@gmail.com> writes:\n>>\n>>>> diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh\n>>>> index 0fe7647..33673e0 100755\n>>>> --- a/t/t3200-branch.sh\n>>>> +++ b/t/t3200-branch.sh\n>>>> @@ -329,7 +329,7 @@ test_expect_success 'tracking setup fails on non-matching refspec' '\n>>>>  '\n>>>>\n>>>>  test_expect_success 'test tracking setup via config' '\n>>>> -     git config branch.autosetupmerge true &&\n>>>> +     test_config branch.autosetupmerge true &&\n>>>>       git config remote.local.url . &&\n>>>>       git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&\n>>>\n>>> And \"remote.local.*\" setting does not follow that \"pristine\"\n>>> principle, making the result of applying this patch inconsistent.\n>>> Is that desirable?\n>>\n>> This patch is *improving* test rollback, it's not making it perfect.\n>>\n>> Let not the perfect be the enemy of the good.\n>\n> The patch is making it worse by stopping in the middle.\n\nWhatever.\n\n-- \nFelipe Contreras\n"}]}