(List (= scope=<EAssignScope.GLOBAL 1> flags=0 words=[] bindings=[('test_description', {[SQ <LIT_CHARS "git am running">]})]) (Com {[LIT_CHARS .]} {[LIT_CHARS ./test-lib.sh]} ) (Com {[LIT_CHARS test_expect_success]} {[SQ <LIT_CHARS "setup: messages">]} {[SQ <LIT_CHARS "\n"> <LIT_CHARS "\tcat >msg <<-\\EOF &&\n"> <LIT_CHARS "\tsecond\n"> <LIT_CHARS "\n"> <LIT_CHARS "\tLorem ipsum dolor sit amet, consectetuer sadipscing elitr, sed diam nonumy\n"> <LIT_CHARS "\teirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam\n"> <LIT_CHARS "\tvoluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita\n"> <LIT_CHARS "\tkasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem\n"> <LIT_CHARS "\tipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod\n"> <LIT_CHARS "\ttempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At\n"> <LIT_CHARS "\tvero eos et accusam et justo duo dolores et ea rebum.\n"> <LIT_CHARS "\n"> <LIT_CHARS "\tEOF\n"> <LIT_CHARS "\tq_to_tab <<-\\EOF >>msg &&\n"> <LIT_CHARS "\tQDuis autem vel eum iriure dolor in hendrerit in vulputate velit\n"> <LIT_CHARS "\tQesse molestie consequat, vel illum dolore eu feugiat nulla facilisis\n"> <LIT_CHARS "\tQat vero eros et accumsan et iusto odio dignissim qui blandit\n"> <LIT_CHARS "\tQpraesent luptatum zzril delenit augue duis dolore te feugait nulla\n"> <LIT_CHARS "\tQfacilisi.\n"> <LIT_CHARS "\tEOF\n"> <LIT_CHARS "\tcat >>msg <<-\\EOF &&\n"> <LIT_CHARS "\n"> <LIT_CHARS "\tLorem ipsum dolor sit amet,\n"> <LIT_CHARS "\tconsectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut\n"> <LIT_CHARS "\tlaoreet dolore magna aliquam erat volutpat.\n"> <LIT_CHARS "\n"> <LIT_CHARS "\t git\n"> <LIT_CHARS "\t ---\n"> <LIT_CHARS "\t +++\n"> <LIT_CHARS "\n"> <LIT_CHARS "\tUt wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit\n"> <LIT_CHARS "\tlobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure\n"> <LIT_CHARS "\tdolor in hendrerit in vulputate velit esse molestie consequat, vel illum\n"> <LIT_CHARS "\tdolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio\n"> <LIT_CHARS "\tdignissim qui blandit praesent luptatum zzril delenit augue duis dolore te\n"> <LIT_CHARS "\tfeugait nulla facilisi.\n"> <LIT_CHARS "\tEOF\n"> <LIT_CHARS "\n"> <LIT_CHARS "\tcat >failmail <<-\\EOF &&\n"> <LIT_CHARS "\tFrom foo@example.com Fri May 23 10:43:49 2008\n"> <LIT_CHARS "\tFrom:\tfoo@example.com\n"> <LIT_CHARS "\tTo:\tbar@example.com\n"> <LIT_CHARS "\tSubject: Re: [RFC/PATCH] git-foo.sh\n"> <LIT_CHARS "\tDate:\tFri, 23 May 2008 05:23:42 +0200\n"> <LIT_CHARS "\n"> <LIT_CHARS "\tSometimes we have to find out that there">] [\ LIT_ESCAPED_CHAR "\\'"] [SQ <LIT_CHARS "s nothing left.\n"> <LIT_CHARS "\n"> <LIT_CHARS "\tEOF\n"> <LIT_CHARS "\n"> <LIT_CHARS "\tcat >pine <<-\\EOF &&\n"> <LIT_CHARS "\tFrom MAILER-DAEMON Fri May 23 10:43:49 2008\n"> <LIT_CHARS "\tDate: 23 May 2008 05:23:42 +0200\n"> <LIT_CHARS "\tFrom: Mail System Internal Data <MAILER-DAEMON@example.com>\n"> <LIT_CHARS "\tSubject: DON">] [\ LIT_ESCAPED_CHAR "\\'"] [SQ <LIT_CHARS "T DELETE THIS MESSAGE -- FOLDER INTERNAL DATA\n"> <LIT_CHARS "\tMessage-ID: <foo-0001@example.com>\n"> <LIT_CHARS "\n"> <LIT_CHARS "\tThis text is part of the internal format of your mail folder, and is not\n"> <LIT_CHARS "\ta real message. It is created automatically by the mail system software.\n"> <LIT_CHARS "\tIf deleted, important folder data will be lost, and it will be re-created\n"> <LIT_CHARS "\twith the data reset to initial values.\n"> <LIT_CHARS "\n"> <LIT_CHARS "\tEOF\n"> <LIT_CHARS "\n"> <LIT_CHARS "\tsignoff=\"Signed-off-by: $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL>\"\n">]} ) (Com {[LIT_CHARS test_expect_success]} {[LIT_CHARS setup]} {[SQ <LIT_CHARS "\n"> <LIT_CHARS "\techo hello >file &&\n"> <LIT_CHARS "\tgit add file &&\n"> <LIT_CHARS "\ttest_tick &&\n"> <LIT_CHARS "\tgit commit -m first &&\n"> <LIT_CHARS "\tgit tag first &&\n"> <LIT_CHARS "\n"> <LIT_CHARS "\techo world >>file &&\n"> <LIT_CHARS "\tgit add file &&\n"> <LIT_CHARS "\ttest_tick &&\n"> <LIT_CHARS "\tgit commit -s -F msg &&\n"> <LIT_CHARS "\tgit tag second &&\n"> <LIT_CHARS "\n"> <LIT_CHARS "\tgit format-patch --stdout first >patch1 &&\n"> <LIT_CHARS "\t{\n"> <LIT_CHARS "\t\techo \"X-Fake-Field: Line One\" &&\n"> <LIT_CHARS "\t\techo \"X-Fake-Field: Line Two\" &&\n"> <LIT_CHARS "\t\techo \"X-Fake-Field: Line Three\" &&\n"> <LIT_CHARS "\t\tgit format-patch --stdout first | sed -e \"1d\"\n"> <LIT_CHARS "\t} > patch1.eml &&\n"> <LIT_CHARS "\t{\n"> <LIT_CHARS "\t\techo \"X-Fake-Field: Line One\" &&\n"> <LIT_CHARS "\t\techo \"X-Fake-Field: Line Two\" &&\n"> <LIT_CHARS "\t\techo \"X-Fake-Field: Line Three\" &&\n"> <LIT_CHARS "\t\tgit format-patch --stdout first | sed -e \"1d\"\n"> <LIT_CHARS "\t} | append_cr >patch1-crlf.eml &&\n"> <LIT_CHARS "\t{\n"> <LIT_CHARS "\t\tprintf \"%255s\\\\n\" \"\"\n"> <LIT_CHARS "\t\techo \"X-Fake-Field: Line One\" &&\n"> <LIT_CHARS "\t\techo \"X-Fake-Field: Line Two\" &&\n"> <LIT_CHARS "\t\techo \"X-Fake-Field: Line Three\" &&\n"> <LIT_CHARS "\t\tgit format-patch --stdout first | sed -e \"1d\"\n"> <LIT_CHARS "\t} > patch1-ws.eml &&\n"> <LIT_CHARS "\n"> <LIT_CHARS "\tsed -n -e \"3,\\$p\" msg >file &&\n"> <LIT_CHARS "\tgit add file &&\n"> <LIT_CHARS "\ttest_tick &&\n"> <LIT_CHARS "\tgit commit -m third &&\n"> <LIT_CHARS "\n"> <LIT_CHARS "\tgit format-patch --stdout first >patch2\t&&\n"> <LIT_CHARS "\n"> <LIT_CHARS "\tgit checkout -b lorem &&\n"> <LIT_CHARS "\tsed -n -e \"11,\\$p\" msg >file &&\n"> <LIT_CHARS "\thead -n 9 msg >>file &&\n"> <LIT_CHARS "\ttest_tick &&\n"> <LIT_CHARS "\tgit commit -a -m \"moved stuff\" &&\n"> <LIT_CHARS "\n"> <LIT_CHARS "\techo goodbye >another &&\n"> <LIT_CHARS "\tgit add another &&\n"> <LIT_CHARS "\ttest_tick &&\n"> <LIT_CHARS "\tgit commit -m \"added another file\" &&\n"> <LIT_CHARS "\n"> <LIT_CHARS "\tgit format-patch --stdout master >lorem-move.patch &&\n"> <LIT_CHARS "\tgit format-patch --no-prefix --stdout master >lorem-zero.patch &&\n"> <LIT_CHARS "\n"> <LIT_CHARS "\tgit checkout -b rename &&\n"> <LIT_CHARS "\tgit mv file renamed &&\n"> <LIT_CHARS "\tgit commit -m \"renamed a file\" &&\n"> <LIT_CHARS "\n"> <LIT_CHARS "\tgit format-patch -M --stdout lorem >rename.patch &&\n"> <LIT_CHARS "\n"> <LIT_CHARS "\tgit reset --soft lorem^ &&\n"> <LIT_CHARS "\tgit commit -m \"renamed a file and added another\" &&\n"> <LIT_CHARS "\n"> <LIT_CHARS "\tgit format-patch -M --stdout lorem^ >rename-add.patch &&\n"> <LIT_CHARS "\n"> <LIT_CHARS "\t# reset time\n"> <LIT_CHARS "\tsane_unset test_tick &&\n"> <LIT_CHARS "\ttest_tick\n">]} ) (Com {[LIT_CHARS test_expect_success]} {[SQ <LIT_CHARS "am applies patch correctly">]} {[SQ <LIT_CHARS "\n"> <LIT_CHARS "\trm -fr .git/rebase-apply &&\n"> <LIT_CHARS "\tgit reset --hard &&\n"> <LIT_CHARS "\tgit checkout first &&\n"> <LIT_CHARS "\ttest_tick &&\n"> <LIT_CHARS "\tgit am <patch1 &&\n"> <LIT_CHARS "\t! test -d .git/rebase-apply &&\n"> <LIT_CHARS "\tgit diff --exit-code second &&\n"> <LIT_CHARS "\ttest \"$(git rev-parse second)\" = \"$(git rev-parse HEAD)\" &&\n"> <LIT_CHARS "\ttest \"$(git rev-parse second^)\" = \"$(git rev-parse HEAD^)\"\n">]} ) (Com {[LIT_CHARS test_expect_success]} {[SQ <LIT_CHARS "am applies patch e-mail not in a mbox">]} {[SQ <LIT_CHARS "\n"> <LIT_CHARS "\trm -fr .git/rebase-apply &&\n"> <LIT_CHARS "\tgit reset --hard &&\n"> <LIT_CHARS "\tgit checkout first &&\n"> <LIT_CHARS "\tgit am patch1.eml &&\n"> <LIT_CHARS "\t! test -d .git/rebase-apply &&\n"> <LIT_CHARS "\tgit diff --exit-code second &&\n"> <LIT_CHARS "\ttest \"$(git rev-parse second)\" = \"$(git rev-parse HEAD)\" &&\n"> <LIT_CHARS "\ttest \"$(git rev-parse second^)\" = \"$(git rev-parse HEAD^)\"\n">]} ) (Com {[LIT_CHARS test_expect_success]} {[SQ <LIT_CHARS "am applies patch e-mail not in a mbox with CRLF">]} {[SQ <LIT_CHARS "\n"> <LIT_CHARS "\trm -fr .git/rebase-apply &&\n"> <LIT_CHARS "\tgit reset --hard &&\n"> <LIT_CHARS "\tgit checkout first &&\n"> <LIT_CHARS "\tgit am patch1-crlf.eml &&\n"> <LIT_CHARS "\t! test -d .git/rebase-apply &&\n"> <LIT_CHARS "\tgit diff --exit-code second &&\n"> <LIT_CHARS "\ttest \"$(git rev-parse second)\" = \"$(git rev-parse HEAD)\" &&\n"> <LIT_CHARS "\ttest \"$(git rev-parse second^)\" = \"$(git rev-parse HEAD^)\"\n">]} ) (Com {[LIT_CHARS test_expect_success]} {[SQ <LIT_CHARS "am applies patch e-mail with preceding whitespace">]} {[SQ <LIT_CHARS "\n"> <LIT_CHARS "\trm -fr .git/rebase-apply &&\n"> <LIT_CHARS "\tgit reset --hard &&\n"> <LIT_CHARS "\tgit checkout first &&\n"> <LIT_CHARS "\tgit am patch1-ws.eml &&\n"> <LIT_CHARS "\t! test -d .git/rebase-apply &&\n"> <LIT_CHARS "\tgit diff --exit-code second &&\n"> <LIT_CHARS "\ttest \"$(git rev-parse second)\" = \"$(git rev-parse HEAD)\" &&\n"> <LIT_CHARS "\ttest \"$(git rev-parse second^)\" = \"$(git rev-parse HEAD^)\"\n">]} ) (Com {[LIT_CHARS test_expect_success]} {[SQ <LIT_CHARS "setup: new author and committer">]} {[SQ <LIT_CHARS "\n"> <LIT_CHARS "\tGIT_AUTHOR_NAME=\"Another Thor\" &&\n"> <LIT_CHARS "\tGIT_AUTHOR_EMAIL=\"a.thor@example.com\" &&\n"> <LIT_CHARS "\tGIT_COMMITTER_NAME=\"Co M Miter\" &&\n"> <LIT_CHARS "\tGIT_COMMITTER_EMAIL=\"c.miter@example.com\" &&\n"> <LIT_CHARS "\texport GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL GIT_COMMITTER_NAME GIT_COMMITTER_EMAIL\n">]} ) (FunctionDef compare [] (AndOr OP_AND_IF (= scope=<EAssignScope.GLOBAL 1> flags=0 words=[] bindings=[('a', {[ComSub (Pipeline (Com {[LIT_CHARS git]} {[LIT_CHARS cat-file]} {[LIT_CHARS commit]} {[DQ [VarSub 2]]}) (Com {[LIT_CHARS grep]} {[DQ [LIT_CHARS "^"][VarSub 1][LIT_CHARS " "]]}) )]})]) (AndOr OP_AND_IF (= scope=<EAssignScope.GLOBAL 1> flags=0 words=[] bindings=[('b', {[ComSub (Pipeline (Com {[LIT_CHARS git]} {[LIT_CHARS cat-file]} {[LIT_CHARS commit]} {[DQ [VarSub 3]]}) (Com {[LIT_CHARS grep]} {[DQ [LIT_CHARS "^"][VarSub 1][LIT_CHARS " "]]}) )]})]) (Com {[LIT_CHARS test]} {[DQ [VarSub a]]} {[LIT_DBRACKET_LIKE "="]} {[DQ [VarSub b]]} ) ) ) ) (Com {[LIT_CHARS test_expect_success]} {[SQ <LIT_CHARS "am changes committer and keeps author">]} {[SQ <LIT_CHARS "\n"> <LIT_CHARS "\ttest_tick &&\n"> <LIT_CHARS "\trm -fr .git/rebase-apply &&\n"> <LIT_CHARS "\tgit reset --hard &&\n"> <LIT_CHARS "\tgit checkout first &&\n"> <LIT_CHARS "\tgit am patch2 &&\n"> <LIT_CHARS "\t! test -d .git/rebase-apply &&\n"> <LIT_CHARS "\ttest \"$(git rev-parse master^^)\" = \"$(git rev-parse HEAD^^)\" &&\n"> <LIT_CHARS "\tgit diff --exit-code master..HEAD &&\n"> <LIT_CHARS "\tgit diff --exit-code master^..HEAD^ &&\n"> <LIT_CHARS "\tcompare author master HEAD &&\n"> <LIT_CHARS "\tcompare author master^ HEAD^ &&\n"> <LIT_CHARS "\ttest \"$GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL>\" = \\\n"> <LIT_CHARS "\t \"$(git log -1 --pretty=format:\"%cn <%ce>\" HEAD)\"\n">]} ) (Com {[LIT_CHARS test_expect_success]} {[SQ <LIT_CHARS "am --signoff adds Signed-off-by: line">]} {[SQ <LIT_CHARS "\n"> <LIT_CHARS "\trm -fr .git/rebase-apply &&\n"> <LIT_CHARS "\tgit reset --hard &&\n"> <LIT_CHARS "\tgit checkout -b master2 first &&\n"> <LIT_CHARS "\tgit am --signoff <patch2 &&\n"> <LIT_CHARS "\tprintf \"%s\\n\" \"$signoff\" >expected &&\n"> <LIT_CHARS "\techo \"Signed-off-by: $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL>\" >>expected &&\n"> <LIT_CHARS "\tgit cat-file commit HEAD^ | grep \"Signed-off-by:\" >actual &&\n"> <LIT_CHARS "\ttest_cmp expected actual &&\n"> <LIT_CHARS "\techo \"Signed-off-by: $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL>\" >expected &&\n"> <LIT_CHARS "\tgit cat-file commit HEAD | grep \"Signed-off-by:\" >actual &&\n"> <LIT_CHARS "\ttest_cmp expected actual\n">]} ) (Com {[LIT_CHARS test_expect_success]} {[SQ <LIT_CHARS "am stays in branch">]} {[SQ <LIT_CHARS "\n"> <LIT_CHARS "\techo refs/heads/master2 >expected &&\n"> <LIT_CHARS "\tgit symbolic-ref HEAD >actual &&\n"> <LIT_CHARS "\ttest_cmp expected actual\n">]} ) (Com {[LIT_CHARS test_expect_success]} {[SQ <LIT_CHARS "am --signoff does not add Signed-off-by: line if already there">]} {[SQ <LIT_CHARS "\n"> <LIT_CHARS "\tgit format-patch --stdout HEAD^ >patch3 &&\n"> <LIT_CHARS "\tsed -e \"/^Subject/ s,\\[PATCH,Re: Re: Re: & 1/5 v2] [foo,\" patch3 >patch4 &&\n"> <LIT_CHARS "\trm -fr .git/rebase-apply &&\n"> <LIT_CHARS "\tgit reset --hard &&\n"> <LIT_CHARS "\tgit checkout HEAD^ &&\n"> <LIT_CHARS "\tgit am --signoff patch4 &&\n"> <LIT_CHARS "\tgit cat-file commit HEAD >actual &&\n"> <LIT_CHARS "\ttest $(grep -c \"^Signed-off-by:\" actual) -eq 1\n">]} ) (Com {[LIT_CHARS test_expect_success]} {[SQ <LIT_CHARS "am without --keep removes Re: and [PATCH] stuff">]} {[SQ <LIT_CHARS "\n"> <LIT_CHARS "\tgit rev-parse HEAD >expected &&\n"> <LIT_CHARS "\tgit rev-parse master2 >actual &&\n"> <LIT_CHARS "\ttest_cmp expected actual\n">]} ) (Com {[LIT_CHARS test_expect_success]} {[SQ <LIT_CHARS "am --keep really keeps the subject">]} {[SQ <LIT_CHARS "\n"> <LIT_CHARS "\trm -fr .git/rebase-apply &&\n"> <LIT_CHARS "\tgit reset --hard &&\n"> <LIT_CHARS "\tgit checkout HEAD^ &&\n"> <LIT_CHARS "\tgit am --keep patch4 &&\n"> <LIT_CHARS "\t! test -d .git/rebase-apply &&\n"> <LIT_CHARS "\tgit cat-file commit HEAD >actual &&\n"> <LIT_CHARS "\tgrep \"Re: Re: Re: \\[PATCH 1/5 v2\\] \\[foo\\] third\" actual\n">]} ) (Com {[LIT_CHARS test_expect_success]} {[SQ <LIT_CHARS "am --keep-non-patch really keeps the non-patch part">]} {[SQ <LIT_CHARS "\n"> <LIT_CHARS "\trm -fr .git/rebase-apply &&\n"> <LIT_CHARS "\tgit reset --hard &&\n"> <LIT_CHARS "\tgit checkout HEAD^ &&\n"> <LIT_CHARS "\tgit am --keep-non-patch patch4 &&\n"> <LIT_CHARS "\t! test -d .git/rebase-apply &&\n"> <LIT_CHARS "\tgit cat-file commit HEAD >actual &&\n"> <LIT_CHARS "\tgrep \"^\\[foo\\] third\" actual\n">]} ) (Com {[LIT_CHARS test_expect_success]} {[SQ <LIT_CHARS "am -3 falls back to 3-way merge">]} {[SQ <LIT_CHARS "\n"> <LIT_CHARS "\trm -fr .git/rebase-apply &&\n"> <LIT_CHARS "\tgit reset --hard &&\n"> <LIT_CHARS "\tgit checkout -b lorem2 master2 &&\n"> <LIT_CHARS "\tsed -n -e \"3,\\$p\" msg >file &&\n"> <LIT_CHARS "\thead -n 9 msg >>file &&\n"> <LIT_CHARS "\tgit add file &&\n"> <LIT_CHARS "\ttest_tick &&\n"> <LIT_CHARS "\tgit commit -m \"copied stuff\" &&\n"> <LIT_CHARS "\tgit am -3 lorem-move.patch &&\n"> <LIT_CHARS "\t! test -d .git/rebase-apply &&\n"> <LIT_CHARS "\tgit diff --exit-code lorem\n">]} ) (Com {[LIT_CHARS test_expect_success]} {[SQ <LIT_CHARS "am -3 -p0 can read --no-prefix patch">]} {[SQ <LIT_CHARS "\n"> <LIT_CHARS "\trm -fr .git/rebase-apply &&\n"> <LIT_CHARS "\tgit reset --hard &&\n"> <LIT_CHARS "\tgit checkout -b lorem3 master2 &&\n"> <LIT_CHARS "\tsed -n -e \"3,\\$p\" msg >file &&\n"> <LIT_CHARS "\thead -n 9 msg >>file &&\n"> <LIT_CHARS "\tgit add file &&\n"> <LIT_CHARS "\ttest_tick &&\n"> <LIT_CHARS "\tgit commit -m \"copied stuff\" &&\n"> <LIT_CHARS "\tgit am -3 -p0 lorem-zero.patch &&\n"> <LIT_CHARS "\t! test -d .git/rebase-apply &&\n"> <LIT_CHARS "\tgit diff --exit-code lorem\n">]} ) (Com {[LIT_CHARS test_expect_success]} {[SQ <LIT_CHARS "am can rename a file">]} {[SQ <LIT_CHARS "\n"> <LIT_CHARS "\tgrep \"^rename from\" rename.patch &&\n"> <LIT_CHARS "\trm -fr .git/rebase-apply &&\n"> <LIT_CHARS "\tgit reset --hard &&\n"> <LIT_CHARS "\tgit checkout lorem^0 &&\n"> <LIT_CHARS "\tgit am rename.patch &&\n"> <LIT_CHARS "\t! test -d .git/rebase-apply &&\n"> <LIT_CHARS "\tgit update-index --refresh &&\n"> <LIT_CHARS "\tgit diff --exit-code rename\n">]} ) (Com {[LIT_CHARS test_expect_success]} {[SQ <LIT_CHARS "am -3 can rename a file">]} {[SQ <LIT_CHARS "\n"> <LIT_CHARS "\tgrep \"^rename from\" rename.patch &&\n"> <LIT_CHARS "\trm -fr .git/rebase-apply &&\n"> <LIT_CHARS "\tgit reset --hard &&\n"> <LIT_CHARS "\tgit checkout lorem^0 &&\n"> <LIT_CHARS "\tgit am -3 rename.patch &&\n"> <LIT_CHARS "\t! test -d .git/rebase-apply &&\n"> <LIT_CHARS "\tgit update-index --refresh &&\n"> <LIT_CHARS "\tgit diff --exit-code rename\n">]} ) (Com {[LIT_CHARS test_expect_success]} {[SQ <LIT_CHARS "am -3 can rename a file after falling back to 3-way merge">]} {[SQ <LIT_CHARS "\n"> <LIT_CHARS "\tgrep \"^rename from\" rename-add.patch &&\n"> <LIT_CHARS "\trm -fr .git/rebase-apply &&\n"> <LIT_CHARS "\tgit reset --hard &&\n"> <LIT_CHARS "\tgit checkout lorem^0 &&\n"> <LIT_CHARS "\tgit am -3 rename-add.patch &&\n"> <LIT_CHARS "\t! test -d .git/rebase-apply &&\n"> <LIT_CHARS "\tgit update-index --refresh &&\n"> <LIT_CHARS "\tgit diff --exit-code rename\n">]} ) (Com {[LIT_CHARS test_expect_success]} {[SQ <LIT_CHARS "am -3 -q is quiet">]} {[SQ <LIT_CHARS "\n"> <LIT_CHARS "\trm -fr .git/rebase-apply &&\n"> <LIT_CHARS "\tgit checkout -f lorem2 &&\n"> <LIT_CHARS "\tgit reset master2 --hard &&\n"> <LIT_CHARS "\tsed -n -e \"3,\\$p\" msg >file &&\n"> <LIT_CHARS "\thead -n 9 msg >>file &&\n"> <LIT_CHARS "\tgit add file &&\n"> <LIT_CHARS "\ttest_tick &&\n"> <LIT_CHARS "\tgit commit -m \"copied stuff\" &&\n"> <LIT_CHARS "\tgit am -3 -q lorem-move.patch >output.out 2>&1 &&\n"> <LIT_CHARS "\t! test -s output.out\n">]} ) (Com {[LIT_CHARS test_expect_success]} {[SQ <LIT_CHARS "am pauses on conflict">]} {[SQ <LIT_CHARS "\n"> <LIT_CHARS "\trm -fr .git/rebase-apply &&\n"> <LIT_CHARS "\tgit reset --hard &&\n"> <LIT_CHARS "\tgit checkout lorem2^^ &&\n"> <LIT_CHARS "\ttest_must_fail git am lorem-move.patch &&\n"> <LIT_CHARS "\ttest -d .git/rebase-apply\n">]} ) (Com {[LIT_CHARS test_expect_success]} {[SQ <LIT_CHARS "am --skip works">]} {[SQ <LIT_CHARS "\n"> <LIT_CHARS "\techo goodbye >expected &&\n"> <LIT_CHARS "\tgit am --skip &&\n"> <LIT_CHARS "\t! test -d .git/rebase-apply &&\n"> <LIT_CHARS "\tgit diff --exit-code lorem2^^ -- file &&\n"> <LIT_CHARS "\ttest_cmp expected another\n">]} ) (Com {[LIT_CHARS test_expect_success]} {[SQ <LIT_CHARS "am --resolved works">]} {[SQ <LIT_CHARS "\n"> <LIT_CHARS "\techo goodbye >expected &&\n"> <LIT_CHARS "\trm -fr .git/rebase-apply &&\n"> <LIT_CHARS "\tgit reset --hard &&\n"> <LIT_CHARS "\tgit checkout lorem2^^ &&\n"> <LIT_CHARS "\ttest_must_fail git am lorem-move.patch &&\n"> <LIT_CHARS "\ttest -d .git/rebase-apply &&\n"> <LIT_CHARS "\techo resolved >>file &&\n"> <LIT_CHARS "\tgit add file &&\n"> <LIT_CHARS "\tgit am --resolved &&\n"> <LIT_CHARS "\t! test -d .git/rebase-apply &&\n"> <LIT_CHARS "\ttest_cmp expected another\n">]} ) (Com {[LIT_CHARS test_expect_success]} {[SQ <LIT_CHARS "am takes patches from a Pine mailbox">]} {[SQ <LIT_CHARS "\n"> <LIT_CHARS "\trm -fr .git/rebase-apply &&\n"> <LIT_CHARS "\tgit reset --hard &&\n"> <LIT_CHARS "\tgit checkout first &&\n"> <LIT_CHARS "\tcat pine patch1 | git am &&\n"> <LIT_CHARS "\t! test -d .git/rebase-apply &&\n"> <LIT_CHARS "\tgit diff --exit-code master^..HEAD\n">]} ) (Com {[LIT_CHARS test_expect_success]} {[SQ <LIT_CHARS "am fails on mail without patch">]} {[SQ <LIT_CHARS "\n"> <LIT_CHARS "\trm -fr .git/rebase-apply &&\n"> <LIT_CHARS "\tgit reset --hard &&\n"> <LIT_CHARS "\ttest_must_fail git am <failmail &&\n"> <LIT_CHARS "\tgit am --abort &&\n"> <LIT_CHARS "\t! test -d .git/rebase-apply\n">]} ) (Com {[LIT_CHARS test_expect_success]} {[SQ <LIT_CHARS "am fails on empty patch">]} {[SQ <LIT_CHARS "\n"> <LIT_CHARS "\trm -fr .git/rebase-apply &&\n"> <LIT_CHARS "\tgit reset --hard &&\n"> <LIT_CHARS "\techo \"---\" >>failmail &&\n"> <LIT_CHARS "\ttest_must_fail git am <failmail &&\n"> <LIT_CHARS "\tgit am --skip &&\n"> <LIT_CHARS "\t! test -d .git/rebase-apply\n">]} ) (Com {[LIT_CHARS test_expect_success]} {[SQ <LIT_CHARS "am works from stdin in subdirectory">]} {[SQ <LIT_CHARS "\n"> <LIT_CHARS "\trm -fr subdir &&\n"> <LIT_CHARS "\trm -fr .git/rebase-apply &&\n"> <LIT_CHARS "\tgit reset --hard &&\n"> <LIT_CHARS "\tgit checkout first &&\n"> <LIT_CHARS "\t(\n"> <LIT_CHARS "\t\tmkdir -p subdir &&\n"> <LIT_CHARS "\t\tcd subdir &&\n"> <LIT_CHARS "\t\tgit am <../patch1\n"> <LIT_CHARS "\t) &&\n"> <LIT_CHARS "\tgit diff --exit-code second\n">]} ) (Com {[LIT_CHARS test_expect_success]} {[SQ <LIT_CHARS "am works from file (relative path given) in subdirectory">]} {[SQ <LIT_CHARS "\n"> <LIT_CHARS "\trm -fr subdir &&\n"> <LIT_CHARS "\trm -fr .git/rebase-apply &&\n"> <LIT_CHARS "\tgit reset --hard &&\n"> <LIT_CHARS "\tgit checkout first &&\n"> <LIT_CHARS "\t(\n"> <LIT_CHARS "\t\tmkdir -p subdir &&\n"> <LIT_CHARS "\t\tcd subdir &&\n"> <LIT_CHARS "\t\tgit am ../patch1\n"> <LIT_CHARS "\t) &&\n"> <LIT_CHARS "\tgit diff --exit-code second\n">]} ) (Com {[LIT_CHARS test_expect_success]} {[SQ <LIT_CHARS "am works from file (absolute path given) in subdirectory">]} {[SQ <LIT_CHARS "\n"> <LIT_CHARS "\trm -fr subdir &&\n"> <LIT_CHARS "\trm -fr .git/rebase-apply &&\n"> <LIT_CHARS "\tgit reset --hard &&\n"> <LIT_CHARS "\tgit checkout first &&\n"> <LIT_CHARS "\tP=$(pwd) &&\n"> <LIT_CHARS "\t(\n"> <LIT_CHARS "\t\tmkdir -p subdir &&\n"> <LIT_CHARS "\t\tcd subdir &&\n"> <LIT_CHARS "\t\tgit am \"$P/patch1\"\n"> <LIT_CHARS "\t) &&\n"> <LIT_CHARS "\tgit diff --exit-code second\n">]} ) (Com {[LIT_CHARS test_expect_success]} {[SQ <LIT_CHARS "am --committer-date-is-author-date">]} {[SQ <LIT_CHARS "\n"> <LIT_CHARS "\trm -fr .git/rebase-apply &&\n"> <LIT_CHARS "\tgit reset --hard &&\n"> <LIT_CHARS "\tgit checkout first &&\n"> <LIT_CHARS "\ttest_tick &&\n"> <LIT_CHARS "\tgit am --committer-date-is-author-date patch1 &&\n"> <LIT_CHARS "\tgit cat-file commit HEAD | sed -e \"/^\\$/q\" >head1 &&\n"> <LIT_CHARS "\tsed -ne \"/^author /s/.*> //p\" head1 >at &&\n"> <LIT_CHARS "\tsed -ne \"/^committer /s/.*> //p\" head1 >ct &&\n"> <LIT_CHARS "\ttest_cmp at ct\n">]} ) (Com {[LIT_CHARS test_expect_success]} {[SQ <LIT_CHARS "am without --committer-date-is-author-date">]} {[SQ <LIT_CHARS "\n"> <LIT_CHARS "\trm -fr .git/rebase-apply &&\n"> <LIT_CHARS "\tgit reset --hard &&\n"> <LIT_CHARS "\tgit checkout first &&\n"> <LIT_CHARS "\ttest_tick &&\n"> <LIT_CHARS "\tgit am patch1 &&\n"> <LIT_CHARS "\tgit cat-file commit HEAD | sed -e \"/^\\$/q\" >head1 &&\n"> <LIT_CHARS "\tsed -ne \"/^author /s/.*> //p\" head1 >at &&\n"> <LIT_CHARS "\tsed -ne \"/^committer /s/.*> //p\" head1 >ct &&\n"> <LIT_CHARS "\t! test_cmp at ct\n">]} ) (Com {[LIT_CHARS test_expect_success]} {[SQ <LIT_CHARS "am --ignore-date">]} {[SQ <LIT_CHARS "\n"> <LIT_CHARS "\trm -fr .git/rebase-apply &&\n"> <LIT_CHARS "\tgit reset --hard &&\n"> <LIT_CHARS "\tgit checkout first &&\n"> <LIT_CHARS "\ttest_tick &&\n"> <LIT_CHARS "\tgit am --ignore-date patch1 &&\n"> <LIT_CHARS "\tgit cat-file commit HEAD | sed -e \"/^\\$/q\" >head1 &&\n"> <LIT_CHARS "\tsed -ne \"/^author /s/.*> //p\" head1 >at &&\n"> <LIT_CHARS "\tgrep \"+0000\" at\n">]} ) (Com {[LIT_CHARS test_expect_success]} {[SQ <LIT_CHARS "am into an unborn branch">]} {[SQ <LIT_CHARS "\n"> <LIT_CHARS "\tgit rev-parse first^{tree} >expected &&\n"> <LIT_CHARS "\trm -fr .git/rebase-apply &&\n"> <LIT_CHARS "\tgit reset --hard &&\n"> <LIT_CHARS "\trm -fr subdir &&\n"> <LIT_CHARS "\tmkdir subdir &&\n"> <LIT_CHARS "\tgit format-patch --numbered-files -o subdir -1 first &&\n"> <LIT_CHARS "\t(\n"> <LIT_CHARS "\t\tcd subdir &&\n"> <LIT_CHARS "\t\tgit init &&\n"> <LIT_CHARS "\t\tgit am 1\n"> <LIT_CHARS "\t) &&\n"> <LIT_CHARS "\t(\n"> <LIT_CHARS "\t\tcd subdir &&\n"> <LIT_CHARS "\t\tgit rev-parse HEAD^{tree} >../actual\n"> <LIT_CHARS "\t) &&\n"> <LIT_CHARS "\ttest_cmp expected actual\n">]} ) (Com {[LIT_CHARS test_expect_success]} {[SQ <LIT_CHARS "am newline in subject">]} {[SQ <LIT_CHARS "\n"> <LIT_CHARS "\trm -fr .git/rebase-apply &&\n"> <LIT_CHARS "\tgit reset --hard &&\n"> <LIT_CHARS "\tgit checkout first &&\n"> <LIT_CHARS "\ttest_tick &&\n"> <LIT_CHARS "\tsed -e \"s/second/second \\\\\\n foo/\" patch1 >patchnl &&\n"> <LIT_CHARS "\tgit am <patchnl >output.out 2>&1 &&\n"> <LIT_CHARS "\ttest_i18ngrep \"^Applying: second \\\\\\n foo$\" output.out\n">]} ) (Com {[LIT_CHARS test_expect_success]} {[SQ <LIT_CHARS "am -q is quiet">]} {[SQ <LIT_CHARS "\n"> <LIT_CHARS "\trm -fr .git/rebase-apply &&\n"> <LIT_CHARS "\tgit reset --hard &&\n"> <LIT_CHARS "\tgit checkout first &&\n"> <LIT_CHARS "\ttest_tick &&\n"> <LIT_CHARS "\tgit am -q <patch1 >output.out 2>&1 &&\n"> <LIT_CHARS "\t! test -s output.out\n">]} ) (Com {[LIT_CHARS test_expect_success]} {[SQ <LIT_CHARS "am empty-file does not infloop">]} {[SQ <LIT_CHARS "\n"> <LIT_CHARS "\trm -fr .git/rebase-apply &&\n"> <LIT_CHARS "\tgit reset --hard &&\n"> <LIT_CHARS "\ttouch empty-file &&\n"> <LIT_CHARS "\ttest_tick &&\n"> <LIT_CHARS "\ttest_must_fail git am empty-file 2>actual &&\n"> <LIT_CHARS "\techo Patch format detection failed. >expected &&\n"> <LIT_CHARS "\ttest_i18ncmp expected actual\n">]} ) (Com {[LIT_CHARS test_done]} ) )