Skip to content

Commit 18c8ff4

Browse files
jrngitster
authored andcommitted
t3508 (cherry-pick): futureproof against unmerged files
Each of the tests in t3508 begins by navigating to a sane state: git checkout master && git reset --hard $commit If a previous test left unmerged files around, they are untouched and the checkout fails, causing later tests to fail, too. This is not a problem in practice because no test except the final one produces unmerged files. But as a futureproofing measure, it is still best to avoid the problem with 'checkout -f'. In particular, this is needed for new tests to be added to the end of the script. Signed-off-by: Jonathan Nieder <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 86c7bb4 commit 18c8ff4

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

t/t3508-cherry-pick-many-commits.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ test_expect_success setup '
2323
'
2424

2525
test_expect_success 'cherry-pick first..fourth works' '
26-
git checkout master &&
26+
git checkout -f master &&
2727
git reset --hard first &&
2828
test_tick &&
2929
git cherry-pick first..fourth &&
@@ -33,7 +33,7 @@ test_expect_success 'cherry-pick first..fourth works' '
3333
'
3434

3535
test_expect_success 'cherry-pick --ff first..fourth works' '
36-
git checkout master &&
36+
git checkout -f master &&
3737
git reset --hard first &&
3838
test_tick &&
3939
git cherry-pick --ff first..fourth &&
@@ -43,7 +43,7 @@ test_expect_success 'cherry-pick --ff first..fourth works' '
4343
'
4444

4545
test_expect_success 'cherry-pick -n first..fourth works' '
46-
git checkout master &&
46+
git checkout -f master &&
4747
git reset --hard first &&
4848
test_tick &&
4949
git cherry-pick -n first..fourth &&
@@ -53,7 +53,7 @@ test_expect_success 'cherry-pick -n first..fourth works' '
5353
'
5454

5555
test_expect_success 'revert first..fourth works' '
56-
git checkout master &&
56+
git checkout -f master &&
5757
git reset --hard fourth &&
5858
test_tick &&
5959
git revert first..fourth &&
@@ -63,7 +63,7 @@ test_expect_success 'revert first..fourth works' '
6363
'
6464

6565
test_expect_success 'revert ^first fourth works' '
66-
git checkout master &&
66+
git checkout -f master &&
6767
git reset --hard fourth &&
6868
test_tick &&
6969
git revert ^first fourth &&
@@ -73,7 +73,7 @@ test_expect_success 'revert ^first fourth works' '
7373
'
7474

7575
test_expect_success 'revert fourth fourth~1 fourth~2 works' '
76-
git checkout master &&
76+
git checkout -f master &&
7777
git reset --hard fourth &&
7878
test_tick &&
7979
git revert fourth fourth~1 fourth~2 &&
@@ -83,7 +83,7 @@ test_expect_success 'revert fourth fourth~1 fourth~2 works' '
8383
'
8484

8585
test_expect_failure 'cherry-pick -3 fourth works' '
86-
git checkout master &&
86+
git checkout -f master &&
8787
git reset --hard first &&
8888
test_tick &&
8989
git cherry-pick -3 fourth &&

0 commit comments

Comments
 (0)