#!/bin/sh global test_description := ''cherry-pick should rerere for conflicts'' source ./test-lib.sh test_expect_success setup ' echo foo >foo && git add foo && test_tick && git commit -q -m 1 && echo foo-master >foo && git add foo && test_tick && git commit -q -m 2 && git checkout -b dev HEAD^ && echo foo-dev >foo && git add foo && test_tick && git commit -q -m 3 && git config rerere.enabled true ' test_expect_success 'conflicting merge' ' test_must_fail git merge master ' test_expect_success 'fixup' ' echo foo-dev >foo && git add foo && test_tick && git commit -q -m 4 && git reset --hard HEAD^ && echo foo-dev >expect ' test_expect_success 'cherry-pick conflict' ' test_must_fail git cherry-pick master && test_cmp expect foo ' test_expect_success 'reconfigure' ' git config rerere.enabled false && git reset --hard ' test_expect_success 'cherry-pick conflict without rerere' ' test_must_fail git cherry-pick master && test_must_fail test_cmp expect foo ' test_done (CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_description) op: Equal rhs: {(SQ <"cherry-pick should rerere for conflicts">)} spids: [4] ) ] spids: [4] ) (C {(.)} {(./test-lib.sh)}) (C {(test_expect_success)} {(setup)} { (SQ <"\n"> <"\techo foo >foo &&\n"> <"\tgit add foo && test_tick && git commit -q -m 1 &&\n"> <"\techo foo-master >foo &&\n"> <"\tgit add foo && test_tick && git commit -q -m 2 &&\n"> <"\n"> <"\tgit checkout -b dev HEAD^ &&\n"> <"\techo foo-dev >foo &&\n"> <"\tgit add foo && test_tick && git commit -q -m 3 &&\n"> <"\tgit config rerere.enabled true\n"> ) } ) (C {(test_expect_success)} {(SQ <"conflicting merge">)} {(SQ <"\n"> <"\ttest_must_fail git merge master\n">)} ) (C {(test_expect_success)} {(SQ )} { (SQ <"\n"> <"\techo foo-dev >foo &&\n"> <"\tgit add foo && test_tick && git commit -q -m 4 &&\n"> <"\tgit reset --hard HEAD^ &&\n"> <"\techo foo-dev >expect\n"> ) } ) (C {(test_expect_success)} {(SQ <"cherry-pick conflict">)} {(SQ <"\n"> <"\ttest_must_fail git cherry-pick master &&\n"> <"\ttest_cmp expect foo\n">)} ) (C {(test_expect_success)} {(SQ )} {(SQ <"\n"> <"\tgit config rerere.enabled false &&\n"> <"\tgit reset --hard\n">)} ) (C {(test_expect_success)} {(SQ <"cherry-pick conflict without rerere">)} { (SQ <"\n"> <"\ttest_must_fail git cherry-pick master &&\n"> <"\ttest_must_fail test_cmp expect foo\n"> ) } ) (C {(test_done)}) ] )