(CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_description) op: Equal rhs: { (SQ <"git checkout tests.\n"> <"\n"> <"Creates master, forks renamer and side branches from it.\n"> <"Test switching across them.\n"> <"\n"> <" ! [master] Initial A one, A two\n"> <" * [renamer] Renamer R one->uno, M two\n"> <" ! [side] Side M one, D two, A three\n"> <" ! [simple] Simple D one, M two\n"> <" ----\n"> <" + [simple] Simple D one, M two\n"> <" + [side] Side M one, D two, A three\n"> <" * [renamer] Renamer R one->uno, M two\n"> <" +*++ [master] Initial A one, A two\n"> <"\n"> ) } spids: [13] ) ] spids: [13] ) (C {(.)} {(./test-lib.sh)}) (C {(test_tick)}) (FuncDef name: fill body: (BraceGroup children: [ (ForEach iter_name: i do_arg_iter: True body: (DoGroup children:[(C {(echo)} {(DQ ($ VSub_Name "$i"))})] spids:[5464]) spids: [-1 -1] ) ] spids: [46] ) spids: [41 45] ) (C {(test_expect_success)} {(setup)} { (SQ <"\n"> <"\n"> <"\tfill x y z > same &&\n"> <"\tfill 1 2 3 4 5 6 7 8 >one &&\n"> <"\tfill a b c d e >two &&\n"> <"\tgit add same one two &&\n"> <"\tgit commit -m \"Initial A one, A two\" &&\n"> <"\n"> <"\tgit checkout -b renamer &&\n"> <"\trm -f one &&\n"> <"\tfill 1 3 4 5 6 7 8 >uno &&\n"> <"\tgit add uno &&\n"> <"\tfill a b c d e f >two &&\n"> <"\tgit commit -a -m \"Renamer R one->uno, M two\" &&\n"> <"\n"> <"\tgit checkout -b side master &&\n"> <"\tfill 1 2 3 4 5 6 7 >one &&\n"> <"\tfill A B C D E >three &&\n"> <"\trm -f two &&\n"> <"\tgit update-index --add --remove one two three &&\n"> <"\tgit commit -m \"Side M one, D two, A three\" &&\n"> <"\n"> <"\tgit checkout -b simple master &&\n"> <"\trm -f one &&\n"> <"\tfill a c e > two &&\n"> <"\tgit commit -a -m \"Simple D one, M two\" &&\n"> <"\n"> <"\tgit checkout master\n"> ) } ) (C {(test_expect_success)} {(DQ ("checkout from non-existing branch"))} { (SQ <"\n"> <"\n"> <"\tgit checkout -b delete-me master &&\n"> <"\trm .git/refs/heads/delete-me &&\n"> <"\ttest refs/heads/delete-me = \"$(git symbolic-ref HEAD)\" &&\n"> <"\tgit checkout master &&\n"> <"\ttest refs/heads/master = \"$(git symbolic-ref HEAD)\"\n"> ) } ) (C {(test_expect_success)} {(DQ ("checkout with dirty tree without -m"))} { (SQ <"\n"> <"\n"> <"\tfill 0 1 2 3 4 5 6 7 8 >one &&\n"> <"\tif git checkout side\n"> <"\tthen\n"> <"\t\techo Not happy\n"> <"\t\tfalse\n"> <"\telse\n"> <"\t\techo \"happy - failed correctly\"\n"> <"\tfi\n"> <"\n"> ) } ) (C {(test_expect_success)} {(DQ ("checkout with unrelated dirty tree without -m"))} { (SQ <"\n"> <"\n"> <"\tgit checkout -f master &&\n"> <"\tfill 0 1 2 3 4 5 6 7 8 >same &&\n"> <"\tcp same kept &&\n"> <"\tgit checkout side >messages &&\n"> <"\ttest_cmp same kept &&\n"> <"\tprintf \"M\\t%s\\n\" same >messages.expect &&\n"> <"\ttest_cmp messages.expect messages\n"> ) } ) (C {(test_expect_success)} {(DQ ("checkout -m with dirty tree"))} { (SQ <"\n"> <"\n"> <"\tgit checkout -f master &&\n"> <"\tgit clean -f &&\n"> <"\n"> <"\tfill 0 1 2 3 4 5 6 7 8 >one &&\n"> <"\tgit checkout -m side > messages &&\n"> <"\n"> <"\ttest \"$(git symbolic-ref HEAD)\" = \"refs/heads/side\" &&\n"> <"\n"> <"\tprintf \"M\\t%s\\n\" one >expect.messages &&\n"> <"\ttest_cmp expect.messages messages &&\n"> <"\n"> <"\tfill \"M\tone\" \"A\tthree\" \"D\ttwo\" >expect.master &&\n"> <"\tgit diff --name-status master >current.master &&\n"> <"\ttest_cmp expect.master current.master &&\n"> <"\n"> <"\tfill \"M\tone\" >expect.side &&\n"> <"\tgit diff --name-status side >current.side &&\n"> <"\ttest_cmp expect.side current.side &&\n"> <"\n"> <"\t: >expect.index &&\n"> <"\tgit diff --cached >current.index &&\n"> <"\ttest_cmp expect.index current.index\n"> ) } ) (C {(test_expect_success)} {(DQ ("checkout -m with dirty tree, renamed"))} { (SQ <"\n"> <"\n"> <"\tgit checkout -f master && git clean -f &&\n"> <"\n"> <"\tfill 1 2 3 4 5 7 8 >one &&\n"> <"\tif git checkout renamer\n"> <"\tthen\n"> <"\t\techo Not happy\n"> <"\t\tfalse\n"> <"\telse\n"> <"\t\techo \"happy - failed correctly\"\n"> <"\tfi &&\n"> <"\n"> <"\tgit checkout -m renamer &&\n"> <"\tfill 1 3 4 5 7 8 >expect &&\n"> <"\ttest_cmp expect uno &&\n"> <"\t! test -f one &&\n"> <"\tgit diff --cached >current &&\n"> <"\t! test -s current\n"> <"\n"> ) } ) (C {(test_expect_success)} {(SQ <"checkout -m with merge conflict">)} { (SQ <"\n"> <"\n"> <"\tgit checkout -f master && git clean -f &&\n"> <"\n"> <"\tfill 1 T 3 4 5 6 S 8 >one &&\n"> <"\tif git checkout renamer\n"> <"\tthen\n"> <"\t\techo Not happy\n"> <"\t\tfalse\n"> <"\telse\n"> <"\t\techo \"happy - failed correctly\"\n"> <"\tfi &&\n"> <"\n"> <"\tgit checkout -m renamer &&\n"> <"\n"> <"\tgit diff master:one :3:uno |\n"> <"\tsed -e \"1,/^@@/d\" -e \"/^ /d\" -e \"s/^-/d/\" -e \"s/^+/a/\" >current &&\n"> <"\tfill d2 aT d7 aS >expect &&\n"> <"\ttest_cmp current expect &&\n"> <"\tgit diff --cached two >current &&\n"> <"\t! test -s current\n"> ) } ) (C {(test_expect_success)} {(SQ <"format of merge conflict from checkout -m">)} { (SQ <"\n"> <"\n"> <"\tgit checkout -f master && git clean -f &&\n"> <"\n"> <"\tfill b d > two &&\n"> <"\tgit checkout -m simple &&\n"> <"\n"> <"\tgit ls-files >current &&\n"> <"\tfill same two two two >expect &&\n"> <"\ttest_cmp current expect &&\n"> <"\n"> <"\tcat <<-EOF >expect &&\n"> <"\t<<<<<<< simple\n"> <"\ta\n"> <"\tc\n"> <"\te\n"> <"\t=======\n"> <"\tb\n"> <"\td\n"> <"\t>>>>>>> local\n"> <"\tEOF\n"> <"\ttest_cmp two expect\n"> ) } ) (C {(test_expect_success)} {(SQ <"checkout --merge --conflict=diff3 <branch>">)} { (SQ <"\n"> <"\n"> <"\tgit checkout -f master && git reset --hard && git clean -f &&\n"> <"\n"> <"\tfill b d > two &&\n"> <"\tgit checkout --merge --conflict=diff3 simple &&\n"> <"\n"> <"\tcat <<-EOF >expect &&\n"> <"\t<<<<<<< simple\n"> <"\ta\n"> <"\tc\n"> <"\te\n"> <"\t||||||| master\n"> <"\ta\n"> <"\tb\n"> <"\tc\n"> <"\td\n"> <"\te\n"> <"\t=======\n"> <"\tb\n"> <"\td\n"> <"\t>>>>>>> local\n"> <"\tEOF\n"> <"\ttest_cmp two expect\n"> ) } ) (C {(test_expect_success)} {(SQ <"switch to another branch while carrying a deletion">)} { (SQ <"\n"> <"\n"> <"\tgit checkout -f master && git reset --hard && git clean -f &&\n"> <"\tgit rm two &&\n"> <"\n"> <"\ttest_must_fail git checkout simple 2>errs &&\n"> <"\ttest_i18ngrep overwritten errs &&\n"> <"\n"> <"\tgit checkout --merge simple 2>errs &&\n"> <"\ttest_i18ngrep ! overwritten errs &&\n"> <"\tgit ls-files -u &&\n"> <"\ttest_must_fail git cat-file -t :0:two &&\n"> <"\ttest \"$(git cat-file -t :1:two)\" = blob &&\n"> <"\ttest \"$(git cat-file -t :2:two)\" = blob &&\n"> <"\ttest_must_fail git cat-file -t :3:two\n"> ) } ) (C {(test_expect_success)} {(SQ <"checkout to detach HEAD (with advice declined)">)} { (SQ <"\n"> <"\n"> <"\tgit config advice.detachedHead false &&\n"> <"\tgit checkout -f renamer && git clean -f &&\n"> <"\tgit checkout renamer^ 2>messages &&\n"> <"\ttest_i18ngrep \"HEAD is now at 7329388\" messages &&\n"> <"\ttest_line_count = 1 messages &&\n"> <"\tH=$(git rev-parse --verify HEAD) &&\n"> <"\tM=$(git show-ref -s --verify refs/heads/master) &&\n"> <"\ttest \"z$H\" = \"z$M\" &&\n"> <"\tif git symbolic-ref HEAD >/dev/null 2>&1\n"> <"\tthen\n"> <"\t\techo \"OOPS, HEAD is still symbolic???\"\n"> <"\t\tfalse\n"> <"\telse\n"> <"\t\t: happy\n"> <"\tfi\n"> ) } ) (C {(test_expect_success)} {(SQ <"checkout to detach HEAD">)} { (SQ <"\n"> <"\tgit config advice.detachedHead true &&\n"> <"\tgit checkout -f renamer && git clean -f &&\n"> <"\tgit checkout renamer^ 2>messages &&\n"> <"\ttest_i18ngrep \"HEAD is now at 7329388\" messages &&\n"> <"\t(test_line_count -gt 1 messages || test -n \"$GETTEXT_POISON\") &&\n"> <"\tH=$(git rev-parse --verify HEAD) &&\n"> <"\tM=$(git show-ref -s --verify refs/heads/master) &&\n"> <"\ttest \"z$H\" = \"z$M\" &&\n"> <"\tif git symbolic-ref HEAD >/dev/null 2>&1\n"> <"\tthen\n"> <"\t\techo \"OOPS, HEAD is still symbolic???\"\n"> <"\t\tfalse\n"> <"\telse\n"> <"\t\t: happy\n"> <"\tfi\n"> ) } ) (C {(test_expect_success)} {(SQ <"checkout to detach HEAD with branchname^">)} { (SQ <"\n"> <"\n"> <"\tgit checkout -f master && git clean -f &&\n"> <"\tgit checkout renamer^ &&\n"> <"\tH=$(git rev-parse --verify HEAD) &&\n"> <"\tM=$(git show-ref -s --verify refs/heads/master) &&\n"> <"\ttest \"z$H\" = \"z$M\" &&\n"> <"\tif git symbolic-ref HEAD >/dev/null 2>&1\n"> <"\tthen\n"> <"\t\techo \"OOPS, HEAD is still symbolic???\"\n"> <"\t\tfalse\n"> <"\telse\n"> <"\t\t: happy\n"> <"\tfi\n"> ) } ) (C {(test_expect_success)} {(SQ <"checkout to detach HEAD with :/message">)} { (SQ <"\n"> <"\n"> <"\tgit checkout -f master && git clean -f &&\n"> <"\tgit checkout \":/Initial\" &&\n"> <"\tH=$(git rev-parse --verify HEAD) &&\n"> <"\tM=$(git show-ref -s --verify refs/heads/master) &&\n"> <"\ttest \"z$H\" = \"z$M\" &&\n"> <"\tif git symbolic-ref HEAD >/dev/null 2>&1\n"> <"\tthen\n"> <"\t\techo \"OOPS, HEAD is still symbolic???\"\n"> <"\t\tfalse\n"> <"\telse\n"> <"\t\t: happy\n"> <"\tfi\n"> ) } ) (C {(test_expect_success)} {(SQ <"checkout to detach HEAD with HEAD^0">)} { (SQ <"\n"> <"\n"> <"\tgit checkout -f master && git clean -f &&\n"> <"\tgit checkout HEAD^0 &&\n"> <"\tH=$(git rev-parse --verify HEAD) &&\n"> <"\tM=$(git show-ref -s --verify refs/heads/master) &&\n"> <"\ttest \"z$H\" = \"z$M\" &&\n"> <"\tif git symbolic-ref HEAD >/dev/null 2>&1\n"> <"\tthen\n"> <"\t\techo \"OOPS, HEAD is still symbolic???\"\n"> <"\t\tfalse\n"> <"\telse\n"> <"\t\t: happy\n"> <"\tfi\n"> ) } ) (C {(test_expect_success)} {(SQ <"checkout with ambiguous tag/branch names">)} { (SQ <"\n"> <"\n"> <"\tgit tag both side &&\n"> <"\tgit branch both master &&\n"> <"\tgit reset --hard &&\n"> <"\tgit checkout master &&\n"> <"\n"> <"\tgit checkout both &&\n"> <"\tH=$(git rev-parse --verify HEAD) &&\n"> <"\tM=$(git show-ref -s --verify refs/heads/master) &&\n"> <"\ttest \"z$H\" = \"z$M\" &&\n"> <"\tname=$(git symbolic-ref HEAD 2>/dev/null) &&\n"> <"\ttest \"z$name\" = zrefs/heads/both\n"> <"\n"> ) } ) (C {(test_expect_success)} {(SQ <"checkout with ambiguous tag/branch names">)} { (SQ <"\n"> <"\n"> <"\tgit reset --hard &&\n"> <"\tgit checkout master &&\n"> <"\n"> <"\tgit tag frotz side &&\n"> <"\tgit branch frotz master &&\n"> <"\tgit reset --hard &&\n"> <"\tgit checkout master &&\n"> <"\n"> <"\tgit checkout tags/frotz &&\n"> <"\tH=$(git rev-parse --verify HEAD) &&\n"> <"\tS=$(git show-ref -s --verify refs/heads/side) &&\n"> <"\ttest \"z$H\" = \"z$S\" &&\n"> <"\tif name=$(git symbolic-ref HEAD 2>/dev/null)\n"> <"\tthen\n"> <"\t\techo \"Bad -- should have detached\"\n"> <"\t\tfalse\n"> <"\telse\n"> <"\t\t: happy\n"> <"\tfi\n"> <"\n"> ) } ) (C {(test_expect_success)} {(SQ <"switch branches while in subdirectory">)} { (SQ <"\n"> <"\n"> <"\tgit reset --hard &&\n"> <"\tgit checkout master &&\n"> <"\n"> <"\tmkdir subs &&\n"> <"\t(\n"> <"\t\tcd subs &&\n"> <"\t\tgit checkout side\n"> <"\t) &&\n"> <"\t! test -f subs/one &&\n"> <"\trm -fr subs\n"> <"\n"> ) } ) (C {(test_expect_success)} {(SQ <"checkout specific path while in subdirectory">)} { (SQ <"\n"> <"\n"> <"\tgit reset --hard &&\n"> <"\tgit checkout side &&\n"> <"\tmkdir subs &&\n"> <"\t>subs/bero &&\n"> <"\tgit add subs/bero &&\n"> <"\tgit commit -m \"add subs/bero\" &&\n"> <"\n"> <"\tgit checkout master &&\n"> <"\tmkdir -p subs &&\n"> <"\t(\n"> <"\t\tcd subs &&\n"> <"\t\tgit checkout side -- bero\n"> <"\t) &&\n"> <"\ttest -f subs/bero\n"> <"\n"> ) } ) (C {(test_expect_success)} {(SQ <"checkout w/--track sets up tracking">)} { (SQ <"\n"> <" git config branch.autosetupmerge false &&\n"> <" git checkout master &&\n"> <" git checkout --track -b track1 &&\n"> <" test \"$(git config branch.track1.remote)\" &&\n"> <" test \"$(git config branch.track1.merge)\""> ) } ) (C {(test_expect_success)} {(SQ <"checkout w/autosetupmerge=always sets up tracking">)} { (SQ <"\n"> <" test_when_finished git config branch.autosetupmerge false &&\n"> <" git config branch.autosetupmerge always &&\n"> <" git checkout master &&\n"> <" git checkout -b track2 &&\n"> <" test \"$(git config branch.track2.remote)\" &&\n"> <" test \"$(git config branch.track2.merge)\""> ) } ) (C {(test_expect_success)} {(SQ <"checkout w/--track from non-branch HEAD fails">)} { (SQ <"\n"> <" git checkout master^0 &&\n"> <" test_must_fail git symbolic-ref HEAD &&\n"> <" test_must_fail git checkout --track -b track &&\n"> <" test_must_fail git rev-parse --verify track &&\n"> <" test_must_fail git symbolic-ref HEAD &&\n"> <" test \"z$(git rev-parse master^0)\" = \"z$(git rev-parse HEAD)\"\n"> ) } ) (C {(test_expect_success)} {(SQ <"checkout w/--track from tag fails">)} { (SQ <"\n"> <" git checkout master^0 &&\n"> <" test_must_fail git symbolic-ref HEAD &&\n"> <" test_must_fail git checkout --track -b track frotz &&\n"> <" test_must_fail git rev-parse --verify track &&\n"> <" test_must_fail git symbolic-ref HEAD &&\n"> <" test \"z$(git rev-parse master^0)\" = \"z$(git rev-parse HEAD)\"\n"> ) } ) (C {(test_expect_success)} {(SQ <"detach a symbolic link HEAD">)} { (SQ <"\n"> <" git checkout master &&\n"> <" git config --bool core.prefersymlinkrefs yes &&\n"> <" git checkout side &&\n"> <" git checkout master &&\n"> <" it=$(git symbolic-ref HEAD) &&\n"> <" test \"z$it\" = zrefs/heads/master &&\n"> <" here=$(git rev-parse --verify refs/heads/master) &&\n"> <" git checkout side^ &&\n"> <" test \"z$(git rev-parse --verify refs/heads/master)\" = \"z$here\"\n"> ) } ) (C {(test_expect_success)} {(SQ <"checkout with --track fakes a sensible -b <name>">)} { (SQ <"\n"> <" git config remote.origin.fetch \"+refs/heads/*:refs/remotes/origin/*\" &&\n"> <" git update-ref refs/remotes/origin/koala/bear renamer &&\n"> <"\n"> <" git checkout --track origin/koala/bear &&\n"> <" test \"refs/heads/koala/bear\" = \"$(git symbolic-ref HEAD)\" &&\n"> <" test \"$(git rev-parse HEAD)\" = \"$(git rev-parse renamer)\" &&\n"> <"\n"> <" git checkout master && git branch -D koala/bear &&\n"> <"\n"> <" git checkout --track refs/remotes/origin/koala/bear &&\n"> <" test \"refs/heads/koala/bear\" = \"$(git symbolic-ref HEAD)\" &&\n"> <" test \"$(git rev-parse HEAD)\" = \"$(git rev-parse renamer)\" &&\n"> <"\n"> <" git checkout master && git branch -D koala/bear &&\n"> <"\n"> <" git checkout --track remotes/origin/koala/bear &&\n"> <" test \"refs/heads/koala/bear\" = \"$(git symbolic-ref HEAD)\" &&\n"> <" test \"$(git rev-parse HEAD)\" = \"$(git rev-parse renamer)\"\n"> ) } ) (C {(test_expect_success)} {(SQ <"checkout with --track, but without -b, fails with too short tracked name">)} {(SQ <"\n"> <" test_must_fail git checkout --track renamer">)} ) (FuncDef name: setup_conflicting_index body: (BraceGroup children: [ (AndOr children: [ (C {(rm)} {(-f)} {(.git/index)}) (AndOr children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:O) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(echo)} {(original)}) (C {(git)} {(hash-object)} {(-w)} {(--stdin)}) ] negated: False ) ] ) left_token: <Left_CommandSub "$("> spids: [734 748] ) } spids: [733] ) ] spids: [733] ) (AndOr children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:A) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(echo)} {(ourside)}) (C {(git)} {(hash-object)} {(-w)} {(--stdin)}) ] negated: False ) ] ) left_token: <Left_CommandSub "$("> spids: [754 768] ) } spids: [753] ) ] spids: [753] ) (AndOr children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:B) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(echo)} {(theirside)}) (C {(git)} {(hash-object)} {(-w)} {(--stdin)}) ] negated: False ) ] ) left_token: <Left_CommandSub "$("> spids: [774 788] ) } spids: [773] ) ] spids: [773] ) (Pipeline children: [ (Subshell child: (AndOr children: [ (C {(echo)} {(DQ ("100644 ") ($ VSub_Name "$A") (" 0\tfild"))}) (AndOr children: [ (C {(echo)} {(DQ ("100644 ") ($ VSub_Name "$O") (" 1\tfile"))} ) (AndOr children: [ (C {(echo)} {(DQ ("100644 ") ($ VSub_Name "$A") (" 2\tfile"))} ) (AndOr children: [ (C {(echo)} { (DQ ("100644 ") ($ VSub_Name "$B") (" 3\tfile")) } ) (C {(echo)} { (DQ ("100644 ") ($ VSub_Name "$A") (" 0\tfilf")) } ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) spids: [793 849] ) (C {(git)} {(update-index)} {(--index-info)}) ] negated: False ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] spids: [721] ) spids: [716 720] ) (C {(test_expect_success)} {(SQ <"checkout an unmerged path should fail">)} { (SQ <"\n"> <"\tsetup_conflicting_index &&\n"> <"\techo \"none of the above\" >sample &&\n"> <"\tcat sample >fild &&\n"> <"\tcat sample >file &&\n"> <"\tcat sample >filf &&\n"> <"\ttest_must_fail git checkout fild file filf &&\n"> <"\ttest_cmp sample fild &&\n"> <"\ttest_cmp sample filf &&\n"> <"\ttest_cmp sample file\n"> ) } ) (C {(test_expect_success)} {(SQ <"checkout with an unmerged path can be ignored">)} { (SQ <"\n"> <"\tsetup_conflicting_index &&\n"> <"\techo \"none of the above\" >sample &&\n"> <"\techo ourside >expect &&\n"> <"\tcat sample >fild &&\n"> <"\tcat sample >file &&\n"> <"\tcat sample >filf &&\n"> <"\tgit checkout -f fild file filf &&\n"> <"\ttest_cmp expect fild &&\n"> <"\ttest_cmp expect filf &&\n"> <"\ttest_cmp sample file\n"> ) } ) (C {(test_expect_success)} {(SQ <"checkout unmerged stage">)} { (SQ <"\n"> <"\tsetup_conflicting_index &&\n"> <"\techo \"none of the above\" >sample &&\n"> <"\techo ourside >expect &&\n"> <"\tcat sample >fild &&\n"> <"\tcat sample >file &&\n"> <"\tcat sample >filf &&\n"> <"\tgit checkout --ours . &&\n"> <"\ttest_cmp expect fild &&\n"> <"\ttest_cmp expect filf &&\n"> <"\ttest_cmp expect file &&\n"> <"\tgit checkout --theirs file &&\n"> <"\ttest ztheirside = \"z$(cat file)\"\n"> ) } ) (C {(test_expect_success)} {(SQ <"checkout with --merge">)} { (SQ <"\n"> <"\tsetup_conflicting_index &&\n"> <"\techo \"none of the above\" >sample &&\n"> <"\techo ourside >expect &&\n"> <"\tcat sample >fild &&\n"> <"\tcat sample >file &&\n"> <"\tcat sample >filf &&\n"> <"\tgit checkout -m -- fild file filf &&\n"> <"\t(\n"> <"\t\techo \"<<<<<<< ours\"\n"> <"\t\techo ourside\n"> <"\t\techo \"=======\"\n"> <"\t\techo theirside\n"> <"\t\techo \">>>>>>> theirs\"\n"> <"\t) >merged &&\n"> <"\ttest_cmp expect fild &&\n"> <"\ttest_cmp expect filf &&\n"> <"\ttest_cmp merged file\n"> ) } ) (C {(test_expect_success)} {(SQ <"checkout with --merge, in diff3 -m style">)} { (SQ <"\n"> <"\tgit config merge.conflictstyle diff3 &&\n"> <"\tsetup_conflicting_index &&\n"> <"\techo \"none of the above\" >sample &&\n"> <"\techo ourside >expect &&\n"> <"\tcat sample >fild &&\n"> <"\tcat sample >file &&\n"> <"\tcat sample >filf &&\n"> <"\tgit checkout -m -- fild file filf &&\n"> <"\t(\n"> <"\t\techo \"<<<<<<< ours\"\n"> <"\t\techo ourside\n"> <"\t\techo \"||||||| base\"\n"> <"\t\techo original\n"> <"\t\techo \"=======\"\n"> <"\t\techo theirside\n"> <"\t\techo \">>>>>>> theirs\"\n"> <"\t) >merged &&\n"> <"\ttest_cmp expect fild &&\n"> <"\ttest_cmp expect filf &&\n"> <"\ttest_cmp merged file\n"> ) } ) (C {(test_expect_success)} {(SQ <"checkout --conflict=merge, overriding config">)} { (SQ <"\n"> <"\tgit config merge.conflictstyle diff3 &&\n"> <"\tsetup_conflicting_index &&\n"> <"\techo \"none of the above\" >sample &&\n"> <"\techo ourside >expect &&\n"> <"\tcat sample >fild &&\n"> <"\tcat sample >file &&\n"> <"\tcat sample >filf &&\n"> <"\tgit checkout --conflict=merge -- fild file filf &&\n"> <"\t(\n"> <"\t\techo \"<<<<<<< ours\"\n"> <"\t\techo ourside\n"> <"\t\techo \"=======\"\n"> <"\t\techo theirside\n"> <"\t\techo \">>>>>>> theirs\"\n"> <"\t) >merged &&\n"> <"\ttest_cmp expect fild &&\n"> <"\ttest_cmp expect filf &&\n"> <"\ttest_cmp merged file\n"> ) } ) (C {(test_expect_success)} {(SQ <"checkout --conflict=diff3">)} { (SQ <"\n"> <"\ttest_unconfig merge.conflictstyle &&\n"> <"\tsetup_conflicting_index &&\n"> <"\techo \"none of the above\" >sample &&\n"> <"\techo ourside >expect &&\n"> <"\tcat sample >fild &&\n"> <"\tcat sample >file &&\n"> <"\tcat sample >filf &&\n"> <"\tgit checkout --conflict=diff3 -- fild file filf &&\n"> <"\t(\n"> <"\t\techo \"<<<<<<< ours\"\n"> <"\t\techo ourside\n"> <"\t\techo \"||||||| base\"\n"> <"\t\techo original\n"> <"\t\techo \"=======\"\n"> <"\t\techo theirside\n"> <"\t\techo \">>>>>>> theirs\"\n"> <"\t) >merged &&\n"> <"\ttest_cmp expect fild &&\n"> <"\ttest_cmp expect filf &&\n"> <"\ttest_cmp merged file\n"> ) } ) (C {(test_expect_success)} {(SQ <"failing checkout -b should not break working tree">)} { (SQ <"\n"> <"\tgit reset --hard master &&\n"> <"\tgit symbolic-ref HEAD refs/heads/master &&\n"> <"\ttest_must_fail git checkout -b renamer side^ &&\n"> <"\ttest $(git symbolic-ref HEAD) = refs/heads/master &&\n"> <"\tgit diff --exit-code &&\n"> <"\tgit diff --cached --exit-code\n"> <"\n"> ) } ) (C {(test_expect_success)} {(SQ <"switch out of non-branch">)} { (SQ <"\n"> <"\tgit reset --hard master &&\n"> <"\tgit checkout master^0 &&\n"> <"\techo modified >one &&\n"> <"\ttest_must_fail git checkout renamer 2>error.log &&\n"> <"\t! grep \"^Previous HEAD\" error.log\n"> ) } ) (Subshell child: (CommandList children: [ (C {(echo)} {(DQ ("#!") ($ VSub_Name "$SHELL_PATH"))}) (SimpleCommand words: [{(cat)}] redirects: [ (HereDoc op_id: Redir_DLess fd: -1 body: {("O=$1 A=$2 B=$3\n") ("cat \"$A\" >.tmp\n") ("exec >\"$A\"\n") ("echo '<<<<<<< filfre-theirs'\n") ("cat \"$B\"\n") ("echo '||||||| filfre-common'\n") ("cat \"$O\"\n") ("echo '======='\n") ("cat \".tmp\"\n") ("echo '>>>>>>> filfre-ours'\n") ("rm -f .tmp\n") ("exit 1\n") } do_expansion: False here_end: EOF was_filled: True spids: [1092] ) ] ) ] ) redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(filfre.sh)} spids:[1098])] spids: [1079 1096] ) (C {(chmod)} {(Lit_Other "+") (x)} {(filfre.sh)}) (C {(test_expect_success)} {(SQ <"custom merge driver with checkout -m">)} { (SQ <"\n"> <"\tgit reset --hard &&\n"> <"\n"> <"\tgit config merge.filfre.driver \"./filfre.sh %O %A %B\" &&\n"> <"\tgit config merge.filfre.name \"Feel-free merge driver\" &&\n"> <"\tgit config merge.filfre.recursive binary &&\n"> <"\techo \"arm merge=filfre\" >.gitattributes &&\n"> <"\n"> <"\tgit checkout -b left &&\n"> <"\techo neutral >arm &&\n"> <"\tgit add arm .gitattributes &&\n"> <"\ttest_tick &&\n"> <"\tgit commit -m neutral &&\n"> <"\tgit branch right &&\n"> <"\n"> <"\techo left >arm &&\n"> <"\ttest_tick &&\n"> <"\tgit commit -a -m left &&\n"> <"\tgit checkout right &&\n"> <"\n"> <"\techo right >arm &&\n"> <"\ttest_tick &&\n"> <"\tgit commit -a -m right &&\n"> <"\n"> <"\ttest_must_fail git merge left &&\n"> <"\t(\n"> <"\t\tfor t in filfre-common left right\n"> <"\t\tdo\n"> <"\t\t\tgrep $t arm || exit 1\n"> <"\t\tdone\n"> <"\t\texit 0\n"> <"\t) &&\n"> <"\n"> <"\tmv arm expect &&\n"> <"\tgit checkout -m arm &&\n"> <"\ttest_cmp expect arm\n"> ) } ) (C {(test_done)}) ] )