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

Re: [PATCH 2/2] t5520 (pull): use test_config where appropriate

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 25, 2013, 15:59 UTC
Message-ID
<7v4nfz1ndo.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1363955508-13368-3-git-send-email-artagnon@gmail.com>
Ramkumar Ramachandra <artagnon@gmail.com> writes:
Show 24 quoted lines
> Configuration from test_config does not last beyond the end of the
> current test assertion, making each test easier to think about in
> isolation.
>
> Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
> ---
>  t/t5520-pull.sh | 22 +++++++++-------------
>  1 file changed, 9 insertions(+), 13 deletions(-)
>
> diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh
> index e5adee8..0fe935b 100755
> --- a/t/t5520-pull.sh
> +++ b/t/t5520-pull.sh
> @@ -60,8 +60,8 @@ test_expect_success 'pulling into void does not overwrite untracked files' '
>  test_expect_success 'test . as a remote' '
>  
>  	git branch copy master &&
> -	git config branch.copy.remote . &&
> -	git config branch.copy.merge refs/heads/master &&
> +	test_config branch.copy.remote . &&
> +	test_config branch.copy.merge refs/heads/master &&
>  	echo updated >file &&
>  	git commit -a -m updated &&
>  	git checkout copy &&

I am not sure if this makes sense. The "copy" branch this test piece creates is used throughout the remainder of the test, and these configuration variables establish a known default for cases the later test checks when these various forms of "git pull" command omits "from where" and "which branch". It feels actively wrong to discard that information after this test piece is done.

Show 46 quoted lines
> @@ -96,8 +96,7 @@ test_expect_success '--rebase' '
>  '
>  test_expect_success 'pull.rebase' '
>  	git reset --hard before-rebase &&
> -	git config --bool pull.rebase true &&
> -	test_when_finished "git config --unset pull.rebase" &&
> +	test_config pull.rebase true &&
>  	git pull . copy &&
>  	test $(git rev-parse HEAD^) = $(git rev-parse copy) &&
>  	test new = $(git show HEAD:file2)
> @@ -105,8 +104,7 @@ test_expect_success 'pull.rebase' '
>  
>  test_expect_success 'branch.to-rebase.rebase' '
>  	git reset --hard before-rebase &&
> -	git config --bool branch.to-rebase.rebase true &&
> -	test_when_finished "git config --unset branch.to-rebase.rebase" &&
> +	test_config branch.to-rebase.rebase true &&
>  	git pull . copy &&
>  	test $(git rev-parse HEAD^) = $(git rev-parse copy) &&
>  	test new = $(git show HEAD:file2)
> @@ -114,10 +112,8 @@ test_expect_success 'branch.to-rebase.rebase' '
>  
>  test_expect_success 'branch.to-rebase.rebase should override pull.rebase' '
>  	git reset --hard before-rebase &&
> -	git config --bool pull.rebase true &&
> -	test_when_finished "git config --unset pull.rebase" &&
> -	git config --bool branch.to-rebase.rebase false &&
> -	test_when_finished "git config --unset branch.to-rebase.rebase" &&
> +	test_config pull.rebase true &&
> +	test_config branch.to-rebase.rebase false &&
>  	git pull . copy &&
>  	test $(git rev-parse HEAD^) != $(git rev-parse copy) &&
>  	test new = $(git show HEAD:file2)
> @@ -171,9 +167,9 @@ test_expect_success 'pull --rebase dies early with dirty working directory' '
>  	git update-ref refs/remotes/me/copy copy^ &&
>  	COPY=$(git rev-parse --verify me/copy) &&
>  	git rebase --onto $COPY copy &&
> -	git config branch.to-rebase.remote me &&
> -	git config branch.to-rebase.merge refs/heads/copy &&
> -	git config branch.to-rebase.rebase true &&
> +	test_config branch.to-rebase.remote me &&
> +	test_config branch.to-rebase.merge refs/heads/copy &&
> +	test_config branch.to-rebase.rebase true &&
>  	echo dirty >> file &&
>  	git add file &&
>  	test_must_fail git pull &&
Previous: Ramkumar RamachandraNext: Ramkumar Ramachandra
Message 4 of 8 in “Fix a couple of minor things in pull test”
  1. 0/2 Fix a couple of minor things in pull testRamkumar Ramachandra, Mar 22, 2013
  2. 1/2 t5520 (pull): update test descriptionRamkumar Ramachandra, Mar 22, 2013
  3. 2/2 t5520 (pull): use test_config where appropriateRamkumar Ramachandra, Mar 22, 2013
  4. Junio C HamanoMar 25, 2013
  5. 2/2 t5520 (pull): use test_config where appropriateRamkumar Ramachandra, Mar 28, 2013
  6. Junio C HamanoMar 28, 2013
  7. Ramkumar RamachandraMar 28, 2013
  8. Junio C HamanoMar 28, 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.