{"thread":{"id":"39892","subject":"[PATCH v3 02/12] t4150: am fails if index is dirty","startedAt":"2015-07-19T15:49:06Z","lastAt":"2015-07-19T15:49:18Z","messageCount":13,"participants":["Paul Tan"],"isPatch":true,"patchVersion":3,"patchTotal":12},"messages":[{"id":"266378","messageId":"1437320958-11192-1-git-send-email-pyokagan@gmail.com","threadId":"39892","inReplyTo":null,"subject":"[PATCH v3 00/12] Improve git-am test coverage","fromName":"Paul Tan","fromEmail":"pyokagan@gmail.com","sentAt":"2015-07-19T15:49:06Z","receivedAt":"2015-07-19T15:49:06Z","isPatch":true,"sender":{"key":"pyokagan@gmail.com","avatar":"https://avatars.githubusercontent.com/u/109479?v=4"},"body":"This is a very minor re-roll of [v2] that adds in the missing !MINGW prereq in\nt3901.  Thanks Johannes Schindelin and Johannes Sixt for the reviews last\nround. Interdiff below.\n\nPrevious versions:\n\n[v1] http://thread.gmane.org/gmane.comp.version-control.git/273254\n[v2] http://thread.gmane.org/gmane.comp.version-control.git/273507\n\nIncrease test coverage of git-am.sh to help prevent regressions that could\narise from the rewrite of git-am.sh to C. This patch series, along with\npt/am-foreign, improved test coverage as measured by kcov from 56.5%[1] to\n67.3%[2].\n\nNo tests for git-am's interactive mode, though, as test_terminal does not seem\nto attach a pseudo-tty to stdin(?), thus making git-am's \"test -t 0\" check\nfail.\n\nThis is part of my GSoC project to rewrite git-am.sh to a C builtin[3].\n\n[1] http://pyokagan.github.io/git/20150430132408-a75942b//kcov-merged/git-am.eb79278e.html\n[2] http://pyokagan.github.io/git/20150702173751-2fdae08//kcov-merged/git-am.eb79278e.html\n[3] https://gist.github.com/pyokagan/1b7b0d1f4dab6ba3cef1\n\n\nPaul Tan (12):\n  t4150: am.messageid really adds the message id\n  t4150: am fails if index is dirty\n  t4151: am --abort will keep dirty index intact\n  t4150: am refuses patches when paused\n  t4150: am --resolved fails if index has no changes\n  t4150: am --resolved fails if index has unmerged entries\n  t4150: am with applypatch-msg hook\n  t4150: am with pre-applypatch hook\n  t4150: am with post-applypatch hook\n  t4150: tests for am --[no-]scissors\n  t3418: non-interactive rebase --continue with rerere enabled\n  t3901: test git-am encoding conversion\n\n t/t3418-rebase-continue.sh |  19 ++++\n t/t3901-i18n-patch.sh      |  62 +++++++++++++\n t/t4150-am.sh              | 217 +++++++++++++++++++++++++++++++++++++++++++++\n t/t4151-am-abort.sh        |  15 ++++\n 4 files changed, 313 insertions(+)\n\ndiff --git a/t/t3901-i18n-patch.sh b/t/t3901-i18n-patch.sh\nindex b49bdb7..509084e 100755\n--- a/t/t3901-i18n-patch.sh\n+++ b/t/t3901-i18n-patch.sh\n@@ -262,7 +262,7 @@ test_expect_success 'am (U/U)' '\n \tcheck_encoding 2\n '\n \n-test_expect_success 'am (L/L)' '\n+test_expect_success !MINGW 'am (L/L)' '\n \t# Apply ISO-8859-1 patches with ISO-8859-1 commitencoding\n \tgit config i18n.commitencoding ISO8859-1 &&\n \t. \"$TEST_DIRECTORY\"/t3901-8859-1.txt &&\n\n-- \n2.5.0.rc2.110.gf2a5fc6\n"},{"id":"266379","messageId":"1437320958-11192-2-git-send-email-pyokagan@gmail.com","threadId":"39892","inReplyTo":"1437320958-11192-1-git-send-email-pyokagan@gmail.com","subject":"[PATCH v3 01/12] t4150: am.messageid really adds the message id","fromName":"Paul Tan","fromEmail":"pyokagan@gmail.com","sentAt":"2015-07-19T15:49:07Z","receivedAt":"2015-07-19T15:49:07Z","isPatch":true,"sender":{"key":"pyokagan@gmail.com","avatar":"https://avatars.githubusercontent.com/u/109479?v=4"},"body":"Since a078f73 (git-am: add --message-id/--no-message-id, 2014-11-25),\nthe am.messageid setting determines whether the --message-id option is\nset by default.\n\nAdd a test for this.\n\nReviewed-by: Paolo Bonzini <pbonzini@redhat.com>\nSigned-off-by: Paul Tan <pyokagan@gmail.com>\n---\n t/t4150-am.sh | 12 ++++++++++++\n 1 file changed, 12 insertions(+)\n\ndiff --git a/t/t4150-am.sh b/t/t4150-am.sh\nindex b822a39..264f53f 100755\n--- a/t/t4150-am.sh\n+++ b/t/t4150-am.sh\n@@ -563,6 +563,18 @@ test_expect_success 'am --message-id really adds the message id' '\n \ttest_cmp expected actual\n '\n \n+test_expect_success 'am.messageid really adds the message id' '\n+\trm -fr .git/rebase-apply &&\n+\tgit reset --hard &&\n+\tgit checkout HEAD^ &&\n+\ttest_config am.messageid true &&\n+\tgit am patch1.eml &&\n+\ttest_path_is_missing .git/rebase-apply &&\n+\tgit cat-file commit HEAD | tail -n1 >actual &&\n+\tgrep Message-Id patch1.eml >expected &&\n+\ttest_cmp expected actual\n+'\n+\n test_expect_success 'am --message-id -s signs off after the message id' '\n \trm -fr .git/rebase-apply &&\n \tgit reset --hard &&\n-- \n2.5.0.rc2.110.gf2a5fc6\n"},{"id":"266377","messageId":"1437320958-11192-3-git-send-email-pyokagan@gmail.com","threadId":"39892","inReplyTo":"1437320958-11192-1-git-send-email-pyokagan@gmail.com","subject":"[PATCH v3 02/12] t4150: am fails if index is dirty","fromName":"Paul Tan","fromEmail":"pyokagan@gmail.com","sentAt":"2015-07-19T15:49:08Z","receivedAt":"2015-07-19T15:49:08Z","isPatch":true,"sender":{"key":"pyokagan@gmail.com","avatar":"https://avatars.githubusercontent.com/u/109479?v=4"},"body":"Since d1c5f2a (Add git-am, applymbox replacement., 2005-10-07), git-am\nwill ensure that the index is clean before applying the patch. This is\nto prevent changes unrelated to the patch from being committed.\n\nAdd a test for this check.\n\nReviewed-by: Stefan Beller <sbeller@google.com>\nReviewed-by: Johannes Schindelin <johannes.schindelin@gmx.de>\nSigned-off-by: Paul Tan <pyokagan@gmail.com>\n---\n t/t4150-am.sh | 12 ++++++++++++\n 1 file changed, 12 insertions(+)\n\ndiff --git a/t/t4150-am.sh b/t/t4150-am.sh\nindex 264f53f..a85e06a 100755\n--- a/t/t4150-am.sh\n+++ b/t/t4150-am.sh\n@@ -154,6 +154,18 @@ test_expect_success 'am applies patch correctly' '\n \ttest \"$(git rev-parse second^)\" = \"$(git rev-parse HEAD^)\"\n '\n \n+test_expect_success 'am fails if index is dirty' '\n+\ttest_when_finished \"rm -f dirtyfile\" &&\n+\trm -fr .git/rebase-apply &&\n+\tgit reset --hard &&\n+\tgit checkout first &&\n+\techo dirtyfile >dirtyfile &&\n+\tgit add dirtyfile &&\n+\ttest_must_fail git am patch1 &&\n+\ttest_path_is_dir .git/rebase-apply &&\n+\ttest_cmp_rev first HEAD\n+'\n+\n test_expect_success 'am applies patch e-mail not in a mbox' '\n \trm -fr .git/rebase-apply &&\n \tgit reset --hard &&\n-- \n2.5.0.rc2.110.gf2a5fc6\n"},{"id":"266381","messageId":"1437320958-11192-4-git-send-email-pyokagan@gmail.com","threadId":"39892","inReplyTo":"1437320958-11192-1-git-send-email-pyokagan@gmail.com","subject":"[PATCH v3 03/12] t4151: am --abort will keep dirty index intact","fromName":"Paul Tan","fromEmail":"pyokagan@gmail.com","sentAt":"2015-07-19T15:49:09Z","receivedAt":"2015-07-19T15:49:09Z","isPatch":true,"sender":{"key":"pyokagan@gmail.com","avatar":"https://avatars.githubusercontent.com/u/109479?v=4"},"body":"Since 7b3b7e3 (am --abort: keep unrelated commits since the last failure\nand warn, 2010-12-21), git-am --abort will not touch the index if on the\nprevious invocation, git-am failed because the index is dirty. This is\nto ensure that the user's modifications to the index are not discarded.\n\nAdd a test for this.\n\nReviewed-by: Stefan Beller <sbeller@google.com>\nReviewed-by: Johannes Schindelin <johannes.schindelin@gmx.de>\nSigned-off-by: Paul Tan <pyokagan@gmail.com>\n---\n t/t4151-am-abort.sh | 15 +++++++++++++++\n 1 file changed, 15 insertions(+)\n\ndiff --git a/t/t4151-am-abort.sh b/t/t4151-am-abort.sh\nindex 833e7b2..05bdc3e 100755\n--- a/t/t4151-am-abort.sh\n+++ b/t/t4151-am-abort.sh\n@@ -95,6 +95,21 @@ test_expect_success 'am --abort will keep the local commits intact' '\n \ttest_cmp expect actual\n '\n \n+test_expect_success 'am --abort will keep dirty index intact' '\n+\tgit reset --hard initial &&\n+\techo dirtyfile >dirtyfile &&\n+\tcp dirtyfile dirtyfile.expected &&\n+\tgit add dirtyfile &&\n+\ttest_must_fail git am 0001-*.patch &&\n+\ttest_cmp_rev initial HEAD &&\n+\ttest_path_is_file dirtyfile &&\n+\ttest_cmp dirtyfile.expected dirtyfile &&\n+\tgit am --abort &&\n+\ttest_cmp_rev initial HEAD &&\n+\ttest_path_is_file dirtyfile &&\n+\ttest_cmp dirtyfile.expected dirtyfile\n+'\n+\n test_expect_success 'am -3 stops on conflict on unborn branch' '\n \tgit checkout -f --orphan orphan &&\n \tgit reset &&\n-- \n2.5.0.rc2.110.gf2a5fc6\n"},{"id":"266382","messageId":"1437320958-11192-5-git-send-email-pyokagan@gmail.com","threadId":"39892","inReplyTo":"1437320958-11192-1-git-send-email-pyokagan@gmail.com","subject":"[PATCH v3 04/12] t4150: am refuses patches when paused","fromName":"Paul Tan","fromEmail":"pyokagan@gmail.com","sentAt":"2015-07-19T15:49:10Z","receivedAt":"2015-07-19T15:49:10Z","isPatch":true,"sender":{"key":"pyokagan@gmail.com","avatar":"https://avatars.githubusercontent.com/u/109479?v=4"},"body":"Since c95b138 (Fix git-am safety checks, 2006-09-15), when there is a\nsession in progress, git-am will check the command-line arguments and\nstandard input to ensure that the user does not pass it any patches.\n\nAdd a test for this.\n\nReviewed-by: Stefan Beller <sbeller@google.com>\nReviewed-by: Johannes Schindelin <johannes.schindelin@gmx.de>\nSigned-off-by: Paul Tan <pyokagan@gmail.com>\n---\n t/t4150-am.sh | 14 ++++++++++++++\n 1 file changed, 14 insertions(+)\n\ndiff --git a/t/t4150-am.sh b/t/t4150-am.sh\nindex a85e06a..c350967 100755\n--- a/t/t4150-am.sh\n+++ b/t/t4150-am.sh\n@@ -397,6 +397,20 @@ test_expect_success 'am --abort removes a stray directory' '\n \ttest_path_is_missing .git/rebase-apply\n '\n \n+test_expect_success 'am refuses patches when paused' '\n+\trm -fr .git/rebase-apply &&\n+\tgit reset --hard &&\n+\tgit checkout lorem2^^ &&\n+\n+\ttest_must_fail git am lorem-move.patch &&\n+\ttest_path_is_dir .git/rebase-apply &&\n+\ttest_cmp_rev lorem2^^ HEAD &&\n+\n+\ttest_must_fail git am <lorem-move.patch &&\n+\ttest_path_is_dir .git/rebase-apply &&\n+\ttest_cmp_rev lorem2^^ HEAD\n+'\n+\n test_expect_success 'am --resolved works' '\n \techo goodbye >expected &&\n \trm -fr .git/rebase-apply &&\n-- \n2.5.0.rc2.110.gf2a5fc6\n"},{"id":"266380","messageId":"1437320958-11192-6-git-send-email-pyokagan@gmail.com","threadId":"39892","inReplyTo":"1437320958-11192-1-git-send-email-pyokagan@gmail.com","subject":"[PATCH v3 05/12] t4150: am --resolved fails if index has no changes","fromName":"Paul Tan","fromEmail":"pyokagan@gmail.com","sentAt":"2015-07-19T15:49:11Z","receivedAt":"2015-07-19T15:49:11Z","isPatch":true,"sender":{"key":"pyokagan@gmail.com","avatar":"https://avatars.githubusercontent.com/u/109479?v=4"},"body":"Since 6d28644 (git-am: do not allow empty commits by mistake.,\n2006-02-23), git-am --resolved will check to see if the index has any\nchanges to prevent the user from creating an empty commit by mistake.\n\nAdd a test for this.\n\nReviewed-by: Stefan Beller <sbeller@google.com>\nReviewed-by: Johannes Schindelin <johannes.schindelin@gmx.de>\nSigned-off-by: Paul Tan <pyokagan@gmail.com>\n---\n t/t4150-am.sh | 12 ++++++++++++\n 1 file changed, 12 insertions(+)\n\ndiff --git a/t/t4150-am.sh b/t/t4150-am.sh\nindex c350967..430ae71 100755\n--- a/t/t4150-am.sh\n+++ b/t/t4150-am.sh\n@@ -425,6 +425,18 @@ test_expect_success 'am --resolved works' '\n \ttest_cmp expected another\n '\n \n+test_expect_success 'am --resolved fails if index has no changes' '\n+\trm -fr .git/rebase-apply &&\n+\tgit reset --hard &&\n+\tgit checkout lorem2^^ &&\n+\ttest_must_fail git am lorem-move.patch &&\n+\ttest_path_is_dir .git/rebase-apply &&\n+\ttest_cmp_rev lorem2^^ HEAD &&\n+\ttest_must_fail git am --resolved &&\n+\ttest_path_is_dir .git/rebase-apply &&\n+\ttest_cmp_rev lorem2^^ HEAD\n+'\n+\n test_expect_success 'am takes patches from a Pine mailbox' '\n \trm -fr .git/rebase-apply &&\n \tgit reset --hard &&\n-- \n2.5.0.rc2.110.gf2a5fc6\n"},{"id":"266383","messageId":"1437320958-11192-7-git-send-email-pyokagan@gmail.com","threadId":"39892","inReplyTo":"1437320958-11192-1-git-send-email-pyokagan@gmail.com","subject":"[PATCH v3 06/12] t4150: am --resolved fails if index has unmerged entries","fromName":"Paul Tan","fromEmail":"pyokagan@gmail.com","sentAt":"2015-07-19T15:49:12Z","receivedAt":"2015-07-19T15:49:12Z","isPatch":true,"sender":{"key":"pyokagan@gmail.com","avatar":"https://avatars.githubusercontent.com/u/109479?v=4"},"body":"Since c1d1128 (git-am --resolved: more usable error message.,\n2006-04-28), git-am --resolved will check to see if there are any\nunmerged entries, and will error out with a user-friendly error message\nif there are.\n\nAdd a test for this.\n\nReviewed-by: Stefan Beller <sbeller@google.com>\nReviewed-by: Johannes Schindelin <johannes.schindelin@gmx.de>\nSigned-off-by: Paul Tan <pyokagan@gmail.com>\n---\n t/t4150-am.sh | 13 +++++++++++++\n 1 file changed, 13 insertions(+)\n\ndiff --git a/t/t4150-am.sh b/t/t4150-am.sh\nindex 430ae71..c1ec4d5 100755\n--- a/t/t4150-am.sh\n+++ b/t/t4150-am.sh\n@@ -437,6 +437,19 @@ test_expect_success 'am --resolved fails if index has no changes' '\n \ttest_cmp_rev lorem2^^ HEAD\n '\n \n+test_expect_success 'am --resolved fails if index has unmerged entries' '\n+\trm -fr .git/rebase-apply &&\n+\tgit reset --hard &&\n+\tgit checkout second &&\n+\ttest_must_fail git am -3 lorem-move.patch &&\n+\ttest_path_is_dir .git/rebase-apply &&\n+\ttest_cmp_rev second HEAD &&\n+\ttest_must_fail git am --resolved >err &&\n+\ttest_path_is_dir .git/rebase-apply &&\n+\ttest_cmp_rev second HEAD &&\n+\ttest_i18ngrep \"still have unmerged paths\" err\n+'\n+\n test_expect_success 'am takes patches from a Pine mailbox' '\n \trm -fr .git/rebase-apply &&\n \tgit reset --hard &&\n-- \n2.5.0.rc2.110.gf2a5fc6\n"},{"id":"266384","messageId":"1437320958-11192-8-git-send-email-pyokagan@gmail.com","threadId":"39892","inReplyTo":"1437320958-11192-1-git-send-email-pyokagan@gmail.com","subject":"[PATCH v3 07/12] t4150: am with applypatch-msg hook","fromName":"Paul Tan","fromEmail":"pyokagan@gmail.com","sentAt":"2015-07-19T15:49:13Z","receivedAt":"2015-07-19T15:49:13Z","isPatch":true,"sender":{"key":"pyokagan@gmail.com","avatar":"https://avatars.githubusercontent.com/u/109479?v=4"},"body":"Since d1c5f2a (Add git-am, applymbox replacement., 2005-10-07), git-am\nwill invoke the applypatch-msg hooks just after extracting the patch\nmessage. If the applypatch-msg hook exits with a non-zero status, git-am\nabort before even applying the patch to the index.\n\nAdd tests for this hook.\n\nHelped-by: Junio C Hamano <gitster@pobox.com>\nReviewed-by: Stefan Beller <sbeller@google.com>\nReviewed-by: Johannes Schindelin <johannes.schindelin@gmx.de>\nSigned-off-by: Paul Tan <pyokagan@gmail.com>\n---\n t/t4150-am.sh | 35 +++++++++++++++++++++++++++++++++++\n 1 file changed, 35 insertions(+)\n\ndiff --git a/t/t4150-am.sh b/t/t4150-am.sh\nindex c1ec4d5..7878e32 100755\n--- a/t/t4150-am.sh\n+++ b/t/t4150-am.sh\n@@ -199,6 +199,41 @@ test_expect_success 'am applies patch e-mail with preceding whitespace' '\n \ttest \"$(git rev-parse second^)\" = \"$(git rev-parse HEAD^)\"\n '\n \n+test_expect_success 'am with applypatch-msg hook' '\n+\ttest_when_finished \"rm -f .git/hooks/applypatch-msg\" &&\n+\trm -fr .git/rebase-apply &&\n+\tgit reset --hard &&\n+\tgit checkout first &&\n+\tmkdir -p .git/hooks &&\n+\twrite_script .git/hooks/applypatch-msg <<-\\EOF &&\n+\tcat \"$1\" >actual-msg &&\n+\techo hook-message >\"$1\"\n+\tEOF\n+\tgit am patch1 &&\n+\ttest_path_is_missing .git/rebase-apply &&\n+\tgit diff --exit-code second &&\n+\techo hook-message >expected &&\n+\tgit log -1 --format=format:%B >actual &&\n+\ttest_cmp expected actual &&\n+\tgit log -1 --format=format:%B second >expected &&\n+\ttest_cmp expected actual-msg\n+'\n+\n+test_expect_success 'am with failing applypatch-msg hook' '\n+\ttest_when_finished \"rm -f .git/hooks/applypatch-msg\" &&\n+\trm -fr .git/rebase-apply &&\n+\tgit reset --hard &&\n+\tgit checkout first &&\n+\tmkdir -p .git/hooks &&\n+\twrite_script .git/hooks/applypatch-msg <<-\\EOF &&\n+\texit 1\n+\tEOF\n+\ttest_must_fail git am patch1 &&\n+\ttest_path_is_dir .git/rebase-apply &&\n+\tgit diff --exit-code first &&\n+\ttest_cmp_rev first HEAD\n+'\n+\n test_expect_success 'setup: new author and committer' '\n \tGIT_AUTHOR_NAME=\"Another Thor\" &&\n \tGIT_AUTHOR_EMAIL=\"a.thor@example.com\" &&\n-- \n2.5.0.rc2.110.gf2a5fc6\n"},{"id":"266385","messageId":"1437320958-11192-9-git-send-email-pyokagan@gmail.com","threadId":"39892","inReplyTo":"1437320958-11192-1-git-send-email-pyokagan@gmail.com","subject":"[PATCH v3 08/12] t4150: am with pre-applypatch hook","fromName":"Paul Tan","fromEmail":"pyokagan@gmail.com","sentAt":"2015-07-19T15:49:14Z","receivedAt":"2015-07-19T15:49:14Z","isPatch":true,"sender":{"key":"pyokagan@gmail.com","avatar":"https://avatars.githubusercontent.com/u/109479?v=4"},"body":"Since d1c5f2a (Add git-am, applymbox replacement., 2005-10-07),\ngit-am.sg will invoke the pre-applypatch hook after applying the patch\nto the index, but before a commit is made. Should the hook exit with a\nnon-zero status, git am will exit.\n\nAdd tests for this hook.\n\nHelped-by: Junio C Hamano <gitster@pobox.com>\nReviewed-by: Stefan Beller <sbeller@google.com>\nReviewed-by: Johannes Schindelin <johannes.schindelin@gmx.de>\nSigned-off-by: Paul Tan <pyokagan@gmail.com>\n---\n t/t4150-am.sh | 33 +++++++++++++++++++++++++++++++++\n 1 file changed, 33 insertions(+)\n\ndiff --git a/t/t4150-am.sh b/t/t4150-am.sh\nindex 7878e32..957c63c 100755\n--- a/t/t4150-am.sh\n+++ b/t/t4150-am.sh\n@@ -234,6 +234,39 @@ test_expect_success 'am with failing applypatch-msg hook' '\n \ttest_cmp_rev first HEAD\n '\n \n+test_expect_success 'am with pre-applypatch hook' '\n+\ttest_when_finished \"rm -f .git/hooks/pre-applypatch\" &&\n+\trm -fr .git/rebase-apply &&\n+\tgit reset --hard &&\n+\tgit checkout first &&\n+\tmkdir -p .git/hooks &&\n+\twrite_script .git/hooks/pre-applypatch <<-\\EOF &&\n+\tgit diff first >diff.actual\n+\texit 0\n+\tEOF\n+\tgit am patch1 &&\n+\ttest_path_is_missing .git/rebase-apply &&\n+\tgit diff --exit-code second &&\n+\ttest_cmp_rev second HEAD &&\n+\tgit diff first..second >diff.expected &&\n+\ttest_cmp diff.expected diff.actual\n+'\n+\n+test_expect_success 'am with failing pre-applypatch hook' '\n+\ttest_when_finished \"rm -f .git/hooks/pre-applypatch\" &&\n+\trm -fr .git/rebase-apply &&\n+\tgit reset --hard &&\n+\tgit checkout first &&\n+\tmkdir -p .git/hooks &&\n+\twrite_script .git/hooks/pre-applypatch <<-\\EOF &&\n+\texit 1\n+\tEOF\n+\ttest_must_fail git am patch1 &&\n+\ttest_path_is_dir .git/rebase-apply &&\n+\tgit diff --exit-code second &&\n+\ttest_cmp_rev first HEAD\n+'\n+\n test_expect_success 'setup: new author and committer' '\n \tGIT_AUTHOR_NAME=\"Another Thor\" &&\n \tGIT_AUTHOR_EMAIL=\"a.thor@example.com\" &&\n-- \n2.5.0.rc2.110.gf2a5fc6\n"},{"id":"266386","messageId":"1437320958-11192-10-git-send-email-pyokagan@gmail.com","threadId":"39892","inReplyTo":"1437320958-11192-1-git-send-email-pyokagan@gmail.com","subject":"[PATCH v3 09/12] t4150: am with post-applypatch hook","fromName":"Paul Tan","fromEmail":"pyokagan@gmail.com","sentAt":"2015-07-19T15:49:15Z","receivedAt":"2015-07-19T15:49:15Z","isPatch":true,"sender":{"key":"pyokagan@gmail.com","avatar":"https://avatars.githubusercontent.com/u/109479?v=4"},"body":"Since d1c5f2a (Add git-am, applymbox replacement., 2005-10-07),\ngit-am.sh will invoke the post-applypatch hook after the patch is\napplied and a commit is made. The exit code of the hook is ignored.\n\nAdd tests for this hook.\n\nHelped-by: Junio C Hamano <gitster@pobox.com>\nReviewed-by: Stefan Beller <sbeller@google.com>\nReviewed-by: Johannes Schindelin <johannes.schindelin@gmx.de>\nSigned-off-by: Paul Tan <pyokagan@gmail.com>\n---\n t/t4150-am.sh | 38 ++++++++++++++++++++++++++++++++++++++\n 1 file changed, 38 insertions(+)\n\ndiff --git a/t/t4150-am.sh b/t/t4150-am.sh\nindex 957c63c..7494240 100755\n--- a/t/t4150-am.sh\n+++ b/t/t4150-am.sh\n@@ -267,6 +267,44 @@ test_expect_success 'am with failing pre-applypatch hook' '\n \ttest_cmp_rev first HEAD\n '\n \n+test_expect_success 'am with post-applypatch hook' '\n+\ttest_when_finished \"rm -f .git/hooks/post-applypatch\" &&\n+\trm -fr .git/rebase-apply &&\n+\tgit reset --hard &&\n+\tgit checkout first &&\n+\tmkdir -p .git/hooks &&\n+\twrite_script .git/hooks/post-applypatch <<-\\EOF &&\n+\tgit rev-parse HEAD >head.actual\n+\tgit diff second >diff.actual\n+\texit 0\n+\tEOF\n+\tgit am patch1 &&\n+\ttest_path_is_missing .git/rebase-apply &&\n+\ttest_cmp_rev second HEAD &&\n+\tgit rev-parse second >head.expected &&\n+\ttest_cmp head.expected head.actual &&\n+\tgit diff second >diff.expected &&\n+\ttest_cmp diff.expected diff.actual\n+'\n+\n+test_expect_success 'am with failing post-applypatch hook' '\n+\ttest_when_finished \"rm -f .git/hooks/post-applypatch\" &&\n+\trm -fr .git/rebase-apply &&\n+\tgit reset --hard &&\n+\tgit checkout first &&\n+\tmkdir -p .git/hooks &&\n+\twrite_script .git/hooks/post-applypatch <<-\\EOF &&\n+\tgit rev-parse HEAD >head.actual\n+\texit 1\n+\tEOF\n+\tgit am patch1 &&\n+\ttest_path_is_missing .git/rebase-apply &&\n+\tgit diff --exit-code second &&\n+\ttest_cmp_rev second HEAD &&\n+\tgit rev-parse second >head.expected &&\n+\ttest_cmp head.expected head.actual\n+'\n+\n test_expect_success 'setup: new author and committer' '\n \tGIT_AUTHOR_NAME=\"Another Thor\" &&\n \tGIT_AUTHOR_EMAIL=\"a.thor@example.com\" &&\n-- \n2.5.0.rc2.110.gf2a5fc6\n"},{"id":"266387","messageId":"1437320958-11192-11-git-send-email-pyokagan@gmail.com","threadId":"39892","inReplyTo":"1437320958-11192-1-git-send-email-pyokagan@gmail.com","subject":"[PATCH v3 10/12] t4150: tests for am --[no-]scissors","fromName":"Paul Tan","fromEmail":"pyokagan@gmail.com","sentAt":"2015-07-19T15:49:16Z","receivedAt":"2015-07-19T15:49:16Z","isPatch":true,"sender":{"key":"pyokagan@gmail.com","avatar":"https://avatars.githubusercontent.com/u/109479?v=4"},"body":"Since 017678b (am/mailinfo: Disable scissors processing by default,\n2009-08-26), git-am supported the --[no-]scissors option, passing it to\ngit-mailinfo.\n\nAdd tests to ensure that git-am will pass the --scissors option to\ngit-mailinfo, and that --no-scissors will override the configuration\nsetting of mailinfo.scissors.\n\nReviewed-by: Stefan Beller <sbeller@google.com>\nReviewed-by: Johannes Schindelin <johannes.schindelin@gmx.de>\nSigned-off-by: Paul Tan <pyokagan@gmail.com>\n---\n t/t4150-am.sh | 48 ++++++++++++++++++++++++++++++++++++++++++++++++\n 1 file changed, 48 insertions(+)\n\ndiff --git a/t/t4150-am.sh b/t/t4150-am.sh\nindex 7494240..67fbf0e 100755\n--- a/t/t4150-am.sh\n+++ b/t/t4150-am.sh\n@@ -67,6 +67,19 @@ test_expect_success 'setup: messages' '\n \n \tEOF\n \n+\tcat >scissors-msg <<-\\EOF &&\n+\tTest git-am with scissors line\n+\n+\tThis line should be included in the commit message.\n+\tEOF\n+\n+\tcat - scissors-msg >no-scissors-msg <<-\\EOF &&\n+\tThis line should not be included in the commit message with --scissors enabled.\n+\n+\t - - >8 - - remove everything above this line - - >8 - -\n+\n+\tEOF\n+\n \tsignoff=\"Signed-off-by: $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL>\"\n '\n \n@@ -105,6 +118,20 @@ test_expect_success setup '\n \t\tgit format-patch --stdout first | sed -e \"1d\"\n \t} > patch1-ws.eml &&\n \n+\techo scissors-file >scissors-file &&\n+\tgit add scissors-file &&\n+\tgit commit -F scissors-msg &&\n+\tgit tag scissors &&\n+\tgit format-patch --stdout scissors^ >scissors-patch.eml &&\n+\tgit reset --hard HEAD^ &&\n+\n+\techo no-scissors-file >no-scissors-file &&\n+\tgit add no-scissors-file &&\n+\tgit commit -F no-scissors-msg &&\n+\tgit tag no-scissors &&\n+\tgit format-patch --stdout no-scissors^ >no-scissors-patch.eml &&\n+\tgit reset --hard HEAD^ &&\n+\n \tsed -n -e \"3,\\$p\" msg >file &&\n \tgit add file &&\n \ttest_tick &&\n@@ -305,6 +332,27 @@ test_expect_success 'am with failing post-applypatch hook' '\n \ttest_cmp head.expected head.actual\n '\n \n+test_expect_success 'am --scissors cuts the message at the scissors line' '\n+\trm -fr .git/rebase-apply &&\n+\tgit reset --hard &&\n+\tgit checkout second &&\n+\tgit am --scissors scissors-patch.eml &&\n+\ttest_path_is_missing .git/rebase-apply &&\n+\tgit diff --exit-code scissors &&\n+\ttest_cmp_rev scissors HEAD\n+'\n+\n+test_expect_success 'am --no-scissors overrides mailinfo.scissors' '\n+\trm -fr .git/rebase-apply &&\n+\tgit reset --hard &&\n+\tgit checkout second &&\n+\ttest_config mailinfo.scissors true &&\n+\tgit am --no-scissors no-scissors-patch.eml &&\n+\ttest_path_is_missing .git/rebase-apply &&\n+\tgit diff --exit-code no-scissors &&\n+\ttest_cmp_rev no-scissors HEAD\n+'\n+\n test_expect_success 'setup: new author and committer' '\n \tGIT_AUTHOR_NAME=\"Another Thor\" &&\n \tGIT_AUTHOR_EMAIL=\"a.thor@example.com\" &&\n-- \n2.5.0.rc2.110.gf2a5fc6\n"},{"id":"266388","messageId":"1437320958-11192-12-git-send-email-pyokagan@gmail.com","threadId":"39892","inReplyTo":"1437320958-11192-1-git-send-email-pyokagan@gmail.com","subject":"[PATCH v3 11/12] t3418: non-interactive rebase --continue with rerere enabled","fromName":"Paul Tan","fromEmail":"pyokagan@gmail.com","sentAt":"2015-07-19T15:49:17Z","receivedAt":"2015-07-19T15:49:17Z","isPatch":true,"sender":{"key":"pyokagan@gmail.com","avatar":"https://avatars.githubusercontent.com/u/109479?v=4"},"body":"Since 8389b52 (git-rerere: reuse recorded resolve., 2006-01-28), git-am\nwill call git-rerere to re-use recorded merge conflict resolutions if\nany occur in a threeway merge.\n\nAdd a test to ensure that git-rerere is called by git-am (which handles\nthe non-interactive rebase).\n\nReviewed-by: Stefan Beller <sbeller@google.com>\nReviewed-by: Johannes Schindelin <johannes.schindelin@gmx.de>\nSigned-off-by: Paul Tan <pyokagan@gmail.com>\n---\n t/t3418-rebase-continue.sh | 19 +++++++++++++++++++\n 1 file changed, 19 insertions(+)\n\ndiff --git a/t/t3418-rebase-continue.sh b/t/t3418-rebase-continue.sh\nindex 2680375..4428b90 100755\n--- a/t/t3418-rebase-continue.sh\n+++ b/t/t3418-rebase-continue.sh\n@@ -40,6 +40,25 @@ test_expect_success 'non-interactive rebase --continue works with touched file'\n \tgit rebase --continue\n '\n \n+test_expect_success 'non-interactive rebase --continue with rerere enabled' '\n+\ttest_config rerere.enabled true &&\n+\ttest_when_finished \"test_might_fail git rebase --abort\" &&\n+\tgit reset --hard commit-new-file-F2-on-topic-branch &&\n+\tgit checkout master &&\n+\trm -fr .git/rebase-* &&\n+\n+\ttest_must_fail git rebase --onto master master topic &&\n+\techo \"Resolved\" >F2 &&\n+\tgit add F2 &&\n+\tcp F2 F2.expected &&\n+\tgit rebase --continue &&\n+\n+\tgit reset --hard commit-new-file-F2-on-topic-branch &&\n+\tgit checkout master &&\n+\ttest_must_fail git rebase --onto master master topic &&\n+\ttest_cmp F2.expected F2\n+'\n+\n test_expect_success 'rebase --continue can not be used with other options' '\n \ttest_must_fail git rebase -v --continue &&\n \ttest_must_fail git rebase --continue -v\n-- \n2.5.0.rc2.110.gf2a5fc6\n"},{"id":"266389","messageId":"1437320958-11192-13-git-send-email-pyokagan@gmail.com","threadId":"39892","inReplyTo":"1437320958-11192-1-git-send-email-pyokagan@gmail.com","subject":"[PATCH v3 12/12] t3901: test git-am encoding conversion","fromName":"Paul Tan","fromEmail":"pyokagan@gmail.com","sentAt":"2015-07-19T15:49:18Z","receivedAt":"2015-07-19T15:49:18Z","isPatch":true,"sender":{"key":"pyokagan@gmail.com","avatar":"https://avatars.githubusercontent.com/u/109479?v=4"},"body":"Since d1c5f2a (Add git-am, applymbox replacement., 2005-10-07), git-am\nsupported the --utf8 and --no-utf8 options, and if set, would pass the\n-u flag and the -k flag respectively.\n\ngit mailinfo -u will re-code the commit log message and authorship info\nin the charset specified by i18n.commitencoding setting, while\ngit mailinfo -n will disable the re-coding.\n\nSince d84029b (--utf8 is now default for 'git-am', 2007-01-08), --utf8\nis set by default in git-am.\n\nAdd various encoding conversion tests to t3901 to test git-mailinfo's\nencoding conversion. In addition, add a test for --no-utf8 to check that\nno encoding conversion will occur if that option is set.\n\nHelped-by: Johannes Sixt <j6t@kdbg.org>\nReviewed-by: Stefan Beller <sbeller@google.com>\nReviewed-by: Johannes Schindelin <johannes.schindelin@gmx.de>\nSigned-off-by: Paul Tan <pyokagan@gmail.com>\n---\n\nNotes:\n    v3\n    \n    * Added !MINGW prereq for the other test case that uses ISO-8859-1\n      encoded environment vars\n\n t/t3901-i18n-patch.sh | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++\n 1 file changed, 62 insertions(+)\n\ndiff --git a/t/t3901-i18n-patch.sh b/t/t3901-i18n-patch.sh\nindex 75cf3ff..509084e 100755\n--- a/t/t3901-i18n-patch.sh\n+++ b/t/t3901-i18n-patch.sh\n@@ -251,4 +251,66 @@ test_expect_success 'rebase --merge (L/U)' '\n \tcheck_encoding 2 8859\n '\n \n+test_expect_success 'am (U/U)' '\n+\t# Apply UTF-8 patches with UTF-8 commitencoding\n+\tgit config i18n.commitencoding UTF-8 &&\n+\t. \"$TEST_DIRECTORY\"/t3901-utf8.txt &&\n+\n+\tgit reset --hard master &&\n+\tgit am out-u1 out-u2 &&\n+\n+\tcheck_encoding 2\n+'\n+\n+test_expect_success !MINGW 'am (L/L)' '\n+\t# Apply ISO-8859-1 patches with ISO-8859-1 commitencoding\n+\tgit config i18n.commitencoding ISO8859-1 &&\n+\t. \"$TEST_DIRECTORY\"/t3901-8859-1.txt &&\n+\n+\tgit reset --hard master &&\n+\tgit am out-l1 out-l2 &&\n+\n+\tcheck_encoding 2 8859\n+'\n+\n+test_expect_success 'am (U/L)' '\n+\t# Apply ISO-8859-1 patches with UTF-8 commitencoding\n+\tgit config i18n.commitencoding UTF-8 &&\n+\t. \"$TEST_DIRECTORY\"/t3901-utf8.txt &&\n+\tgit reset --hard master &&\n+\n+\t# am specifies --utf8 by default.\n+\tgit am out-l1 out-l2 &&\n+\n+\tcheck_encoding 2\n+'\n+\n+test_expect_success 'am --no-utf8 (U/L)' '\n+\t# Apply ISO-8859-1 patches with UTF-8 commitencoding\n+\tgit config i18n.commitencoding UTF-8 &&\n+\t. \"$TEST_DIRECTORY\"/t3901-utf8.txt &&\n+\n+\tgit reset --hard master &&\n+\tgit am --no-utf8 out-l1 out-l2 2>err &&\n+\n+\t# commit-tree will warn that the commit message does not contain valid UTF-8\n+\t# as mailinfo did not convert it\n+\tgrep \"did not conform\" err &&\n+\n+\tcheck_encoding 2\n+'\n+\n+test_expect_success !MINGW 'am (L/U)' '\n+\t# Apply UTF-8 patches with ISO-8859-1 commitencoding\n+\tgit config i18n.commitencoding ISO8859-1 &&\n+\t. \"$TEST_DIRECTORY\"/t3901-8859-1.txt &&\n+\n+\tgit reset --hard master &&\n+\t# mailinfo will re-code the commit message to the charset specified by\n+\t# i18n.commitencoding\n+\tgit am out-u1 out-u2 &&\n+\n+\tcheck_encoding 2 8859\n+'\n+\n test_done\n-- \n2.5.0.rc2.110.gf2a5fc6\n"}]}