(CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_description) op: Equal rhs: { (SQ <"git rerere\n"> <"\n"> <"! [fifth] version1\n"> <" ! [first] first\n"> <" ! [fourth] version1\n"> <" ! [master] initial\n"> <" ! [second] prefer first over second\n"> <" ! [third] version2\n"> <"------\n"> <" + [third] version2\n"> <"+ [fifth] version1\n"> <" + [fourth] version1\n"> <"+ + + [third^] third\n"> <" - [second] prefer first over second\n"> <" + + [first] first\n"> <" + [second^] second\n"> <"++++++ [master] initial\n"> ) } spids: [13] ) ] spids: [13] ) (C {(.)} {(./test-lib.sh)}) (C {(test_expect_success)} {(SQ <setup>)} {(SQ <"\n"> <"\tcat >a1 <<-\\EOF &&\n"> <"\tSome title\n"> <"\t==========\n"> <"\tWhether ">) (EscapedLiteralPart token:<Lit_EscapedChar "\\'">) (SQ <"tis nobler in the mind to suffer\n"> <"\tThe slings and arrows of outrageous fortune,\n"> <"\tOr to take arms against a sea of troubles,\n"> <"\tAnd by opposing end them? To die: to sleep;\n"> <"\tNo more; and by a sleep to say we end\n"> <"\tThe heart-ache and the thousand natural shocks\n"> <"\tThat flesh is heir to, "> ) (EscapedLiteralPart token:<Lit_EscapedChar "\\'">) (SQ <"tis a consummation\n"> <"\tDevoutly to be wish">) (EscapedLiteralPart token:<Lit_EscapedChar "\\'">) (SQ <"d.\n"> <"\tEOF\n"> <"\n"> <"\tgit add a1 &&\n"> <"\ttest_tick &&\n"> <"\tgit commit -q -a -m initial &&\n"> <"\n"> <"\tcat >>a1 <<-\\EOF &&\n"> <"\tSome title\n"> <"\t==========\n"> <"\tTo die, to sleep;\n"> <"\tTo sleep: perchance to dream: ay, there"> ) (EscapedLiteralPart token:<Lit_EscapedChar "\\'">) (SQ <"s the rub;\n"> <"\tFor in that sleep of death what dreams may come\n"> <"\tWhen we have shuffled off this mortal coil,\n"> <"\tMust give us pause: there"> ) (EscapedLiteralPart token:<Lit_EscapedChar "\\'">) (SQ <"s the respect\n"> <"\tThat makes calamity of so long life;\n"> <"\tEOF\n"> <"\n"> <"\tgit checkout -b first &&\n"> <"\ttest_tick &&\n"> <"\tgit commit -q -a -m first &&\n"> <"\n"> <"\tgit checkout -b second master &&\n"> <"\tgit show first:a1 |\n"> <"\tsed -e \"s/To die, t/To die! T/\" -e \"s/Some title/Some Title/\" >a1 &&\n"> <"\techo \"* END *\" >>a1 &&\n"> <"\ttest_tick &&\n"> <"\tgit commit -q -a -m second\n"> ) } ) (C {(test_expect_success)} {(SQ <"nothing recorded without rerere">)} { (SQ <"\n"> <"\trm -rf .git/rr-cache &&\n"> <"\tgit config rerere.enabled false &&\n"> <"\ttest_must_fail git merge first &&\n"> <"\t! test -d .git/rr-cache\n"> ) } ) (C {(test_expect_success)} {(SQ <"activate rerere, old style (conflicting merge)">)} { (SQ <"\n"> <"\tgit reset --hard &&\n"> <"\tmkdir .git/rr-cache &&\n"> <"\ttest_might_fail git config --unset rerere.enabled &&\n"> <"\ttest_must_fail git merge first &&\n"> <"\n"> <"\tsha1=$(perl -pe \"s/\t.*//\" .git/MERGE_RR) &&\n"> <"\trr=.git/rr-cache/$sha1 &&\n"> <"\tgrep \"^=======\\$\" $rr/preimage &&\n"> <"\t! test -f $rr/postimage &&\n"> <"\t! test -f $rr/thisimage\n"> ) } ) (C {(test_expect_success)} {(SQ <"rerere.enabled works, too">)} { (SQ <"\n"> <"\trm -rf .git/rr-cache &&\n"> <"\tgit config rerere.enabled true &&\n"> <"\tgit reset --hard &&\n"> <"\ttest_must_fail git merge first &&\n"> <"\n"> <"\tsha1=$(perl -pe \"s/\t.*//\" .git/MERGE_RR) &&\n"> <"\trr=.git/rr-cache/$sha1 &&\n"> <"\tgrep ^=======$ $rr/preimage\n"> ) } ) (C {(test_expect_success)} {(SQ <"set up rr-cache">)} { (SQ <"\n"> <"\trm -rf .git/rr-cache &&\n"> <"\tgit config rerere.enabled true &&\n"> <"\tgit reset --hard &&\n"> <"\ttest_must_fail git merge first &&\n"> <"\tsha1=$(perl -pe \"s/\t.*//\" .git/MERGE_RR) &&\n"> <"\trr=.git/rr-cache/$sha1\n"> ) } ) (C {(test_expect_success)} {(SQ <"rr-cache looks sane">)} { (SQ <"\n"> <"\t# no postimage or thisimage yet\n"> <"\t! test -f $rr/postimage &&\n"> <"\t! test -f $rr/thisimage &&\n"> <"\n"> <"\t# preimage has right number of lines\n"> <"\tcnt=$(sed -ne \"/^<<<<<<</,/^>>>>>>>/p\" $rr/preimage | wc -l) &&\n"> <"\techo $cnt &&\n"> <"\ttest $cnt = 13\n"> ) } ) (C {(test_expect_success)} {(SQ <"rerere diff">)} { (SQ <"\n"> <"\tgit show first:a1 >a1 &&\n"> <"\tcat >expect <<-\\EOF &&\n"> <"\t--- a/a1\n"> <"\t+++ b/a1\n"> <"\t@@ -1,4 +1,4 @@\n"> <"\t-Some Title\n"> <"\t+Some title\n"> <"\t ==========\n"> <"\t Whether "> ) (EscapedLiteralPart token:<Lit_EscapedChar "\\'">) (SQ <"tis nobler in the mind to suffer\n"> <"\t The slings and arrows of outrageous fortune,\n"> <"\t@@ -8,21 +8,11 @@\n"> <"\t The heart-ache and the thousand natural shocks\n"> <"\t That flesh is heir to, "> ) (EscapedLiteralPart token:<Lit_EscapedChar "\\'">) (SQ <"tis a consummation\n"> <"\t Devoutly to be wish">) (EscapedLiteralPart token:<Lit_EscapedChar "\\'">) (SQ <"d.\n"> <"\t-<<<<<<<\n"> <"\t-Some Title\n"> <"\t-==========\n"> <"\t-To die! To sleep;\n"> <"\t-=======\n"> <"\t Some title\n"> <"\t ==========\n"> <"\t To die, to sleep;\n"> <"\t->>>>>>>\n"> <"\t To sleep: perchance to dream: ay, there"> ) (EscapedLiteralPart token:<Lit_EscapedChar "\\'">) (SQ <"s the rub;\n"> <"\t For in that sleep of death what dreams may come\n"> <"\t When we have shuffled off this mortal coil,\n"> <"\t Must give us pause: there"> ) (EscapedLiteralPart token:<Lit_EscapedChar "\\'">) (SQ <"s the respect\n"> <"\t That makes calamity of so long life;\n"> <"\t-<<<<<<<\n"> <"\t-=======\n"> <"\t-* END *\n"> <"\t->>>>>>>\n"> <"\tEOF\n"> <"\tgit rerere diff >out &&\n"> <"\ttest_cmp expect out\n"> ) } ) (C {(test_expect_success)} {(SQ <"rerere status">)} { (SQ <"\n"> <"\techo a1 >expect &&\n"> <"\tgit rerere status >out &&\n"> <"\ttest_cmp expect out\n"> ) } ) (C {(test_expect_success)} {(SQ <"first postimage wins">)} { (SQ <"\n"> <"\tgit show first:a1 | sed \"s/To die: t/To die! T/\" >expect &&\n"> <"\n"> <"\tgit commit -q -a -m \"prefer first over second\" &&\n"> <"\ttest -f $rr/postimage &&\n"> <"\n"> <"\toldmtimepost=$(test-chmtime -v -60 $rr/postimage | cut -f 1) &&\n"> <"\n"> <"\tgit checkout -b third master &&\n"> <"\tgit show second^:a1 | sed \"s/To die: t/To die! T/\" >a1 &&\n"> <"\tgit commit -q -a -m third &&\n"> <"\n"> <"\ttest_must_fail git merge first &&\n"> <"\t# rerere kicked in\n"> <"\t! grep \"^=======\\$\" a1 &&\n"> <"\ttest_cmp expect a1\n"> ) } ) (C {(test_expect_success)} {(SQ <"rerere updates postimage timestamp">)} { (SQ <"\n"> <"\tnewmtimepost=$(test-chmtime -v +0 $rr/postimage | cut -f 1) &&\n"> <"\ttest $oldmtimepost -lt $newmtimepost\n"> ) } ) (C {(test_expect_success)} {(SQ <"rerere clear">)} { (SQ <"\n"> <"\tmv $rr/postimage .git/post-saved &&\n"> <"\techo \"$sha1\ta1\" | perl -pe \"y/\\012/\\000/\" >.git/MERGE_RR &&\n"> <"\tgit rerere clear &&\n"> <"\t! test -d $rr\n"> ) } ) (C {(test_expect_success)} {(SQ <"leftover directory">)} { (SQ <"\n"> <"\tgit reset --hard &&\n"> <"\tmkdir -p $rr &&\n"> <"\ttest_must_fail git merge first &&\n"> <"\ttest -f $rr/preimage\n"> ) } ) (C {(test_expect_success)} {(SQ <"missing preimage">)} { (SQ <"\n"> <"\tgit reset --hard &&\n"> <"\tmkdir -p $rr &&\n"> <"\tcp .git/post-saved $rr/postimage &&\n"> <"\ttest_must_fail git merge first &&\n"> <"\ttest -f $rr/preimage\n"> ) } ) (C {(test_expect_success)} {(SQ <"set up for garbage collection tests">)} { (SQ <"\n"> <"\tmkdir -p $rr &&\n"> <"\techo Hello >$rr/preimage &&\n"> <"\techo World >$rr/postimage &&\n"> <"\n"> <"\tsha2=4000000000000000000000000000000000000000 &&\n"> <"\trr2=.git/rr-cache/$sha2 &&\n"> <"\tmkdir $rr2 &&\n"> <"\techo Hello >$rr2/preimage &&\n"> <"\n"> <"\talmost_15_days_ago=$((60-15*86400)) &&\n"> <"\tjust_over_15_days_ago=$((-1-15*86400)) &&\n"> <"\talmost_60_days_ago=$((60-60*86400)) &&\n"> <"\tjust_over_60_days_ago=$((-1-60*86400)) &&\n"> <"\n"> <"\ttest-chmtime =$just_over_60_days_ago $rr/preimage &&\n"> <"\ttest-chmtime =$almost_60_days_ago $rr/postimage &&\n"> <"\ttest-chmtime =$almost_15_days_ago $rr2/preimage\n"> ) } ) (C {(test_expect_success)} {(SQ <"gc preserves young or recently used records">)} { (SQ <"\n"> <"\tgit rerere gc &&\n"> <"\ttest -f $rr/preimage &&\n"> <"\ttest -f $rr2/preimage\n"> ) } ) (C {(test_expect_success)} {(SQ <"old records rest in peace">)} { (SQ <"\n"> <"\ttest-chmtime =$just_over_60_days_ago $rr/postimage &&\n"> <"\ttest-chmtime =$just_over_15_days_ago $rr2/preimage &&\n"> <"\tgit rerere gc &&\n"> <"\t! test -f $rr/preimage &&\n"> <"\t! test -f $rr2/preimage\n"> ) } ) (C {(test_expect_success)} {(SQ <"setup: file2 added differently in two branches">)} { (SQ <"\n"> <"\tgit reset --hard &&\n"> <"\n"> <"\tgit checkout -b fourth &&\n"> <"\techo Hallo >file2 &&\n"> <"\tgit add file2 &&\n"> <"\ttest_tick &&\n"> <"\tgit commit -m version1 &&\n"> <"\n"> <"\tgit checkout third &&\n"> <"\techo Bello >file2 &&\n"> <"\tgit add file2 &&\n"> <"\ttest_tick &&\n"> <"\tgit commit -m version2 &&\n"> <"\n"> <"\ttest_must_fail git merge fourth &&\n"> <"\techo Cello >file2 &&\n"> <"\tgit add file2 &&\n"> <"\tgit commit -m resolution\n"> ) } ) (C {(test_expect_success)} {(SQ <"resolution was recorded properly">)} { (SQ <"\n"> <"\techo Cello >expected &&\n"> <"\n"> <"\tgit reset --hard HEAD~2 &&\n"> <"\tgit checkout -b fifth &&\n"> <"\n"> <"\techo Hallo >file3 &&\n"> <"\tgit add file3 &&\n"> <"\ttest_tick &&\n"> <"\tgit commit -m version1 &&\n"> <"\n"> <"\tgit checkout third &&\n"> <"\techo Bello >file3 &&\n"> <"\tgit add file3 &&\n"> <"\ttest_tick &&\n"> <"\tgit commit -m version2 &&\n"> <"\tgit tag version2 &&\n"> <"\n"> <"\ttest_must_fail git merge fifth &&\n"> <"\ttest_cmp expected file3 &&\n"> <"\ttest_must_fail git update-index --refresh\n"> ) } ) (C {(test_expect_success)} {(SQ <rerere.autoupdate>)} { (SQ <"\n"> <"\tgit config rerere.autoupdate true &&\n"> <"\tgit reset --hard &&\n"> <"\tgit checkout version2 &&\n"> <"\ttest_must_fail git merge fifth &&\n"> <"\tgit update-index --refresh\n"> ) } ) (C {(test_expect_success)} {(SQ <"merge --rerere-autoupdate">)} { (SQ <"\n"> <"\ttest_might_fail git config --unset rerere.autoupdate &&\n"> <"\tgit reset --hard &&\n"> <"\tgit checkout version2 &&\n"> <"\ttest_must_fail git merge --rerere-autoupdate fifth &&\n"> <"\tgit update-index --refresh\n"> ) } ) (C {(test_expect_success)} {(SQ <"merge --no-rerere-autoupdate">)} { (SQ <"\n"> <"\theadblob=$(git rev-parse version2:file3) &&\n"> <"\tmergeblob=$(git rev-parse fifth:file3) &&\n"> <"\tcat >expected <<-EOF &&\n"> <"\t100644 $headblob 2\tfile3\n"> <"\t100644 $mergeblob 3\tfile3\n"> <"\tEOF\n"> <"\n"> <"\tgit config rerere.autoupdate true &&\n"> <"\tgit reset --hard &&\n"> <"\tgit checkout version2 &&\n"> <"\ttest_must_fail git merge --no-rerere-autoupdate fifth &&\n"> <"\tgit ls-files -u >actual &&\n"> <"\ttest_cmp expected actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"set up an unresolved merge">)} { (SQ <"\n"> <"\theadblob=$(git rev-parse version2:file3) &&\n"> <"\tmergeblob=$(git rev-parse fifth:file3) &&\n"> <"\tcat >expected.unresolved <<-EOF &&\n"> <"\t100644 $headblob 2\tfile3\n"> <"\t100644 $mergeblob 3\tfile3\n"> <"\tEOF\n"> <"\n"> <"\ttest_might_fail git config --unset rerere.autoupdate &&\n"> <"\tgit reset --hard &&\n"> <"\tgit checkout version2 &&\n"> <"\tfifth=$(git rev-parse fifth) &&\n"> <"\techo \"$fifth\t\tbranch "> ) (fifth) (SQ <" of .\" |\n"> <"\tgit fmt-merge-msg >msg &&\n"> <"\tancestor=$(git merge-base version2 fifth) &&\n"> <"\ttest_must_fail git merge-recursive \"$ancestor\" -- HEAD fifth &&\n"> <"\n"> <"\tgit ls-files --stage >failedmerge &&\n"> <"\tcp file3 file3.conflict &&\n"> <"\n"> <"\tgit ls-files -u >actual &&\n"> <"\ttest_cmp expected.unresolved actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"explicit rerere">)} { (SQ <"\n"> <"\ttest_might_fail git config --unset rerere.autoupdate &&\n"> <"\tgit rm -fr --cached . &&\n"> <"\tgit update-index --index-info <failedmerge &&\n"> <"\tcp file3.conflict file3 &&\n"> <"\ttest_must_fail git update-index --refresh -q &&\n"> <"\n"> <"\tgit rerere &&\n"> <"\tgit ls-files -u >actual &&\n"> <"\ttest_cmp expected.unresolved actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"explicit rerere with autoupdate">)} { (SQ <"\n"> <"\tgit config rerere.autoupdate true &&\n"> <"\tgit rm -fr --cached . &&\n"> <"\tgit update-index --index-info <failedmerge &&\n"> <"\tcp file3.conflict file3 &&\n"> <"\ttest_must_fail git update-index --refresh -q &&\n"> <"\n"> <"\tgit rerere &&\n"> <"\tgit update-index --refresh\n"> ) } ) (C {(test_expect_success)} {(SQ <"explicit rerere --rerere-autoupdate overrides">)} { (SQ <"\n"> <"\tgit config rerere.autoupdate false &&\n"> <"\tgit rm -fr --cached . &&\n"> <"\tgit update-index --index-info <failedmerge &&\n"> <"\tcp file3.conflict file3 &&\n"> <"\tgit rerere &&\n"> <"\tgit ls-files -u >actual1 &&\n"> <"\n"> <"\tgit rm -fr --cached . &&\n"> <"\tgit update-index --index-info <failedmerge &&\n"> <"\tcp file3.conflict file3 &&\n"> <"\tgit rerere --rerere-autoupdate &&\n"> <"\tgit update-index --refresh &&\n"> <"\n"> <"\tgit rm -fr --cached . &&\n"> <"\tgit update-index --index-info <failedmerge &&\n"> <"\tcp file3.conflict file3 &&\n"> <"\tgit rerere --rerere-autoupdate --no-rerere-autoupdate &&\n"> <"\tgit ls-files -u >actual2 &&\n"> <"\n"> <"\tgit rm -fr --cached . &&\n"> <"\tgit update-index --index-info <failedmerge &&\n"> <"\tcp file3.conflict file3 &&\n"> <"\tgit rerere --rerere-autoupdate --no-rerere-autoupdate --rerere-autoupdate &&\n"> <"\tgit update-index --refresh &&\n"> <"\n"> <"\ttest_cmp expected.unresolved actual1 &&\n"> <"\ttest_cmp expected.unresolved actual2\n"> ) } ) (C {(test_expect_success)} {(SQ <"rerere --no-no-rerere-autoupdate">)} { (SQ <"\n"> <"\tgit rm -fr --cached . &&\n"> <"\tgit update-index --index-info <failedmerge &&\n"> <"\tcp file3.conflict file3 &&\n"> <"\ttest_must_fail git rerere --no-no-rerere-autoupdate 2>err &&\n"> <"\ttest_i18ngrep [Uu]sage err &&\n"> <"\ttest_must_fail git update-index --refresh\n"> ) } ) (C {(test_expect_success)} {(SQ <"rerere -h">)} {(SQ <"\n"> <"\ttest_must_fail git rerere -h >help &&\n"> <"\ttest_i18ngrep [Uu]sage help\n">)} ) (FuncDef name: concat_insert body: (BraceGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:last) op: Equal rhs: {($ VSub_Number "$1")} spids: [690] ) ] spids: [690] ) (C {(shift)}) (AndOr children: [ (C {(cat)} {(early)}) (AndOr children: [ (C {(printf)} {(DQ ("%s") (EscapedLiteralPart token:<Lit_EscapedChar "\\n">))} {(DQ ($ VSub_At "$@"))} ) (C {(cat)} {(late)} {(DQ ($ VSub_Name "$last"))}) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] spids: [687] ) spids: [682 686] ) (FuncDef name: count_pre_post body: (BraceGroup children: [ (AndOr children: [ (SimpleCommand words: [{(find)} {(.git/rr-cache/)} {(-type)} {(f)} {(-name)} {(DQ ("preimage*"))}] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(actual)} spids:[749])] ) (AndOr children: [ (C {(test_line_count)} {(Lit_Other "=")} {(DQ ($ VSub_Number "$1"))} {(actual)}) (AndOr children: [ (SimpleCommand words: [ {(find)} {(.git/rr-cache/)} {(-type)} {(f)} {(-name)} {(DQ ("postimage*"))} ] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(actual)} spids:[782])] ) (C {(test_line_count)} {(Lit_Other "=")} {(DQ ($ VSub_Number "$2"))} {(actual)}) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] spids: [732] ) spids: [727 731] ) (C {(test_expect_success)} {(SQ <"rerere gc">)} { (SQ <"\n"> <"\tfind .git/rr-cache -type f >original &&\n"> <"\txargs test-chmtime -172800 <original &&\n"> <"\n"> <"\tgit -c gc.rerereresolved=5 -c gc.rerereunresolved=5 rerere gc &&\n"> <"\tfind .git/rr-cache -type f >actual &&\n"> <"\ttest_cmp original actual &&\n"> <"\n"> <"\tgit -c gc.rerereresolved=5 -c gc.rerereunresolved=0 rerere gc &&\n"> <"\tfind .git/rr-cache -type f >actual &&\n"> <"\ttest_cmp original actual &&\n"> <"\n"> <"\tgit -c gc.rerereresolved=0 -c gc.rerereunresolved=0 rerere gc &&\n"> <"\tfind .git/rr-cache -type f >actual &&\n"> <"\t>expect &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (FuncDef name: merge_conflict_resolve body: (BraceGroup children: [ (AndOr children: [ (C {(git)} {(reset)} {(--hard)}) (AndOr children: [ (C {(test_must_fail)} {(git)} {(merge)} {(six.1)}) (AndOr children: [ (SimpleCommand words: [{(concat_insert)} {(short)} {(6.1)} {(6.2)}] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(file1)} spids:[867])] ) (SimpleCommand words: [{(concat_insert)} {(long)} {(6.1)} {(6.2)}] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(file2)} spids:[881])] ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] spids: [832] ) spids: [827 831] ) (C {(test_expect_success)} {(SQ <"multiple identical conflicts">)} { (SQ <"\n"> <"\tgit reset --hard &&\n"> <"\n"> <"\ttest_seq 1 6 >early &&\n"> <"\t>late &&\n"> <"\ttest_seq 11 15 >short &&\n"> <"\ttest_seq 111 120 >long &&\n"> <"\tconcat_insert short >file1 &&\n"> <"\tconcat_insert long >file2 &&\n"> <"\tgit add file1 file2 &&\n"> <"\tgit commit -m base &&\n"> <"\tgit tag base &&\n"> <"\tgit checkout -b six.1 &&\n"> <"\tconcat_insert short 6.1 >file1 &&\n"> <"\tconcat_insert long 6.1 >file2 &&\n"> <"\tgit add file1 file2 &&\n"> <"\tgit commit -m 6.1 &&\n"> <"\tgit checkout -b six.2 HEAD^ &&\n"> <"\tconcat_insert short 6.2 >file1 &&\n"> <"\tconcat_insert long 6.2 >file2 &&\n"> <"\tgit add file1 file2 &&\n"> <"\tgit commit -m 6.2 &&\n"> <"\n"> <"\t# At this point, six.1 and six.2\n"> <"\t# - derive from common ancestor that has two files\n"> <"\t# 1...6 7 11..15 (file1) and 1...6 7 111..120 (file2)\n"> <"\t# - six.1 replaces these 7s with 6.1\n"> <"\t# - six.2 replaces these 7s with 6.2\n"> <"\n"> <"\tmerge_conflict_resolve &&\n"> <"\n"> <"\t# Check that rerere knows that file1 and file2 have conflicts\n"> <"\n"> <"\tprintf \"%s\\n\" file1 file2 >expect &&\n"> <"\tgit ls-files -u | sed -e \"s/^.*\t//\" | sort -u >actual &&\n"> <"\ttest_cmp expect actual &&\n"> <"\n"> <"\tgit rerere status | sort >actual &&\n"> <"\ttest_cmp expect actual &&\n"> <"\n"> <"\tgit rerere remaining >actual &&\n"> <"\ttest_cmp expect actual &&\n"> <"\n"> <"\tcount_pre_post 2 0 &&\n"> <"\n"> <"\t# Pretend that the conflicts were made quite some time ago\n"> <"\tfind .git/rr-cache/ -type f | xargs test-chmtime -172800 &&\n"> <"\n"> <"\t# Unresolved entries have not expired yet\n"> <"\tgit -c gc.rerereresolved=5 -c gc.rerereunresolved=5 rerere gc &&\n"> <"\tcount_pre_post 2 0 &&\n"> <"\n"> <"\t# Unresolved entries have expired\n"> <"\tgit -c gc.rerereresolved=5 -c gc.rerereunresolved=1 rerere gc &&\n"> <"\tcount_pre_post 0 0 &&\n"> <"\n"> <"\t# Recreate the conflicted state\n"> <"\tmerge_conflict_resolve &&\n"> <"\tcount_pre_post 2 0 &&\n"> <"\n"> <"\t# Clear it\n"> <"\tgit rerere clear &&\n"> <"\tcount_pre_post 0 0 &&\n"> <"\n"> <"\t# Recreate the conflicted state\n"> <"\tmerge_conflict_resolve &&\n"> <"\tcount_pre_post 2 0 &&\n"> <"\n"> <"\t# We resolved file1 and file2\n"> <"\tgit rerere &&\n"> <"\t>expect &&\n"> <"\tgit rerere remaining >actual &&\n"> <"\ttest_cmp expect actual &&\n"> <"\n"> <"\t# We must have recorded both of them\n"> <"\tcount_pre_post 2 2 &&\n"> <"\n"> <"\t# Now we should be able to resolve them both\n"> <"\tgit reset --hard &&\n"> <"\ttest_must_fail git merge six.1 &&\n"> <"\tgit rerere &&\n"> <"\n"> <"\t>expect &&\n"> <"\tgit rerere remaining >actual &&\n"> <"\ttest_cmp expect actual &&\n"> <"\n"> <"\tconcat_insert short 6.1 6.2 >file1.expect &&\n"> <"\tconcat_insert long 6.1 6.2 >file2.expect &&\n"> <"\ttest_cmp file1.expect file1 &&\n"> <"\ttest_cmp file2.expect file2 &&\n"> <"\n"> <"\t# Forget resolution for file2\n"> <"\tgit rerere forget file2 &&\n"> <"\techo file2 >expect &&\n"> <"\tgit rerere status >actual &&\n"> <"\ttest_cmp expect actual &&\n"> <"\tcount_pre_post 2 1 &&\n"> <"\n"> <"\t# file2 already has correct resolution, so record it again\n"> <"\tgit rerere &&\n"> <"\n"> <"\t# Pretend that the resolutions are old again\n"> <"\tfind .git/rr-cache/ -type f | xargs test-chmtime -172800 &&\n"> <"\n"> <"\t# Resolved entries have not expired yet\n"> <"\tgit -c gc.rerereresolved=5 -c gc.rerereunresolved=5 rerere gc &&\n"> <"\n"> <"\tcount_pre_post 2 2 &&\n"> <"\n"> <"\t# Resolved entries have expired\n"> <"\tgit -c gc.rerereresolved=1 -c gc.rerereunresolved=5 rerere gc &&\n"> <"\tcount_pre_post 0 0\n"> ) } ) (C {(test_done)}) ] )