Fix a couple of minor things in pull test
cover Fix a couple of minor things in pull test
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(-)
Signature · 1 line
1.8.2.141.gad203c2.dirty
PATCH 1/2 t5520 (pull): update test description
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.
--- t/t5520-pull.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
t/t5520-pull.sh +1 -1
@@ -1,6 +1,6 @@ #!/bin/sh -test_description='pulling into void' +test_description='pull basic functionality' . ./test-lib.sh
Signature · 1 line
1.8.2.141.gad203c2.dirty
PATCH 2/2 t5520 (pull): use test_config where appropriate
In reply to Ramkumar RamachandraConfiguration from test_config does not last beyond the end of the current test assertion, making each test easier to think about in isolation.
--- t/t5520-pull.sh | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-)
t/t5520-pull.sh +9 -13
@@ -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 &&
Signature · 1 line
1.8.2.141.gad203c2.dirty
Re: [PATCH 2/2] t5520 (pull): use test_config where appropriate
Quoted 14 lines · Ramkumar Ramachandra
Configuration from
test_configdoes not last beyond the end of the current test assertion, making each test easier to think about in isolation.Signed-off-by Ramkumar Ramachandra <[email protected]>--- t/t5520-pull.sh | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-)t/t5520-pull.sh +0
-0
t/t5520-pull.sh test_expect_success 'pulling into void does not overwrite untracked files' ' · line 67
Quoted 10 lines
t/t5520-pull.sh +2
-2@@ -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.
Quoted 46 lines
t/t5520-pull.sh +7
-11@@ -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 &&
PATCH v2 2/2 t5520 (pull): use test_config where appropriate
Configuration from test_config does not last beyond the end of the current test assertion, making each test easier to think about in isolation.
---
Removed first hunk, as per Junio's comment.
t/t5520-pull.sh | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-)
t/t5520-pull.sh +7 -11
@@ -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 &&
Signature · 1 line
1.8.2.141.g07926c6
Re: [PATCH v2 2/2] t5520 (pull): use test_config where appropriate
Quoted 7 lines · Ramkumar Ramachandra
Configuration from
test_configdoes not last beyond the end of the current test assertion, making each test easier to think about in isolation.Signed-off-by Ramkumar Ramachandra <[email protected]>---
Removed first hunk, as per Junio's comment.
Thanks, but doesn't yd/use-test-config-unconfig topic already address this?
Re: [PATCH v2 2/2] t5520 (pull): use test_config where appropriate
Quoted 6 lines · Junio C Hamano
Quoted 4 lines · Ramkumar Ramachandra
Configuration from
test_configdoes not last beyond the end of the current test assertion, making each test easier to think about in isolation.
Quoted 6 lines
Quoted 3 lines
Signed-off-by Ramkumar Ramachandra <[email protected]>---
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.
Re: [PATCH v2 2/2] t5520 (pull): use test_config where appropriate
In reply to Junio C HamanoQuoted 2 lines · Junio C Hamano
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.