t6200 (fmt-merge-msg): style nitpicks
Guard setup with test_expect_success. Use test_might_fail instead of ignoring the exit code from git config --unset. Point out setup commands that are shared by multiple tests, to make it easy to write GIT_SKIP_TESTS specifications that work. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
9cbdd76e09
commit
d834c96a0e
@ -70,14 +70,13 @@ test_expect_success setup '
|
|||||||
i=$(($i+1))
|
i=$(($i+1))
|
||||||
done &&
|
done &&
|
||||||
|
|
||||||
git show-branch
|
git show-branch &&
|
||||||
|
|
||||||
|
apos="'\''"
|
||||||
'
|
'
|
||||||
|
|
||||||
cat >expected <<\EOF
|
test_expect_success 'message for merging local branch' '
|
||||||
Merge branch 'left'
|
echo "Merge branch ${apos}left${apos}" >expected &&
|
||||||
EOF
|
|
||||||
|
|
||||||
test_expect_success 'merge-msg test #1' '
|
|
||||||
|
|
||||||
git checkout master &&
|
git checkout master &&
|
||||||
git fetch . left &&
|
git fetch . left &&
|
||||||
@ -86,11 +85,8 @@ test_expect_success 'merge-msg test #1' '
|
|||||||
test_cmp expected actual
|
test_cmp expected actual
|
||||||
'
|
'
|
||||||
|
|
||||||
cat >expected <<EOF
|
test_expect_success 'message for merging external branch' '
|
||||||
Merge branch 'left' of $(pwd)
|
echo "Merge branch ${apos}left${apos} of $(pwd)" >expected &&
|
||||||
EOF
|
|
||||||
|
|
||||||
test_expect_success 'merge-msg test #2' '
|
|
||||||
|
|
||||||
git checkout master &&
|
git checkout master &&
|
||||||
git fetch "$(pwd)" left &&
|
git fetch "$(pwd)" left &&
|
||||||
@ -99,8 +95,9 @@ test_expect_success 'merge-msg test #2' '
|
|||||||
test_cmp expected actual
|
test_cmp expected actual
|
||||||
'
|
'
|
||||||
|
|
||||||
cat >expected <<\EOF
|
test_expect_success '[merge] summary/log configuration' '
|
||||||
Merge branch 'left'
|
cat >expected <<-EOF &&
|
||||||
|
Merge branch ${apos}left${apos}
|
||||||
|
|
||||||
* left:
|
* left:
|
||||||
Left #5
|
Left #5
|
||||||
@ -110,36 +107,31 @@ Merge branch 'left'
|
|||||||
Common #1
|
Common #1
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
test_expect_success 'merge-msg test #3-1' '
|
|
||||||
|
|
||||||
git config --unset-all merge.log
|
|
||||||
git config --unset-all merge.summary
|
|
||||||
git config merge.log true &&
|
git config merge.log true &&
|
||||||
|
test_might_fail git config --unset-all merge.summary &&
|
||||||
|
|
||||||
git checkout master &&
|
git checkout master &&
|
||||||
test_tick &&
|
test_tick &&
|
||||||
git fetch . left &&
|
git fetch . left &&
|
||||||
|
|
||||||
git fmt-merge-msg <.git/FETCH_HEAD >actual &&
|
git fmt-merge-msg <.git/FETCH_HEAD >actual1 &&
|
||||||
test_cmp expected actual
|
|
||||||
'
|
|
||||||
|
|
||||||
test_expect_success 'merge-msg test #3-2' '
|
test_might_fail git config --unset-all merge.log &&
|
||||||
|
|
||||||
git config --unset-all merge.log
|
|
||||||
git config --unset-all merge.summary
|
|
||||||
git config merge.summary true &&
|
git config merge.summary true &&
|
||||||
|
|
||||||
git checkout master &&
|
git checkout master &&
|
||||||
test_tick &&
|
test_tick &&
|
||||||
git fetch . left &&
|
git fetch . left &&
|
||||||
|
|
||||||
git fmt-merge-msg <.git/FETCH_HEAD >actual &&
|
git fmt-merge-msg <.git/FETCH_HEAD >actual2 &&
|
||||||
test_cmp expected actual
|
|
||||||
|
test_cmp expected actual1 &&
|
||||||
|
test_cmp expected actual2
|
||||||
'
|
'
|
||||||
|
|
||||||
cat >expected <<\EOF
|
test_expect_success 'setup: expected shortlog for two branches' '
|
||||||
Merge branches 'left' and 'right'
|
cat >expected <<-EOF
|
||||||
|
Merge branches ${apos}left${apos} and ${apos}right${apos}
|
||||||
|
|
||||||
* left:
|
* left:
|
||||||
Left #5
|
Left #5
|
||||||
@ -155,83 +147,56 @@ Merge branches 'left' and 'right'
|
|||||||
Common #2
|
Common #2
|
||||||
Common #1
|
Common #1
|
||||||
EOF
|
EOF
|
||||||
|
'
|
||||||
|
|
||||||
test_expect_success 'merge-msg test #4-1' '
|
test_expect_success 'shortlog for two branches' '
|
||||||
|
|
||||||
git config --unset-all merge.log
|
|
||||||
git config --unset-all merge.summary
|
|
||||||
git config merge.log true &&
|
git config merge.log true &&
|
||||||
|
test_might_fail git config --unset-all merge.summary &&
|
||||||
git checkout master &&
|
git checkout master &&
|
||||||
test_tick &&
|
test_tick &&
|
||||||
git fetch . left right &&
|
git fetch . left right &&
|
||||||
|
git fmt-merge-msg <.git/FETCH_HEAD >actual1 &&
|
||||||
|
|
||||||
git fmt-merge-msg <.git/FETCH_HEAD >actual &&
|
test_might_fail git config --unset-all merge.log &&
|
||||||
test_cmp expected actual
|
|
||||||
'
|
|
||||||
|
|
||||||
test_expect_success 'merge-msg test #4-2' '
|
|
||||||
|
|
||||||
git config --unset-all merge.log
|
|
||||||
git config --unset-all merge.summary
|
|
||||||
git config merge.summary true &&
|
git config merge.summary true &&
|
||||||
|
|
||||||
git checkout master &&
|
git checkout master &&
|
||||||
test_tick &&
|
test_tick &&
|
||||||
git fetch . left right &&
|
git fetch . left right &&
|
||||||
|
git fmt-merge-msg <.git/FETCH_HEAD >actual2 &&
|
||||||
|
|
||||||
git fmt-merge-msg <.git/FETCH_HEAD >actual &&
|
|
||||||
test_cmp expected actual
|
|
||||||
'
|
|
||||||
|
|
||||||
test_expect_success 'merge-msg test #5-1' '
|
|
||||||
|
|
||||||
git config --unset-all merge.log
|
|
||||||
git config --unset-all merge.summary
|
|
||||||
git config merge.log yes &&
|
git config merge.log yes &&
|
||||||
|
test_might_fail git config --unset-all merge.summary &&
|
||||||
git checkout master &&
|
git checkout master &&
|
||||||
test_tick &&
|
test_tick &&
|
||||||
git fetch . left right &&
|
git fetch . left right &&
|
||||||
|
git fmt-merge-msg <.git/FETCH_HEAD >actual3 &&
|
||||||
|
|
||||||
git fmt-merge-msg <.git/FETCH_HEAD >actual &&
|
test_might_fail git config --unset-all merge.log &&
|
||||||
test_cmp expected actual
|
|
||||||
'
|
|
||||||
|
|
||||||
test_expect_success 'merge-msg test #5-2' '
|
|
||||||
|
|
||||||
git config --unset-all merge.log
|
|
||||||
git config --unset-all merge.summary
|
|
||||||
git config merge.summary yes &&
|
git config merge.summary yes &&
|
||||||
|
|
||||||
git checkout master &&
|
git checkout master &&
|
||||||
test_tick &&
|
test_tick &&
|
||||||
git fetch . left right &&
|
git fetch . left right &&
|
||||||
|
git fmt-merge-msg <.git/FETCH_HEAD >actual4 &&
|
||||||
|
|
||||||
git fmt-merge-msg <.git/FETCH_HEAD >actual &&
|
test_cmp expected actual1 &&
|
||||||
test_cmp expected actual
|
test_cmp expected actual2 &&
|
||||||
|
test_cmp expected actual3 &&
|
||||||
|
test_cmp expected actual4
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'merge-msg -F' '
|
test_expect_success 'merge-msg -F' '
|
||||||
|
test_might_fail git config --unset-all merge.log &&
|
||||||
git config --unset-all merge.log
|
|
||||||
git config --unset-all merge.summary
|
|
||||||
git config merge.summary yes &&
|
git config merge.summary yes &&
|
||||||
|
|
||||||
git checkout master &&
|
git checkout master &&
|
||||||
test_tick &&
|
test_tick &&
|
||||||
git fetch . left right &&
|
git fetch . left right &&
|
||||||
|
|
||||||
git fmt-merge-msg -F .git/FETCH_HEAD >actual &&
|
git fmt-merge-msg -F .git/FETCH_HEAD >actual &&
|
||||||
test_cmp expected actual
|
test_cmp expected actual
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'merge-msg -F in subdirectory' '
|
test_expect_success 'merge-msg -F in subdirectory' '
|
||||||
|
test_might_fail git config --unset-all merge.log &&
|
||||||
git config --unset-all merge.log
|
|
||||||
git config --unset-all merge.summary
|
|
||||||
git config merge.summary yes &&
|
git config merge.summary yes &&
|
||||||
|
|
||||||
git checkout master &&
|
git checkout master &&
|
||||||
test_tick &&
|
test_tick &&
|
||||||
git fetch . left right &&
|
git fetch . left right &&
|
||||||
@ -245,11 +210,11 @@ test_expect_success 'merge-msg -F in subdirectory' '
|
|||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'merge-msg with nothing to merge' '
|
test_expect_success 'merge-msg with nothing to merge' '
|
||||||
|
test_might_fail git config --unset-all merge.log &&
|
||||||
git config --unset-all merge.log
|
|
||||||
git config --unset-all merge.summary
|
|
||||||
git config merge.summary yes &&
|
git config merge.summary yes &&
|
||||||
|
|
||||||
|
>empty &&
|
||||||
|
|
||||||
(
|
(
|
||||||
cd remote &&
|
cd remote &&
|
||||||
git checkout -b unrelated &&
|
git checkout -b unrelated &&
|
||||||
@ -258,22 +223,20 @@ test_expect_success 'merge-msg with nothing to merge' '
|
|||||||
git fmt-merge-msg <.git/FETCH_HEAD >../actual
|
git fmt-merge-msg <.git/FETCH_HEAD >../actual
|
||||||
) &&
|
) &&
|
||||||
|
|
||||||
test_cmp /dev/null actual
|
test_cmp empty actual
|
||||||
'
|
'
|
||||||
|
|
||||||
cat >expected <<\EOF
|
test_expect_success 'merge-msg tag' '
|
||||||
Merge tag 'tag-r3'
|
cat >expected <<-EOF &&
|
||||||
|
Merge tag ${apos}tag-r3${apos}
|
||||||
|
|
||||||
* tag 'tag-r3':
|
* tag ${apos}tag-r3${apos}:
|
||||||
Right #3
|
Right #3
|
||||||
Common #2
|
Common #2
|
||||||
Common #1
|
Common #1
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
test_expect_success 'merge-msg tag' '
|
test_might_fail git config --unset-all merge.log &&
|
||||||
|
|
||||||
git config --unset-all merge.log
|
|
||||||
git config --unset-all merge.summary
|
|
||||||
git config merge.summary yes &&
|
git config merge.summary yes &&
|
||||||
|
|
||||||
git checkout master &&
|
git checkout master &&
|
||||||
@ -284,15 +247,16 @@ test_expect_success 'merge-msg tag' '
|
|||||||
test_cmp expected actual
|
test_cmp expected actual
|
||||||
'
|
'
|
||||||
|
|
||||||
cat >expected <<\EOF
|
test_expect_success 'merge-msg two tags' '
|
||||||
Merge tags 'tag-r3' and 'tag-l5'
|
cat >expected <<-EOF &&
|
||||||
|
Merge tags ${apos}tag-r3${apos} and ${apos}tag-l5${apos}
|
||||||
|
|
||||||
* tag 'tag-r3':
|
* tag ${apos}tag-r3${apos}:
|
||||||
Right #3
|
Right #3
|
||||||
Common #2
|
Common #2
|
||||||
Common #1
|
Common #1
|
||||||
|
|
||||||
* tag 'tag-l5':
|
* tag ${apos}tag-l5${apos}:
|
||||||
Left #5
|
Left #5
|
||||||
Left #4
|
Left #4
|
||||||
Left #3
|
Left #3
|
||||||
@ -300,10 +264,7 @@ Merge tags 'tag-r3' and 'tag-l5'
|
|||||||
Common #1
|
Common #1
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
test_expect_success 'merge-msg two tags' '
|
test_might_fail git config --unset-all merge.log &&
|
||||||
|
|
||||||
git config --unset-all merge.log
|
|
||||||
git config --unset-all merge.summary
|
|
||||||
git config merge.summary yes &&
|
git config merge.summary yes &&
|
||||||
|
|
||||||
git checkout master &&
|
git checkout master &&
|
||||||
@ -314,10 +275,11 @@ test_expect_success 'merge-msg two tags' '
|
|||||||
test_cmp expected actual
|
test_cmp expected actual
|
||||||
'
|
'
|
||||||
|
|
||||||
cat >expected <<\EOF
|
test_expect_success 'merge-msg tag and branch' '
|
||||||
Merge branch 'left', tag 'tag-r3'
|
cat >expected <<-EOF &&
|
||||||
|
Merge branch ${apos}left${apos}, tag ${apos}tag-r3${apos}
|
||||||
|
|
||||||
* tag 'tag-r3':
|
* tag ${apos}tag-r3${apos}:
|
||||||
Right #3
|
Right #3
|
||||||
Common #2
|
Common #2
|
||||||
Common #1
|
Common #1
|
||||||
@ -330,10 +292,7 @@ Merge branch 'left', tag 'tag-r3'
|
|||||||
Common #1
|
Common #1
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
test_expect_success 'merge-msg tag and branch' '
|
test_might_fail git config --unset-all merge.log &&
|
||||||
|
|
||||||
git config --unset-all merge.log
|
|
||||||
git config --unset-all merge.summary
|
|
||||||
git config merge.summary yes &&
|
git config merge.summary yes &&
|
||||||
|
|
||||||
git checkout master &&
|
git checkout master &&
|
||||||
@ -344,25 +303,26 @@ test_expect_success 'merge-msg tag and branch' '
|
|||||||
test_cmp expected actual
|
test_cmp expected actual
|
||||||
'
|
'
|
||||||
|
|
||||||
cat >expected <<\EOF
|
test_expect_success 'merge-msg lots of commits' '
|
||||||
Merge branch 'long'
|
{
|
||||||
|
cat <<-EOF &&
|
||||||
|
Merge branch ${apos}long${apos}
|
||||||
|
|
||||||
* long: (35 commits)
|
* long: (35 commits)
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
test_expect_success 'merge-msg lots of commits' '
|
|
||||||
|
|
||||||
git checkout master &&
|
|
||||||
test_tick &&
|
|
||||||
git fetch . long &&
|
|
||||||
|
|
||||||
i=29 &&
|
i=29 &&
|
||||||
while test $i -gt 9
|
while test $i -gt 9
|
||||||
do
|
do
|
||||||
echo " $i" &&
|
echo " $i" &&
|
||||||
i=$(($i-1))
|
i=$(($i-1))
|
||||||
done >>expected &&
|
done &&
|
||||||
echo " ..." >>expected
|
echo " ..."
|
||||||
|
} >expected &&
|
||||||
|
|
||||||
|
git checkout master &&
|
||||||
|
test_tick &&
|
||||||
|
git fetch . long &&
|
||||||
|
|
||||||
git fmt-merge-msg <.git/FETCH_HEAD >actual &&
|
git fmt-merge-msg <.git/FETCH_HEAD >actual &&
|
||||||
test_cmp expected actual
|
test_cmp expected actual
|
||||||
|
Loading…
Reference in New Issue
Block a user