{"thread":{"id":"38045","subject":"[PATCH 0/2] git-am: add --message-id/--no-message-id options","startedAt":"2014-11-25T14:00:54Z","lastAt":"2014-11-27T00:23:55Z","messageCount":13,"participants":["Paolo Bonzini","Christian Couder","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"252518","messageId":"1416924056-29993-1-git-send-email-bonzini@gnu.org","threadId":"38045","inReplyTo":null,"subject":"[PATCH 0/2] git-am: add --message-id/--no-message-id options","fromName":"Paolo Bonzini","fromEmail":"bonzini@gnu.org","sentAt":"2014-11-25T14:00:54Z","receivedAt":"2014-11-25T14:00:54Z","isPatch":true,"sender":{"key":"bonzini@gnu.org","avatar":"https://avatars.githubusercontent.com/u/42082?v=4"},"body":"From: Paolo Bonzini <pbonzini@redhat.com>\n\nThis series adds a --message-id option to git-mailinfo and git-am.\ngit-am also gets an am.messageid configuration key to set the default,\nand a --no-message-id option to override the configuration key.\n(I'm not sure of the usefulness of a mailinfo.messageid option, so\nI left it out; this follows the example of -k instead of --scissors).\n\nThis option can be useful in order to associate commit messages with\nmailing list discussions.\n\nIf both --message-id and -s are specified, the Signed-off-by goes\nlast.  This is coming out more or less naturally out of the git-am\nimplementation, but is also tested in t4150-am.sh.\n\nPaolo Bonzini (2):\n  git-mailinfo: add --message-id\n  git-am: add --message-id/--no-message-id\n\n Documentation/git-am.txt       | 11 +++++++++++\n Documentation/git-mailinfo.txt |  5 +++++\n builtin/mailinfo.c             | 22 +++++++++++++++++++++-\n git-am.sh                      | 21 +++++++++++++++++++--\n t/t4150-am.sh                  | 23 +++++++++++++++++++++++\n t/t5100-mailinfo.sh            |  4 ++++\n t/t5100/info0012--message-id   |  5 +++++\n t/t5100/msg0012--message-id    |  8 ++++++++\n t/t5100/patch0012--message-id  | 30 ++++++++++++++++++++++++++++++\n 9 files changed, 126 insertions(+), 3 deletions(-)\n create mode 100644 t/t5100/info0012--message-id\n create mode 100644 t/t5100/msg0012--message-id\n create mode 100644 t/t5100/patch0012--message-id\n\n-- \n2.1.0\n"},{"id":"252519","messageId":"1416924056-29993-2-git-send-email-bonzini@gnu.org","threadId":"38045","inReplyTo":"1416924056-29993-1-git-send-email-bonzini@gnu.org","subject":"[PATCH 1/2] git-mailinfo: add --message-id","fromName":"Paolo Bonzini","fromEmail":"bonzini@gnu.org","sentAt":"2014-11-25T14:00:55Z","receivedAt":"2014-11-25T14:00:55Z","isPatch":true,"sender":{"key":"bonzini@gnu.org","avatar":"https://avatars.githubusercontent.com/u/42082?v=4"},"body":"From: Paolo Bonzini <pbonzini@redhat.com>\n\nThis option adds the content of the Message-Id header at the end of the\ncommit message prepared by git-mailinfo.  This is useful in order to\nassociate commit messages automatically with mailing list discussions.\n\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>\n---\n Documentation/git-mailinfo.txt |  5 +++++\n builtin/mailinfo.c             | 22 +++++++++++++++++++++-\n t/t5100-mailinfo.sh            |  4 ++++\n t/t5100/info0012--message-id   |  5 +++++\n t/t5100/msg0012--message-id    |  8 ++++++++\n t/t5100/patch0012--message-id  | 30 ++++++++++++++++++++++++++++++\n 6 files changed, 73 insertions(+), 1 deletion(-)\n create mode 100644 t/t5100/info0012--message-id\n create mode 100644 t/t5100/msg0012--message-id\n create mode 100644 t/t5100/patch0012--message-id\n\ndiff --git a/Documentation/git-mailinfo.txt b/Documentation/git-mailinfo.txt\nindex 164a3c6..2e99603 100644\n--- a/Documentation/git-mailinfo.txt\n+++ b/Documentation/git-mailinfo.txt\n@@ -66,6 +66,11 @@ conversion, even with this flag.\n -n::\n \tDisable all charset re-coding of the metadata.\n \n+-m::\n+--message-id::\n+\tCopy the Message-ID header at the end of the commit message.  This \n+\tis useful in order to associate commits with mailing list discussions.\n+\n --scissors::\n \tRemove everything in body before a scissors line.  A line that\n \tmainly consists of scissors (either \">8\" or \"8<\") and perforation\ndiff --git a/builtin/mailinfo.c b/builtin/mailinfo.c\nindex 6a14d29..c8a47c1 100644\n--- a/builtin/mailinfo.c\n+++ b/builtin/mailinfo.c\n@@ -15,6 +15,7 @@ static const char *metainfo_charset;\n static struct strbuf line = STRBUF_INIT;\n static struct strbuf name = STRBUF_INIT;\n static struct strbuf email = STRBUF_INIT;\n+static char *message_id;\n \n static enum  {\n \tTE_DONTCARE, TE_QP, TE_BASE64\n@@ -24,6 +25,7 @@ static struct strbuf charset = STRBUF_INIT;\n static int patch_lines;\n static struct strbuf **p_hdr_data, **s_hdr_data;\n static int use_scissors;\n+static int add_message_id;\n static int use_inbody_headers = 1;\n \n #define MAX_HDR_PARSED 10\n@@ -198,6 +200,12 @@ static void handle_content_type(struct strbuf *line)\n \t}\n }\n \n+static void handle_message_id(const struct strbuf *line)\n+{\n+\tif (add_message_id)\n+\t\tmessage_id = strdup(line->buf);\n+}\n+\n static void handle_content_transfer_encoding(const struct strbuf *line)\n {\n \tif (strcasestr(line->buf, \"base64\"))\n@@ -342,6 +350,14 @@ static int check_header(const struct strbuf *line,\n \t\tret = 1;\n \t\tgoto check_header_out;\n \t}\n+\tif (cmp_header(line, \"Message-Id\")) {\n+\t\tlen = strlen(\"Message-Id: \");\n+\t\tstrbuf_add(&sb, line->buf + len, line->len - len);\n+\t\tdecode_header(&sb);\n+\t\thandle_message_id(&sb);\n+\t\tret = 1;\n+\t\tgoto check_header_out;\n+\t}\n \n \t/* for inbody stuff */\n \tif (starts_with(line->buf, \">From\") && isspace(line->buf[5])) {\n@@ -816,6 +832,8 @@ static int handle_commit_msg(struct strbuf *line)\n \t}\n \n \tif (patchbreak(line)) {\n+\t\tif (message_id)\n+\t\t\tfprintf(cmitmsg, \"Message-Id: %s\\n\", message_id);\n \t\tfclose(cmitmsg);\n \t\tcmitmsg = NULL;\n \t\treturn 1;\n@@ -1013,7 +1031,7 @@ static int git_mailinfo_config(const char *var, const char *value, void *unused)\n }\n \n static const char mailinfo_usage[] =\n-\t\"git mailinfo [-k|-b] [-u | --encoding=<encoding> | -n] [--scissors | --no-scissors] msg patch < mail >info\";\n+\t\"git mailinfo [-k|-b] [-m | --message-id] [-u | --encoding=<encoding> | -n] [--scissors | --no-scissors] msg patch < mail >info\";\n \n int cmd_mailinfo(int argc, const char **argv, const char *prefix)\n {\n@@ -1032,6 +1050,8 @@ int cmd_mailinfo(int argc, const char **argv, const char *prefix)\n \t\t\tkeep_subject = 1;\n \t\telse if (!strcmp(argv[1], \"-b\"))\n \t\t\tkeep_non_patch_brackets_in_subject = 1;\n+\t\telse if (!strcmp(argv[1], \"-m\") || !strcmp(argv[1], \"--message-id\"))\n+\t\t\tadd_message_id = 1;\n \t\telse if (!strcmp(argv[1], \"-u\"))\n \t\t\tmetainfo_charset = def_charset;\n \t\telse if (!strcmp(argv[1], \"-n\"))\ndiff --git a/t/t5100-mailinfo.sh b/t/t5100-mailinfo.sh\nindex 9e1ad1c..60df10f 100755\n--- a/t/t5100-mailinfo.sh\n+++ b/t/t5100-mailinfo.sh\n@@ -35,6 +35,10 @@ do\n \t\tthen\n \t\t\tcheck_mailinfo $mail --no-inbody-headers\n \t\tfi\n+\t\tif test -f \"$TEST_DIRECTORY\"/t5100/msg$mail--message-id\n+\t\tthen\n+\t\t\tcheck_mailinfo $mail --message-id\n+\t\tfi\n \t'\n done\n \ndiff --git a/t/t5100/info0012--message-id b/t/t5100/info0012--message-id\nnew file mode 100644\nindex 0000000..ac1216f\n--- /dev/null\n+++ b/t/t5100/info0012--message-id\n@@ -0,0 +1,5 @@\n+Author: Dmitriy Blinov\n+Email: bda@mnsspb.ru\n+Subject: Изменён список пакетов необходимых для сборки\n+Date: Wed, 12 Nov 2008 17:54:41 +0300\n+\ndiff --git a/t/t5100/msg0012--message-id b/t/t5100/msg0012--message-id\nnew file mode 100644\nindex 0000000..376e26e\n--- /dev/null\n+++ b/t/t5100/msg0012--message-id\n@@ -0,0 +1,8 @@\n+textlive-* исправлены на texlive-*\n+docutils заменён на python-docutils\n+\n+Действительно, оказалось, что rest2web вытягивает за собой\n+python-docutils. В то время как сам rest2web не нужен.\n+\n+Signed-off-by: Dmitriy Blinov <bda@mnsspb.ru>\n+Message-Id: <1226501681-24923-1-git-send-email-bda@mnsspb.ru>\ndiff --git a/t/t5100/patch0012--message-id b/t/t5100/patch0012--message-id\nnew file mode 100644\nindex 0000000..36a0b68\n--- /dev/null\n+++ b/t/t5100/patch0012--message-id\n@@ -0,0 +1,30 @@\n+---\n+ howto/build_navy.txt |    6 +++---\n+ 1 files changed, 3 insertions(+), 3 deletions(-)\n+\n+diff --git a/howto/build_navy.txt b/howto/build_navy.txt\n+index 3fd3afb..0ee807e 100644\n+--- a/howto/build_navy.txt\n++++ b/howto/build_navy.txt\n+@@ -119,8 +119,8 @@\n+    - libxv-dev\n+    - libusplash-dev\n+    - latex-make\n+-   - textlive-lang-cyrillic\n+-   - textlive-latex-extra\n++   - texlive-lang-cyrillic\n++   - texlive-latex-extra\n+    - dia\n+    - python-pyrex\n+    - libtool\n+@@ -128,7 +128,7 @@\n+    - sox\n+    - cython\n+    - imagemagick\n+-   - docutils\n++   - python-docutils\n+ \n+ #. на машине dinar: добавить свой открытый ssh-ключ в authorized_keys2 пользователя ddev\n+ #. на своей машине: отредактировать /etc/sudoers (команда ``visudo``) примерно следующим образом::\n+-- \n+1.5.6.5\n-- \n2.1.0\n"},{"id":"252520","messageId":"1416924056-29993-3-git-send-email-bonzini@gnu.org","threadId":"38045","inReplyTo":"1416924056-29993-1-git-send-email-bonzini@gnu.org","subject":"[PATCH 2/2] git-am: add --message-id/--no-message-id","fromName":"Paolo Bonzini","fromEmail":"bonzini@gnu.org","sentAt":"2014-11-25T14:00:56Z","receivedAt":"2014-11-25T14:00:56Z","isPatch":true,"sender":{"key":"bonzini@gnu.org","avatar":"https://avatars.githubusercontent.com/u/42082?v=4"},"body":"From: Paolo Bonzini <pbonzini@redhat.com>\n\nParse the option and pass it directly to git-mailinfo.\n\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>\n---\n Documentation/git-am.txt | 11 +++++++++++\n git-am.sh                | 21 +++++++++++++++++++--\n t/t4150-am.sh            | 23 +++++++++++++++++++++++\n 3 files changed, 53 insertions(+), 2 deletions(-)\n\ndiff --git a/Documentation/git-am.txt b/Documentation/git-am.txt\nindex 9adce37..cfb74bc 100644\n--- a/Documentation/git-am.txt\n+++ b/Documentation/git-am.txt\n@@ -57,6 +57,17 @@ OPTIONS\n --no-scissors::\n \tIgnore scissors lines (see linkgit:git-mailinfo[1]).\n \n+-m::\n+--message-id::\n+\tPass the `-m` flag to 'git mailinfo' (see linkgit:git-mailinfo[1]),\n+\tso that the Message-ID header is added to the commit message.\n+\tThe `am.messageid` configuration variable can be used to specify\n+\tthe default behaviour.\n+\n+--no-message-id::\n+\tDo not add the Message-ID header to the commit message.\n+\t`no-message-id` is useful to override `am.messageid`.\n+\n -q::\n --quiet::\n \tBe quiet. Only print error messages.\ndiff --git a/git-am.sh b/git-am.sh\nindex ee61a77..c92632f 100755\n--- a/git-am.sh\n+++ b/git-am.sh\n@@ -17,6 +17,7 @@ s,signoff       add a Signed-off-by line to the commit message\n u,utf8          recode into utf8 (default)\n k,keep          pass -k flag to git-mailinfo\n keep-non-patch  pass -b flag to git-mailinfo\n+m,message-id    pass -m flag to git-mailinfo\n keep-cr         pass --keep-cr flag to git-mailsplit for mbox format\n no-keep-cr      do not pass --keep-cr flag to git-mailsplit independent of am.keepcr\n c,scissors      strip everything before a scissors line\n@@ -371,13 +372,18 @@ split_patches () {\n prec=4\n dotest=\"$GIT_DIR/rebase-apply\"\n sign= utf8=t keep= keepcr= skip= interactive= resolved= rebasing= abort=\n-resolvemsg= resume= scissors= no_inbody_headers=\n+messageid= resolvemsg= resume= scissors= no_inbody_headers=\n git_apply_opt=\n committer_date_is_author_date=\n ignore_date=\n allow_rerere_autoupdate=\n gpg_sign_opt=\n \n+if test \"$(git config --bool --get am.messageid)\" = true\n+then\n+    messageid=t\n+fi\n+\n if test \"$(git config --bool --get am.keepcr)\" = true\n then\n     keepcr=t\n@@ -400,6 +406,10 @@ it will be removed. Please do not use it anymore.\"\n \t\tutf8=t ;; # this is now default\n \t--no-utf8)\n \t\tutf8= ;;\n+\t-m|--message-id)\n+\t\tmessageid=t ;;\n+\t--no-message-id)\n+\t\tmessageid=f ;;\n \t-k|--keep)\n \t\tkeep=t ;;\n \t--keep-non-patch)\n@@ -567,6 +577,7 @@ Use \\\"git am --abort\\\" to remove it.\")\"\n \techo \"$sign\" >\"$dotest/sign\"\n \techo \"$utf8\" >\"$dotest/utf8\"\n \techo \"$keep\" >\"$dotest/keep\"\n+\techo \"$messageid\" >\"$dotest/messageid\"\n \techo \"$scissors\" >\"$dotest/scissors\"\n \techo \"$no_inbody_headers\" >\"$dotest/no_inbody_headers\"\n \techo \"$GIT_QUIET\" >\"$dotest/quiet\"\n@@ -621,6 +632,12 @@ b)\n *)\n \tkeep= ;;\n esac\n+case \"$(cat \"$dotest/messageid\")\" in\n+t)\n+\tmessageid=-m ;;\n+f)\n+\tmessageid= ;;\n+esac\n case \"$(cat \"$dotest/scissors\")\" in\n t)\n \tscissors=--scissors ;;\n@@ -692,7 +709,7 @@ do\n \t\t\tget_author_ident_from_commit \"$commit\" >\"$dotest/author-script\"\n \t\t\tgit diff-tree --root --binary --full-index \"$commit\" >\"$dotest/patch\"\n \t\telse\n-\t\t\tgit mailinfo $keep $no_inbody_headers $scissors $utf8 \"$dotest/msg\" \"$dotest/patch\" \\\n+\t\t\tgit mailinfo $keep $no_inbody_headers $messageid $scissors $utf8 \"$dotest/msg\" \"$dotest/patch\" \\\n \t\t\t\t<\"$dotest/$msgnum\" >\"$dotest/info\" ||\n \t\t\t\tstop_here $this\n \ndiff --git a/t/t4150-am.sh b/t/t4150-am.sh\nindex 5edb79a..306e6f3 100755\n--- a/t/t4150-am.sh\n+++ b/t/t4150-am.sh\n@@ -85,6 +85,7 @@ test_expect_success setup '\n \n \tgit format-patch --stdout first >patch1 &&\n \t{\n+\t\techo \"Message-Id: <1226501681-24923-1-git-send-email-bda@mnsspb.ru>\" &&\n \t\techo \"X-Fake-Field: Line One\" &&\n \t\techo \"X-Fake-Field: Line Two\" &&\n \t\techo \"X-Fake-Field: Line Three\" &&\n@@ -536,4 +537,26 @@ test_expect_success 'am empty-file does not infloop' '\n \ttest_i18ncmp expected actual\n '\n \n+test_expect_success 'am --message-id really adds the message id' '\n+\trm -fr .git/rebase-apply &&\n+\tgit reset --hard &&\n+\tgit checkout HEAD^ &&\n+\tgit am --message-id 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+\tgit checkout HEAD^ &&\n+\tgit am -s --message-id patch1.eml &&\n+\ttest_path_is_missing .git/rebase-apply &&\n+\tgit cat-file commit HEAD | tail -n2 | head -n1 >actual &&\n+\tgrep Message-Id patch1.eml >expected &&\n+\ttest_cmp expected actual\n+'\n+\n test_done\n-- \n2.1.0\n"},{"id":"252523","messageId":"CAP8UFD0+Ef9JbbkZ+LBHcD6DVZiMGxFdrMnjLEViHHMERY5wuw@mail.gmail.com","threadId":"38045","inReplyTo":"1416924056-29993-1-git-send-email-bonzini@gnu.org","subject":"Re: [PATCH 0/2] git-am: add --message-id/--no-message-id options","fromName":"Christian Couder","fromEmail":"christian.couder@gmail.com","sentAt":"2014-11-25T16:27:34Z","receivedAt":"2014-11-25T16:27:34Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"On Tue, Nov 25, 2014 at 3:00 PM, Paolo Bonzini <bonzini@gnu.org> wrote:\n> From: Paolo Bonzini <pbonzini@redhat.com>\n>\n> This series adds a --message-id option to git-mailinfo and git-am.\n> git-am also gets an am.messageid configuration key to set the default,\n> and a --no-message-id option to override the configuration key.\n> (I'm not sure of the usefulness of a mailinfo.messageid option, so\n> I left it out; this follows the example of -k instead of --scissors).\n>\n> This option can be useful in order to associate commit messages with\n> mailing list discussions.\n>\n> If both --message-id and -s are specified, the Signed-off-by goes\n> last.  This is coming out more or less naturally out of the git-am\n> implementation, but is also tested in t4150-am.sh.\n\nDid you have a look at git interpret-trailers currently in master?\n\nBest,\nChristian.\n"},{"id":"252524","messageId":"5474B5EE.1030406@redhat.com","threadId":"38045","inReplyTo":"CAP8UFD0+Ef9JbbkZ+LBHcD6DVZiMGxFdrMnjLEViHHMERY5wuw@mail.gmail.com","subject":"Re: [PATCH 0/2] git-am: add --message-id/--no-message-id options","fromName":"Paolo Bonzini","fromEmail":"pbonzini@redhat.com","sentAt":"2014-11-25T17:01:34Z","receivedAt":"2014-11-25T17:01:34Z","isPatch":true,"sender":{"key":"pbonzini@redhat.com","avatar":"https://avatars.githubusercontent.com/u/42082?v=4"},"body":"\n\nOn 25/11/2014 17:27, Christian Couder wrote:\n>> > From: Paolo Bonzini <pbonzini@redhat.com>\n>> >\n>> > This series adds a --message-id option to git-mailinfo and git-am.\n>> > git-am also gets an am.messageid configuration key to set the default,\n>> > and a --no-message-id option to override the configuration key.\n>> > (I'm not sure of the usefulness of a mailinfo.messageid option, so\n>> > I left it out; this follows the example of -k instead of --scissors).\n>> >\n>> > This option can be useful in order to associate commit messages with\n>> > mailing list discussions.\n>> >\n>> > If both --message-id and -s are specified, the Signed-off-by goes\n>> > last.  This is coming out more or less naturally out of the git-am\n>> > implementation, but is also tested in t4150-am.sh.\n> Did you have a look at git interpret-trailers currently in master?\n\nHmm, now I have.\n\nAs far as I understand, all the git-am hooks are called on the commit\nrather than the incoming email: all headers are lost by the time\ngit-mailinfo exits, including the Message-Id.  And you cannot call any\nhook before git-mailinfo because git-mailinfo is where the\nContent-Transfer-Encoding is processed.\n\nHow would you integrate git-interpret-trailers in git-mailinfo?\n\nPaolo\n"},{"id":"252535","messageId":"xmqqwq6jruyd.fsf@gitster.dls.corp.google.com","threadId":"38045","inReplyTo":"1416924056-29993-1-git-send-email-bonzini@gnu.org","subject":"Re: [PATCH 0/2] git-am: add --message-id/--no-message-id options","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-11-25T18:33:46Z","receivedAt":"2014-11-25T18:33:46Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Paolo Bonzini <bonzini@gnu.org> writes:\n\n> From: Paolo Bonzini <pbonzini@redhat.com>\n>\n> This series adds a --message-id option to git-mailinfo and git-am.\n> git-am also gets an am.messageid configuration key to set the default,\n> and a --no-message-id option to override the configuration key.\n> (I'm not sure of the usefulness of a mailinfo.messageid option, so\n> I left it out; this follows the example of -k instead of --scissors).\n>\n> This option can be useful in order to associate commit messages with\n> mailing list discussions.\n>\n> If both --message-id and -s are specified, the Signed-off-by goes\n> last.  This is coming out more or less naturally out of the git-am\n> implementation, but is also tested in t4150-am.sh.\n\nNice.  So if you apply a message whose last sign-off is yourself\nwith both of these options, what would we see?\n\n    1. S-o-b: you and then M-id: and then another S-o-b: you?\n    2. M-id: and then S-o-b: you?\n    3. S-o-b: you and then M-id:?\n\nI do not offhand know which one of the above possibilities to favor\nmore over others myself.  Just asking to find out more about the\nthinking behind the design.\n\nThanks.\n\n>\n> Paolo Bonzini (2):\n>   git-mailinfo: add --message-id\n>   git-am: add --message-id/--no-message-id\n>\n>  Documentation/git-am.txt       | 11 +++++++++++\n>  Documentation/git-mailinfo.txt |  5 +++++\n>  builtin/mailinfo.c             | 22 +++++++++++++++++++++-\n>  git-am.sh                      | 21 +++++++++++++++++++--\n>  t/t4150-am.sh                  | 23 +++++++++++++++++++++++\n>  t/t5100-mailinfo.sh            |  4 ++++\n>  t/t5100/info0012--message-id   |  5 +++++\n>  t/t5100/msg0012--message-id    |  8 ++++++++\n>  t/t5100/patch0012--message-id  | 30 ++++++++++++++++++++++++++++++\n>  9 files changed, 126 insertions(+), 3 deletions(-)\n>  create mode 100644 t/t5100/info0012--message-id\n>  create mode 100644 t/t5100/msg0012--message-id\n>  create mode 100644 t/t5100/patch0012--message-id\n"},{"id":"252536","messageId":"5474D582.9060604@gnu.org","threadId":"38045","inReplyTo":"xmqqwq6jruyd.fsf@gitster.dls.corp.google.com","subject":"Re: [PATCH 0/2] git-am: add --message-id/--no-message-id options","fromName":"Paolo Bonzini","fromEmail":"bonzini@gnu.org","sentAt":"2014-11-25T19:16:18Z","receivedAt":"2014-11-25T19:16:18Z","isPatch":true,"sender":{"key":"bonzini@gnu.org","avatar":"https://avatars.githubusercontent.com/u/42082?v=4"},"body":"\n\nOn 25/11/2014 19:33, Junio C Hamano wrote:\n>> > If both --message-id and -s are specified, the Signed-off-by goes\n>> > last.  This is coming out more or less naturally out of the git-am\n>> > implementation, but is also tested in t4150-am.sh.\n> Nice.  So if you apply a message whose last sign-off is yourself\n> with both of these options, what would we see?\n> \n>     1. S-o-b: you and then M-id: and then another S-o-b: you?\n>     2. M-id: and then S-o-b: you?\n>     3. S-o-b: you and then M-id:?\n> \n> I do not offhand know which one of the above possibilities to favor\n> more over others myself.  Just asking to find out more about the\n> thinking behind the design.\n\nYou currently get (1), which is arguably the most precise but definitely\nthe ugliest.\n\nIn this case (posting as maintainer), I would probably not use \"git am\n--message-id\"; instead I would use an alias to add the Message-Id (with\ngit interpret-trailers!) after posting to the mailing list, resulting in\neither (2) or (3).\n\nI think (but I am not sure) that git-am could use a hook to rewrite (1)\ninto (2) or (3).\n\nPaolo\n"},{"id":"252538","messageId":"xmqqoarvrqoo.fsf@gitster.dls.corp.google.com","threadId":"38045","inReplyTo":"5474D582.9060604@gnu.org","subject":"Re: [PATCH 0/2] git-am: add --message-id/--no-message-id options","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-11-25T20:05:59Z","receivedAt":"2014-11-25T20:05:59Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Paolo Bonzini <bonzini@gnu.org> writes:\n\n> On 25/11/2014 19:33, Junio C Hamano wrote:\n>>> > If both --message-id and -s are specified, the Signed-off-by goes\n>>> > last.  This is coming out more or less naturally out of the git-am\n>>> > implementation, but is also tested in t4150-am.sh.\n>> Nice.  So if you apply a message whose last sign-off is yourself\n>> with both of these options, what would we see?\n>> \n>>     1. S-o-b: you and then M-id: and then another S-o-b: you?\n>>     2. M-id: and then S-o-b: you?\n>>     3. S-o-b: you and then M-id:?\n>> \n>> I do not offhand know which one of the above possibilities to favor\n>> more over others myself.  Just asking to find out more about the\n>> thinking behind the design.\n>\n> You currently get (1), which is arguably the most precise but definitely\n> the ugliest.\n>\n> In this case (posting as maintainer), I would probably not use \"git am\n> --message-id\"; instead I would use an alias to add the Message-Id (with\n> git interpret-trailers!) after posting to the mailing list, resulting in\n> either (2) or (3).\n>\n> I think (but I am not sure) that git-am could use a hook to rewrite (1)\n> into (2) or (3).\n\nI actually do not think (1) is more (or less for that matter) ugly\ncompared to either of the others.\n\nThanks.  Let's queue these two series for the next cycle.\n"},{"id":"252542","messageId":"CAP8UFD0WcSM4NP8XHQe5pg0bwC5-C19OdcNoPWFFz7Ngrfbg8g@mail.gmail.com","threadId":"38045","inReplyTo":"5474B5EE.1030406@redhat.com","subject":"Re: [PATCH 0/2] git-am: add --message-id/--no-message-id options","fromName":"Christian Couder","fromEmail":"christian.couder@gmail.com","sentAt":"2014-11-25T21:21:56Z","receivedAt":"2014-11-25T21:21:56Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"On Tue, Nov 25, 2014 at 6:01 PM, Paolo Bonzini <pbonzini@redhat.com> wrote:\n>\n>\n> On 25/11/2014 17:27, Christian Couder wrote:\n>>> > From: Paolo Bonzini <pbonzini@redhat.com>\n>>> >\n>>> > This series adds a --message-id option to git-mailinfo and git-am.\n>>> > git-am also gets an am.messageid configuration key to set the default,\n>>> > and a --no-message-id option to override the configuration key.\n>>> > (I'm not sure of the usefulness of a mailinfo.messageid option, so\n>>> > I left it out; this follows the example of -k instead of --scissors).\n>>> >\n>>> > This option can be useful in order to associate commit messages with\n>>> > mailing list discussions.\n>>> >\n>>> > If both --message-id and -s are specified, the Signed-off-by goes\n>>> > last.  This is coming out more or less naturally out of the git-am\n>>> > implementation, but is also tested in t4150-am.sh.\n>> Did you have a look at git interpret-trailers currently in master?\n>\n> Hmm, now I have.\n>\n> As far as I understand, all the git-am hooks are called on the commit\n> rather than the incoming email: all headers are lost by the time\n> git-mailinfo exits, including the Message-Id.  And you cannot call any\n> hook before git-mailinfo because git-mailinfo is where the\n> Content-Transfer-Encoding is processed.\n>\n> How would you integrate git-interpret-trailers in git-mailinfo?\n\nI don't know exactly, but people may want to add trailers when they\nrun git-am, see:\n\nhttp://thread.gmane.org/gmane.comp.version-control.git/251412/\n\nand we decided that it was better to let something like git\ninterpret-trailers decide how they should be handled.\n\nMaybe if git-interpret-trailers could be called from git-mailinfo with\nsome arguments coming from git-am, it could be configured with\nsomething like:\n\ngit config trailer.Message-Id.command 'perl -ne '\\''print $1 if\nm/^Message-Id: (.*)$/'\\'' $ARG'\n\nSo \"git am --trailer 'Message-Id: msg-file' msg-file\" would call \"git\nmailinfo ...\" that would call \"git interpret-trailers --trailer\n'Message-Id: msg-file'\" that would call \"perl -ne 'print $1 if\nm/^Message-Id: (.*)$/' msg-file\" and the output of this command, let's\ncall it $id, would be put into a \"Message-Id: $id\" trailer in the\ncommit message.\n\nThis way there is nothing specific to Message-Id in the code and\npeople can decide using other trailer.Message-Id.* config variables\nexactly where the Message-Id trailer would be in the commit message.\n\nBest,\nChristian.\n"},{"id":"252551","messageId":"xmqqbnnusvmd.fsf@gitster.dls.corp.google.com","threadId":"38045","inReplyTo":"1416924056-29993-3-git-send-email-bonzini@gnu.org","subject":"Re: [PATCH 2/2] git-am: add --message-id/--no-message-id","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-11-25T23:34:02Z","receivedAt":"2014-11-25T23:34:02Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Paolo Bonzini <bonzini@gnu.org> writes:\n\n> @@ -371,13 +372,18 @@ split_patches () {\n>  prec=4\n>  dotest=\"$GIT_DIR/rebase-apply\"\n>  sign= utf8=t keep= keepcr= skip= interactive= resolved= rebasing= abort=\n> -resolvemsg= resume= scissors= no_inbody_headers=\n> +messageid= resolvemsg= resume= scissors= no_inbody_headers=\n\nIt is somewhat irritating to read a diff that adds new things to the\nbeginning of anything (a line, or a block of lines) that lists\nthings in no particular order, as it just adds cognitive burden.\n\n>  git_apply_opt=\n>  committer_date_is_author_date=\n>  ignore_date=\n>  allow_rerere_autoupdate=\n>  gpg_sign_opt=\n>  \n> +if test \"$(git config --bool --get am.messageid)\" = true\n> +then\n> +    messageid=t\n> +fi\n> +\n>  if test \"$(git config --bool --get am.keepcr)\" = true\n>  then\n>      keepcr=t\n> @@ -400,6 +406,10 @@ it will be removed. Please do not use it anymore.\"\n>  \t\tutf8=t ;; # this is now default\n>  \t--no-utf8)\n>  \t\tutf8= ;;\n> +\t-m|--message-id)\n> +\t\tmessageid=t ;;\n> +\t--no-message-id)\n> +\t\tmessageid=f ;;\n\nThis one, taken together with these two hunks ...\n\n>  \t-k|--keep)\n>  \t\tkeep=t ;;\n>  \t--keep-non-patch)\n> @@ -567,6 +577,7 @@ Use \\\"git am --abort\\\" to remove it.\")\"\n>  \techo \"$sign\" >\"$dotest/sign\"\n>  \techo \"$utf8\" >\"$dotest/utf8\"\n>  \techo \"$keep\" >\"$dotest/keep\"\n> +\techo \"$messageid\" >\"$dotest/messageid\"\n>  \techo \"$scissors\" >\"$dotest/scissors\"\n>  \techo \"$no_inbody_headers\" >\"$dotest/no_inbody_headers\"\n>  \techo \"$GIT_QUIET\" >\"$dotest/quiet\"\n> @@ -621,6 +632,12 @@ b)\n>  *)\n>  \tkeep= ;;\n>  esac\n> +case \"$(cat \"$dotest/messageid\")\" in\n> +t)\n> +\tmessageid=-m ;;\n> +f)\n> +\tmessageid= ;;\n> +esac\n\n... makes the result look questionable.  The variable is initialized\nto empty; when it is written out to $dotest/messageid and later read\nback here, that empty value is not covered by this case statement.\n\nPerhaps clearing messageid= upon seeing \"--no-message-id\" and using\n\"'t' or empty\" makes the code a bit easier to follow?  I dunno.\n"},{"id":"252573","messageId":"54757BE6.2070103@gnu.org","threadId":"38045","inReplyTo":"xmqqbnnusvmd.fsf@gitster.dls.corp.google.com","subject":"Re: [PATCH 2/2] git-am: add --message-id/--no-message-id","fromName":"Paolo Bonzini","fromEmail":"bonzini@gnu.org","sentAt":"2014-11-26T07:06:14Z","receivedAt":"2014-11-26T07:06:14Z","isPatch":true,"sender":{"key":"bonzini@gnu.org","avatar":"https://avatars.githubusercontent.com/u/42082?v=4"},"body":"\n\nOn 26/11/2014 00:34, Junio C Hamano wrote:\n> ... makes the result look questionable.  The variable is initialized\n> to empty; when it is written out to $dotest/messageid and later read\n> back here, that empty value is not covered by this case statement.\n> \n> Perhaps clearing messageid= upon seeing \"--no-message-id\" and using\n> \"'t' or empty\" makes the code a bit easier to follow?  I dunno.\n\nPossibly.  The other side is that it would be handled differently than\nscissors and keep.  Changing everything is possible but would break\ncontinuing a \"git am\" operation across an update, so I chose consistency.\n\nPaolo\n"},{"id":"252575","messageId":"54759846.6040804@gnu.org","threadId":"38045","inReplyTo":"CAP8UFD0WcSM4NP8XHQe5pg0bwC5-C19OdcNoPWFFz7Ngrfbg8g@mail.gmail.com","subject":"Re: [PATCH 0/2] git-am: add --message-id/--no-message-id options","fromName":"Paolo Bonzini","fromEmail":"bonzini@gnu.org","sentAt":"2014-11-26T09:07:18Z","receivedAt":"2014-11-26T09:07:18Z","isPatch":true,"sender":{"key":"bonzini@gnu.org","avatar":"https://avatars.githubusercontent.com/u/42082?v=4"},"body":"\n\nOn 25/11/2014 22:21, Christian Couder wrote:\n> On Tue, Nov 25, 2014 at 6:01 PM, Paolo Bonzini <pbonzini@redhat.com> wrote:\n>>\n>>\n>> On 25/11/2014 17:27, Christian Couder wrote:\n>>>>> From: Paolo Bonzini <pbonzini@redhat.com>\n>>>>>\n>>>>> This series adds a --message-id option to git-mailinfo and git-am.\n>>>>> git-am also gets an am.messageid configuration key to set the default,\n>>>>> and a --no-message-id option to override the configuration key.\n>>>>> (I'm not sure of the usefulness of a mailinfo.messageid option, so\n>>>>> I left it out; this follows the example of -k instead of --scissors).\n>>>>>\n>>>>> This option can be useful in order to associate commit messages with\n>>>>> mailing list discussions.\n>>>>>\n>>>>> If both --message-id and -s are specified, the Signed-off-by goes\n>>>>> last.  This is coming out more or less naturally out of the git-am\n>>>>> implementation, but is also tested in t4150-am.sh.\n>>> Did you have a look at git interpret-trailers currently in master?\n>>\n>> Hmm, now I have.\n>>\n>> As far as I understand, all the git-am hooks are called on the commit\n>> rather than the incoming email: all headers are lost by the time\n>> git-mailinfo exits, including the Message-Id.  And you cannot call any\n>> hook before git-mailinfo because git-mailinfo is where the\n>> Content-Transfer-Encoding is processed.\n>>\n>> How would you integrate git-interpret-trailers in git-mailinfo?\n> \n> I don't know exactly, but people may want to add trailers when they\n> run git-am, see:\n> \n> http://thread.gmane.org/gmane.comp.version-control.git/251412/\n> \n> and we decided that it was better to let something like git\n> interpret-trailers decide how they should be handled.\n> \n> Maybe if git-interpret-trailers could be called from git-mailinfo with\n> some arguments coming from git-am, it could be configured with\n> something like:\n> \n> git config trailer.Message-Id.command 'perl -ne '\\''print $1 if\n> m/^Message-Id: (.*)$/'\\'' $ARG'\n> \n> So \"git am --trailer 'Message-Id: msg-file' msg-file\" would call \"git\n> mailinfo ...\" that would call \"git interpret-trailers --trailer\n> 'Message-Id: msg-file'\" that would call \"perl -ne 'print $1 if\n> m/^Message-Id: (.*)$/' msg-file\" and the output of this command, let's\n> call it $id, would be put into a \"Message-Id: $id\" trailer in the\n> commit message.\n\nI think overloading trailer.Message-Id.command is not a good idea,\nbecause it would prevent using \"git interpret-trailers\" to add a message\nid manually (\"git interpret-trailers --trailer message-id='<foo@bar>'\").\n\nAnother possibility could be to add a third output file to git-mailinfo,\nincluding all the headers.  Then a hook could be called with the headers\nand commit message.\n\nThe question is: what would it be used for?  There aren't that many mail\nheaders, and most of them (From, Subject, Date) are recorded in the\ncommit anyway.  One idea could be to record who was a recipient of the\noriginal message, even if no Cc line was added explicitly.  In most\nprojects, Cc is often added randomly, but I guess that's a valid\nusecase.  I can certainly code the above hook instead of this approach\nif Junio thinks it's better.\n\nIn the meanwhile, I have thought of a couple additions to \"git\ninterpret-trailers\" and I can submit patches for them.\n\nPaolo\n\n> This way there is nothing specific to Message-Id in the code and\n> people can decide using other trailer.Message-Id.* config variables\n> exactly where the Message-Id trailer would be in the commit message.\n> \n> Best,\n> Christian.\n> \n"},{"id":"252622","messageId":"CAP8UFD1nibHuoz2a_EZigYuxPN6a7a8aXF9uGVS=syk5hm1iGw@mail.gmail.com","threadId":"38045","inReplyTo":"54759846.6040804@gnu.org","subject":"Re: [PATCH 0/2] git-am: add --message-id/--no-message-id options","fromName":"Christian Couder","fromEmail":"christian.couder@gmail.com","sentAt":"2014-11-27T00:23:55Z","receivedAt":"2014-11-27T00:23:55Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"On Wed, Nov 26, 2014 at 10:07 AM, Paolo Bonzini <bonzini@gnu.org> wrote:\n>\n>\n> On 25/11/2014 22:21, Christian Couder wrote:\n>> On Tue, Nov 25, 2014 at 6:01 PM, Paolo Bonzini <pbonzini@redhat.com> wrote:\n>>>\n>>> As far as I understand, all the git-am hooks are called on the commit\n>>> rather than the incoming email: all headers are lost by the time\n>>> git-mailinfo exits, including the Message-Id.  And you cannot call any\n>>> hook before git-mailinfo because git-mailinfo is where the\n>>> Content-Transfer-Encoding is processed.\n>>>\n>>> How would you integrate git-interpret-trailers in git-mailinfo?\n>>\n>> I don't know exactly, but people may want to add trailers when they\n>> run git-am, see:\n>>\n>> http://thread.gmane.org/gmane.comp.version-control.git/251412/\n>>\n>> and we decided that it was better to let something like git\n>> interpret-trailers decide how they should be handled.\n>>\n>> Maybe if git-interpret-trailers could be called from git-mailinfo with\n>> some arguments coming from git-am, it could be configured with\n>> something like:\n>>\n>> git config trailer.Message-Id.command 'perl -ne '\\''print $1 if\n>> m/^Message-Id: (.*)$/'\\'' $ARG'\n>>\n>> So \"git am --trailer 'Message-Id: msg-file' msg-file\" would call \"git\n>> mailinfo ...\" that would call \"git interpret-trailers --trailer\n>> 'Message-Id: msg-file'\" that would call \"perl -ne 'print $1 if\n>> m/^Message-Id: (.*)$/' msg-file\" and the output of this command, let's\n>> call it $id, would be put into a \"Message-Id: $id\" trailer in the\n>> commit message.\n>\n> I think overloading trailer.Message-Id.command is not a good idea,\n> because it would prevent using \"git interpret-trailers\" to add a message\n> id manually (\"git interpret-trailers --trailer message-id='<foo@bar>'\").\n\nWell, it is possible to configure a trailer.Message-Id.command that\ncan detect if it is passed an existing file or not.\nIf it is passed an existing file, it could lookup the message id in\nthe file and print it, otherwise it would just print what it is\npassed.\n\n> Another possibility could be to add a third output file to git-mailinfo,\n> including all the headers.  Then a hook could be called with the headers\n> and commit message.\n\nYeah, but this hook could not do everything, because some people might\nwant to add trailers from the command line anyway.\nSo git interpret-trailers could be called once with the command line\narguments and once inside the hook.\n\nIf the user wants to have some processing done by some commands for\ndifferent trailers, it makes sense to have all the processing done by\ncommands specified in the trailer.<token>.command config variables,\ninstead of having some of it done by such config variables and other\ndone in some hooks.\n\n> The question is: what would it be used for?  There aren't that many mail\n> headers, and most of them (From, Subject, Date) are recorded in the\n> commit anyway.  One idea could be to record who was a recipient of the\n> original message, even if no Cc line was added explicitly.  In most\n> projects, Cc is often added randomly, but I guess that's a valid\n> usecase.  I can certainly code the above hook instead of this approach\n> if Junio thinks it's better.\n\nYes, recording Cc'ed people in Cc: trailers is a very valid use case.\nI don't think the trailer.<token>.command mechanism supports that well\nif people want only one person per Cc: trailer.\nThat's something that could be improved in git-interpret-trailers.\n\n> In the meanwhile, I have thought of a couple additions to \"git\n> interpret-trailers\" and I can submit patches for them.\n\nYou are welcome to suggest and even more to submit patches for additions to it.\nIf you want, you can also have a look at some of these threads for\nsome things that have been suggested already:\n\nhttp://thread.gmane.org/gmane.comp.version-control.git/259614/\nthread.gmane.org/gmane.comp.version-control.git/259275/\n\nThanks,\nChristian.\n"}]}