Skip to content

Commit

Permalink
t3508 (cherry-pick): futureproof against unmerged files
Browse files Browse the repository at this point in the history
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 <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Jonathan Nieder authored and Junio C Hamano committed Jun 14, 2010
1 parent 86c7bb4 commit 18c8ff4
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions t/t3508-cherry-pick-many-commits.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ test_expect_success setup '
'

test_expect_success 'cherry-pick first..fourth works' '
git checkout master &&
git checkout -f master &&
git reset --hard first &&
test_tick &&
git cherry-pick first..fourth &&
Expand All @@ -33,7 +33,7 @@ test_expect_success 'cherry-pick first..fourth works' '
'

test_expect_success 'cherry-pick --ff first..fourth works' '
git checkout master &&
git checkout -f master &&
git reset --hard first &&
test_tick &&
git cherry-pick --ff first..fourth &&
Expand All @@ -43,7 +43,7 @@ test_expect_success 'cherry-pick --ff first..fourth works' '
'

test_expect_success 'cherry-pick -n first..fourth works' '
git checkout master &&
git checkout -f master &&
git reset --hard first &&
test_tick &&
git cherry-pick -n first..fourth &&
Expand All @@ -53,7 +53,7 @@ test_expect_success 'cherry-pick -n first..fourth works' '
'

test_expect_success 'revert first..fourth works' '
git checkout master &&
git checkout -f master &&
git reset --hard fourth &&
test_tick &&
git revert first..fourth &&
Expand All @@ -63,7 +63,7 @@ test_expect_success 'revert first..fourth works' '
'

test_expect_success 'revert ^first fourth works' '
git checkout master &&
git checkout -f master &&
git reset --hard fourth &&
test_tick &&
git revert ^first fourth &&
Expand All @@ -73,7 +73,7 @@ test_expect_success 'revert ^first fourth works' '
'

test_expect_success 'revert fourth fourth~1 fourth~2 works' '
git checkout master &&
git checkout -f master &&
git reset --hard fourth &&
test_tick &&
git revert fourth fourth~1 fourth~2 &&
Expand All @@ -83,7 +83,7 @@ test_expect_success 'revert fourth fourth~1 fourth~2 works' '
'

test_expect_failure 'cherry-pick -3 fourth works' '
git checkout master &&
git checkout -f master &&
git reset --hard first &&
test_tick &&
git cherry-pick -3 fourth &&
Expand Down

0 comments on commit 18c8ff4

Please sign in to comment.