Skip to content

Commit

Permalink
t5520: use test_config to set/unset git config variables
Browse files Browse the repository at this point in the history
Instead of using construct such as:
    test_when_finished "git config --unset <key>"
    git config <key> <value>
uses
    test_config <key> <value>
The latter takes care of removing <key> at the end of the test.

Signed-off-by: Yann Droneaud <ydroneaud@opteya.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Yann Droneaud authored and Junio C Hamano committed Mar 25, 2013
1 parent 90e76b7 commit 9d6aa64
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions t/t5520-pull.sh
Original file line number Diff line number Diff line change
Expand Up @@ -96,28 +96,24 @@ 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)
'

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)
'

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)
Expand Down

0 comments on commit 9d6aa64

Please sign in to comment.