git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] Fix a couple of minor things in pull test
@ 2013-03-22 12:31 Ramkumar Ramachandra
  2013-03-22 12:31 ` [PATCH 1/2] t5520 (pull): update test description Ramkumar Ramachandra
  2013-03-22 12:31 ` [PATCH 2/2] t5520 (pull): use test_config where appropriate Ramkumar Ramachandra
  0 siblings, 2 replies; 8+ messages in thread
From: Ramkumar Ramachandra @ 2013-03-22 12:31 UTC (permalink / raw)
  To: Git List

I just happened to open the file when searching for the right file to
put my autostash tests.

Ramkumar Ramachandra (2):
  t5520 (pull): update test description
  t5520 (pull): use test_config where appropriate

 t/t5520-pull.sh | 24 ++++++++++--------------
 1 file changed, 10 insertions(+), 14 deletions(-)

-- 
1.8.2.141.gad203c2.dirty

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/2] t5520 (pull): update test description
  2013-03-22 12:31 [PATCH 0/2] Fix a couple of minor things in pull test Ramkumar Ramachandra
@ 2013-03-22 12:31 ` Ramkumar Ramachandra
  2013-03-22 12:31 ` [PATCH 2/2] t5520 (pull): use test_config where appropriate Ramkumar Ramachandra
  1 sibling, 0 replies; 8+ messages in thread
From: Ramkumar Ramachandra @ 2013-03-22 12:31 UTC (permalink / raw)
  To: Git List

d09e79c (git-pull: allow pulling into an empty repository, 2006-11-16)
created the file with the description.  At the time, there were only
tests to check pulling into an empty repository.  The description was
never updated even after more tests, unrelated to the original, were
added.  Fix this now.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
---
 t/t5520-pull.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh
index 35304b4..e5adee8 100755
--- a/t/t5520-pull.sh
+++ b/t/t5520-pull.sh
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-test_description='pulling into void'
+test_description='pull basic functionality'
 
 . ./test-lib.sh
 
-- 
1.8.2.141.gad203c2.dirty

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/2] t5520 (pull): use test_config where appropriate
  2013-03-22 12:31 [PATCH 0/2] Fix a couple of minor things in pull test Ramkumar Ramachandra
  2013-03-22 12:31 ` [PATCH 1/2] t5520 (pull): update test description Ramkumar Ramachandra
@ 2013-03-22 12:31 ` Ramkumar Ramachandra
  2013-03-25 15:59   ` Junio C Hamano
  1 sibling, 1 reply; 8+ messages in thread
From: Ramkumar Ramachandra @ 2013-03-22 12:31 UTC (permalink / raw)
  To: Git List

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 &&
@@ -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 &&
-- 
1.8.2.141.gad203c2.dirty

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/2] t5520 (pull): use test_config where appropriate
  2013-03-22 12:31 ` [PATCH 2/2] t5520 (pull): use test_config where appropriate Ramkumar Ramachandra
@ 2013-03-25 15:59   ` Junio C Hamano
  2013-03-28 12:40     ` [PATCH v2 " Ramkumar Ramachandra
  0 siblings, 1 reply; 8+ messages in thread
From: Junio C Hamano @ 2013-03-25 15:59 UTC (permalink / raw)
  To: Ramkumar Ramachandra; +Cc: Git List

Ramkumar Ramachandra <artagnon@gmail.com> writes:

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

> @@ -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 &&

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v2 2/2] t5520 (pull): use test_config where appropriate
  2013-03-25 15:59   ` Junio C Hamano
@ 2013-03-28 12:40     ` Ramkumar Ramachandra
  2013-03-28 14:50       ` Junio C Hamano
  0 siblings, 1 reply; 8+ messages in thread
From: Ramkumar Ramachandra @ 2013-03-28 12:40 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Git List

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>
---
 Removed first hunk, as per Junio's comment.

 t/t5520-pull.sh | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh
index e5adee8..87777ea 100755
--- a/t/t5520-pull.sh
+++ b/t/t5520-pull.sh
@@ -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 &&
-- 
1.8.2.141.g07926c6

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 2/2] t5520 (pull): use test_config where appropriate
  2013-03-28 12:40     ` [PATCH v2 " Ramkumar Ramachandra
@ 2013-03-28 14:50       ` Junio C Hamano
  2013-03-28 14:57         ` Ramkumar Ramachandra
  2013-03-28 15:17         ` Junio C Hamano
  0 siblings, 2 replies; 8+ messages in thread
From: Junio C Hamano @ 2013-03-28 14:50 UTC (permalink / raw)
  To: Ramkumar Ramachandra; +Cc: Git List

Ramkumar Ramachandra <artagnon@gmail.com> writes:

> 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>
> ---
>  Removed first hunk, as per Junio's comment.

Thanks, but doesn't yd/use-test-config-unconfig topic already
address this?

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 2/2] t5520 (pull): use test_config where appropriate
  2013-03-28 14:50       ` Junio C Hamano
@ 2013-03-28 14:57         ` Ramkumar Ramachandra
  2013-03-28 15:17         ` Junio C Hamano
  1 sibling, 0 replies; 8+ messages in thread
From: Ramkumar Ramachandra @ 2013-03-28 14:57 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Git List

Junio C Hamano wrote:
> Thanks, but doesn't yd/use-test-config-unconfig topic already
> address this?

Just saw it.  9d6aa64 is identical to my patch, but misses the fourth hunk.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 2/2] t5520 (pull): use test_config where appropriate
  2013-03-28 14:50       ` Junio C Hamano
  2013-03-28 14:57         ` Ramkumar Ramachandra
@ 2013-03-28 15:17         ` Junio C Hamano
  1 sibling, 0 replies; 8+ messages in thread
From: Junio C Hamano @ 2013-03-28 15:17 UTC (permalink / raw)
  To: Ramkumar Ramachandra; +Cc: Git List

Junio C Hamano <gitster@pobox.com> writes:

> Ramkumar Ramachandra <artagnon@gmail.com> writes:
>
>> 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>
>> ---
>>  Removed first hunk, as per Junio's comment.
>
> Thanks, but doesn't yd/use-test-config-unconfig topic already
> address this?

The last hunk from your version was missing from 9d6aa64dc32b
(t5520: use test_config to set/unset git config variables,
2013-03-24); I'll pick that part and apply as a follow up to the
series.

No need to resend; thanks.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2013-03-28 15:17 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-22 12:31 [PATCH 0/2] Fix a couple of minor things in pull test Ramkumar Ramachandra
2013-03-22 12:31 ` [PATCH 1/2] t5520 (pull): update test description Ramkumar Ramachandra
2013-03-22 12:31 ` [PATCH 2/2] t5520 (pull): use test_config where appropriate Ramkumar Ramachandra
2013-03-25 15:59   ` Junio C Hamano
2013-03-28 12:40     ` [PATCH v2 " Ramkumar Ramachandra
2013-03-28 14:50       ` Junio C Hamano
2013-03-28 14:57         ` Ramkumar Ramachandra
2013-03-28 15:17         ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).