Skip to content

Commit

Permalink
t6200: use test_config/test_unconfig
Browse files Browse the repository at this point in the history
The tests were already well protected from previous ones by running
"git config --unset" on variables early they do not want to see, but
it is easier to make sure they start from a clean state by using
more modern test_config/test_unconfig helper functions.

It turns out that the last test depended on the merge.summary
configuration previous one leaves behind.  Set it explicitly in it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Junio C Hamano committed Apr 1, 2013
1 parent 2d1495f commit 9a94dba
Showing 1 changed file with 29 additions and 32 deletions.
61 changes: 29 additions & 32 deletions t/t6200-fmt-merge-msg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -112,17 +112,17 @@ test_expect_success '[merge] summary/log configuration' '
Common #1
EOF
git config merge.log true &&
test_might_fail git config --unset-all merge.summary &&
test_config merge.log true &&
test_unconfig merge.summary &&
git checkout master &&
test_tick &&
git fetch . left &&
git fmt-merge-msg <.git/FETCH_HEAD >actual1 &&
test_might_fail git config --unset-all merge.log &&
git config merge.summary true &&
test_unconfig merge.log &&
test_config merge.summary true &&
git checkout master &&
test_tick &&
Expand All @@ -134,11 +134,6 @@ test_expect_success '[merge] summary/log configuration' '
test_cmp expected actual2
'

test_expect_success 'setup: clear [merge] configuration' '
test_might_fail git config --unset-all merge.log &&
test_might_fail git config --unset-all merge.summary
'

test_expect_success 'setup FETCH_HEAD' '
git checkout master &&
test_tick &&
Expand Down Expand Up @@ -248,14 +243,14 @@ test_expect_success 'fmt-merge-msg -m' '
Common #1
EOF
test_might_fail git config --unset merge.log &&
test_might_fail git config --unset merge.summary &&
test_unconfig merge.log &&
test_unconfig merge.summary &&
git checkout master &&
git fetch "$(pwd)" left &&
git fmt-merge-msg -m "Sync with left" <.git/FETCH_HEAD >actual &&
git fmt-merge-msg --log -m "Sync with left" \
<.git/FETCH_HEAD >actual.log &&
git config merge.log true &&
test_config merge.log true &&
git fmt-merge-msg -m "Sync with left" \
<.git/FETCH_HEAD >actual.log-config &&
git fmt-merge-msg --no-log -m "Sync with left" \
Expand Down Expand Up @@ -290,29 +285,29 @@ test_expect_success 'setup: expected shortlog for two branches' '
'

test_expect_success 'shortlog for two branches' '
git config merge.log true &&
test_might_fail git config --unset-all merge.summary &&
test_config merge.log true &&
test_unconfig merge.summary &&
git checkout master &&
test_tick &&
git fetch . left right &&
git fmt-merge-msg <.git/FETCH_HEAD >actual1 &&
test_might_fail git config --unset-all merge.log &&
git config merge.summary true &&
test_unconfig merge.log &&
test_config merge.summary true &&
git checkout master &&
test_tick &&
git fetch . left right &&
git fmt-merge-msg <.git/FETCH_HEAD >actual2 &&
git config merge.log yes &&
test_might_fail git config --unset-all merge.summary &&
test_config merge.log yes &&
test_unconfig merge.summary &&
git checkout master &&
test_tick &&
git fetch . left right &&
git fmt-merge-msg <.git/FETCH_HEAD >actual3 &&
test_might_fail git config --unset-all merge.log &&
git config merge.summary yes &&
test_unconfig merge.log &&
test_config merge.summary yes &&
git checkout master &&
test_tick &&
git fetch . left right &&
Expand All @@ -325,8 +320,8 @@ test_expect_success 'shortlog for two branches' '
'

test_expect_success 'merge-msg -F' '
test_might_fail git config --unset-all merge.log &&
git config merge.summary yes &&
test_unconfig merge.log &&
test_config merge.summary yes &&
git checkout master &&
test_tick &&
git fetch . left right &&
Expand All @@ -335,8 +330,8 @@ test_expect_success 'merge-msg -F' '
'

test_expect_success 'merge-msg -F in subdirectory' '
test_might_fail git config --unset-all merge.log &&
git config merge.summary yes &&
test_unconfig merge.log &&
test_config merge.summary yes &&
git checkout master &&
test_tick &&
git fetch . left right &&
Expand All @@ -350,8 +345,8 @@ test_expect_success 'merge-msg -F in subdirectory' '
'

test_expect_success 'merge-msg with nothing to merge' '
test_might_fail git config --unset-all merge.log &&
git config merge.summary yes &&
test_unconfig merge.log &&
test_config merge.summary yes &&
>empty &&
Expand All @@ -376,8 +371,8 @@ test_expect_success 'merge-msg tag' '
Common #1
EOF
test_might_fail git config --unset-all merge.log &&
git config merge.summary yes &&
test_unconfig merge.log &&
test_config merge.summary yes &&
git checkout master &&
test_tick &&
Expand Down Expand Up @@ -406,8 +401,8 @@ test_expect_success 'merge-msg two tags' '
Common #1
EOF
test_might_fail git config --unset-all merge.log &&
git config merge.summary yes &&
test_unconfig merge.log &&
test_config merge.summary yes &&
git checkout master &&
test_tick &&
Expand Down Expand Up @@ -436,8 +431,8 @@ test_expect_success 'merge-msg tag and branch' '
Common #1
EOF
test_might_fail git config --unset-all merge.log &&
git config merge.summary yes &&
test_unconfig merge.log &&
test_config merge.summary yes &&
git checkout master &&
test_tick &&
Expand All @@ -464,6 +459,8 @@ test_expect_success 'merge-msg lots of commits' '
echo " ..."
} >expected &&
test_config merge.summary yes &&
git checkout master &&
test_tick &&
git fetch . long &&
Expand Down

0 comments on commit 9a94dba

Please sign in to comment.