{"thread":{"id":"19988","subject":"[PATCH 0/2] format-patch and send-email","startedAt":"2009-06-30T23:40:37Z","lastAt":"2009-07-02T06:45:08Z","messageCount":8,"participants":["Joe Perches","Markus Heidelberg","Stephen Boyd"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"117274","messageId":"cover.1246404999.git.joe@perches.com","threadId":"19988","inReplyTo":null,"subject":"[PATCH 0/2] format-patch and send-email","fromName":"Joe Perches","fromEmail":"joe@perches.com","sentAt":"2009-06-30T23:40:37Z","receivedAt":"2009-06-30T23:40:37Z","isPatch":true,"sender":{"key":"joe@perches.com","avatar":"https://avatars.githubusercontent.com/u/13122723?v=4"},"body":"A couple of patches that have previously been sent to the list\n\nJoe Perches (2):\n  git-send-email.perl: Don't add header \"In-Reply-To:\" when --no-chain-reply-to set\n  format-patch: Add --cover-letter-wrap\n\n Documentation/git-format-patch.txt     |   13 +++++++++\n builtin-log.c                          |   46 +++++++++++++++++++++++++++++---\n contrib/completion/git-completion.bash |    1 +\n git-send-email.perl                    |    3 +-\n 4 files changed, 58 insertions(+), 5 deletions(-)\n"},{"id":"117275","messageId":"a19204c574f407d98be74d54cfd899b43fdc7d26.1246404999.git.joe@perches.com","threadId":"19988","inReplyTo":"cover.1246404999.git.joe@perches.com","subject":"[PATCH 1/2] git-send-email.perl: Don't add header \"In-Reply-To:\" when --no-chain-reply-to set","fromName":"Joe Perches","fromEmail":"joe@perches.com","sentAt":"2009-06-30T23:40:38Z","receivedAt":"2009-06-30T23:40:38Z","isPatch":true,"sender":{"key":"joe@perches.com","avatar":"https://avatars.githubusercontent.com/u/13122723?v=4"},"body":"using\n  git format-patch --thread=shallow -o <foo>\nand\n  git send-email --no-thread --no-chain-reply-to <foo>\n\nduplicates the headers\n\n  In-Reply-To:\n  References:\n\nSigned-off-by: Joe Perches <joe@perches.com>\n---\n git-send-email.perl |    3 ++-\n 1 files changed, 2 insertions(+), 1 deletions(-)\n\ndiff --git a/git-send-email.perl b/git-send-email.perl\nindex 8ce6f1f..1b9b27e 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -1151,7 +1151,8 @@ foreach my $t (@files) {\n \n \t# set up for the next message\n \tif ($thread && $message_was_sent &&\n-\t\t($chain_reply_to || !defined $reply_to || length($reply_to) == 0)) {\n+\t    ($chain_reply_to && \n+\t     (!defined $reply_to || length($reply_to) == 0))) {\n \t\t$reply_to = $message_id;\n \t\tif (length $references > 0) {\n \t\t\t$references .= \"\\n $message_id\";\n-- \n1.6.3.1.10.g659a0.dirty\n"},{"id":"117276","messageId":"5035332845f173ac9c236a90621ca04ea6633b10.1246404999.git.joe@perches.com","threadId":"19988","inReplyTo":"cover.1246404999.git.joe@perches.com","subject":"[PATCH 2/2] format-patch: Add --cover-letter-wrap","fromName":"Joe Perches","fromEmail":"joe@perches.com","sentAt":"2009-06-30T23:40:39Z","receivedAt":"2009-06-30T23:40:39Z","isPatch":true,"sender":{"key":"joe@perches.com","avatar":"https://avatars.githubusercontent.com/u/13122723?v=4"},"body":"--cover-letter does not give control over the column wrap\nposition.  This adds --cover-letter-wrap with 3 arguments\nposition as well as indent and additional_indent.\n\nSigned-off-by: Joe Perches <joe@perches.com>\n---\n Documentation/git-format-patch.txt     |   13 +++++++++\n builtin-log.c                          |   46 +++++++++++++++++++++++++++++---\n contrib/completion/git-completion.bash |    1 +\n 3 files changed, 56 insertions(+), 4 deletions(-)\n\ndiff --git a/Documentation/git-format-patch.txt b/Documentation/git-format-patch.txt\nindex 6f1fc80..f6b34ff 100644\n--- a/Documentation/git-format-patch.txt\n+++ b/Documentation/git-format-patch.txt\n@@ -20,6 +20,8 @@ SYNOPSIS\n \t\t   [--subject-prefix=Subject-Prefix]\n \t\t   [--cc=<email>]\n \t\t   [--cover-letter]\n+\t\t   [--cover-letter-wrap=width[,indent1[,indent2]]]\n+\t\t   [--no-cover-letter-wrap]\n \t\t   [<common diff options>]\n \t\t   [ <since> | <revision range> ]\n \n@@ -168,6 +170,17 @@ if that is not set.\n \tcontaining the shortlog and the overall diffstat.  You can\n \tfill in a description in the file before sending it out.\n \n+--cover-letter-wrap=<width>[,<indent1>[,<indent2>]]]::\n+\tLinewrap the cover-letter shortlog output by wrapping each line at\n+\t`width`.  The first line of each entry is indented by `indent1`\n+\tspaces, and the second and subsequent lines are indented by\n+\t`indent2` spaces.\n+\t`width`, `indent1`, and `indent2` default to 72, 2 and 4 respectively.\n+\n+--no-cover-letter-wrap::\n+\tDo not linewrap the cover-letter shortlog output.\n+\tindent is fixed at 6.\n+\n --suffix=.<sfx>::\n \tInstead of using `.patch` as the suffix for generated\n \tfilenames, use specified suffix.  A common alternative is\ndiff --git a/builtin-log.c b/builtin-log.c\nindex 44f9a27..ec89823 100644\n--- a/builtin-log.c\n+++ b/builtin-log.c\n@@ -461,6 +461,20 @@ static void add_header(const char *value)\n static int thread = 0;\n static int do_signoff = 0;\n \n+struct cover_letter_style {\n+\tint cover_letter_wrap;\n+\tint cover_letter_wrappos;\n+\tint cover_letter_indent1;\n+\tint cover_letter_indent2;\n+};\n+\n+static struct cover_letter_style cls = {\n+\t.cover_letter_wrap = 1,\n+\t.cover_letter_wrappos = 72,\n+\t.cover_letter_indent1 = 2,\n+\t.cover_letter_indent2 = 4,\n+};\n+\n static int git_format_config(const char *var, const char *value, void *cb)\n {\n \tif (!strcmp(var, \"format.headers\")) {\n@@ -669,10 +683,10 @@ static void make_cover_letter(struct rev_info *rev, int use_stdout,\n \tstrbuf_release(&sb);\n \n \tshortlog_init(&log);\n-\tlog.wrap_lines = 1;\n-\tlog.wrap = 72;\n-\tlog.in1 = 2;\n-\tlog.in2 = 4;\n+\tlog.wrap_lines = cls.cover_letter_wrap;\n+\tlog.wrap = cls.cover_letter_wrappos;\n+\tlog.in1 = cls.cover_letter_indent1;\n+\tlog.in2 = cls.cover_letter_indent2;\n \tfor (i = 0; i < nr; i++)\n \t\tshortlog_add_commit(&log, list[i]);\n \n@@ -792,6 +806,27 @@ static int output_directory_callback(const struct option *opt, const char *arg,\n \treturn 0;\n }\n \n+static int cls_callback(const struct option *opt, const char *arg, int unset)\n+{\n+\tif (unset)\n+\t\tcls.cover_letter_wrap = 0;\n+\telse {\n+\t\tint i1, i2, i3;\n+\t\tif (!arg)\n+\t\t\treturn 1;\n+\t\tint arg_count = sscanf(arg, \"%d,%d,%d\", &i1, &i2, &i3);\n+\t\tif (arg_count <= 0)\n+\t\t\treturn 1;\n+\t\tif (arg_count >= 1)\n+\t\t\tcls.cover_letter_wrappos = i1;\n+\t\tif (arg_count >= 2)\n+\t\t\tcls.cover_letter_indent1 = i2;\n+\t\tif (arg_count >= 3)\n+\t\t\tcls.cover_letter_indent2 = i3;\n+\t\t}\n+\treturn 0;\n+}\n+\n static int thread_callback(const struct option *opt, const char *arg, int unset)\n {\n \tint *thread = (int *)opt->value;\n@@ -875,6 +910,9 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)\n \t\t\t    \"print patches to standard out\"),\n \t\tOPT_BOOLEAN(0, \"cover-letter\", &cover_letter,\n \t\t\t    \"generate a cover letter\"),\n+\t\t{ OPTION_CALLBACK, 0, \"cover-letter-wrap\", &cls, NULL,\n+\t\t\t    \"control the cover letter format\",\n+\t\t\t    PARSE_OPT_OPTARG, cls_callback },\n \t\tOPT_BOOLEAN(0, \"numbered-files\", &numbered_files,\n \t\t\t    \"use simple number sequence for output file names\"),\n \t\tOPT_STRING(0, \"suffix\", &fmt_patch_suffix, \"sfx\",\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex b60cb68..aede61c 100755\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -985,6 +985,7 @@ _git_format_patch ()\n \t\t\t--full-index --binary\n \t\t\t--not --all\n \t\t\t--cover-letter\n+\t\t\t--no-cover-letter-wrap --cover-letter-wrap=\n \t\t\t--no-prefix --src-prefix= --dst-prefix=\n \t\t\t--inline --suffix= --ignore-if-in-upstream\n \t\t\t--subject-prefix=\n-- \n1.6.3.1.10.g659a0.dirty\n"},{"id":"117285","messageId":"200907010818.57050.markus.heidelberg@web.de","threadId":"19988","inReplyTo":"a19204c574f407d98be74d54cfd899b43fdc7d26.1246404999.git.joe@perches.com","subject":"Re: [PATCH 1/2] git-send-email.perl: Don't add header \"In-Reply-To:\" when --no-chain-reply-to set","fromName":"Markus Heidelberg","fromEmail":"markus.heidelberg@web.de","sentAt":"2009-07-01T06:18:56Z","receivedAt":"2009-07-01T06:18:56Z","isPatch":true,"sender":{"key":"markus.heidelberg@web.de","avatar":"https://avatars.githubusercontent.com/u/6334512?v=4"},"body":"Joe Perches, 01.07.2009:\n> using\n>   git format-patch --thread=shallow -o <foo>\n> and\n>   git send-email --no-thread --no-chain-reply-to <foo>\n\nI guess you meant --thread here.\n\n> duplicates the headers\n> \n>   In-Reply-To:\n>   References:\n\nI noticed the duplicated headers when fixing two bugs some weeks ago. I\nguess to get rid of the duplicated headers, you have to parse the mail\nthat format-patch produces, since you don't have a clue, what\nformat-patch did. I'm not sure if it's worth it, if the duplicated\nheaders don't harm the email standard. It only complicates the tool.\n\n> Signed-off-by: Joe Perches <joe@perches.com>\n> ---\n>  git-send-email.perl |    3 ++-\n>  1 files changed, 2 insertions(+), 1 deletions(-)\n> \n> diff --git a/git-send-email.perl b/git-send-email.perl\n> index 8ce6f1f..1b9b27e 100755\n> --- a/git-send-email.perl\n> +++ b/git-send-email.perl\n> @@ -1151,7 +1151,8 @@ foreach my $t (@files) {\n>  \n>  \t# set up for the next message\n>  \tif ($thread && $message_was_sent &&\n> -\t\t($chain_reply_to || !defined $reply_to || length($reply_to) == 0)) {\n> +\t    ($chain_reply_to && \n> +\t     (!defined $reply_to || length($reply_to) == 0))) {\n>  \t\t$reply_to = $message_id;\n>  \t\tif (length $references > 0) {\n>  \t\t\t$references .= \"\\n $message_id\";\n\nThis part of git-send-email seems to be prone for errors, blame it and\nyou will see in the latest commits.\n\nYou should run at least the test from the test suite for the particular\ncommand you change. Test 49 (threading but no chain-reply-to) from t9001\nnow fails.\n\nThat means, this will fail now (covered by test 49):\n\n  git format-patch -o <foo>\n  git send-email --thread --no-chain-reply-to <foo>\n\nand also this (not covered by any test, maybe we should add one):\n\n  git format-patch -o <foo>\n  git send-email --thread --chain-reply-to <foo>\n"},{"id":"117286","messageId":"1246429653.6259.111.camel@Joe-Laptop.home","threadId":"19988","inReplyTo":"200907010818.57050.markus.heidelberg@web.de","subject":"Re: [PATCH 1/2] git-send-email.perl: Don't add header \"In-Reply-To:\" when --no-chain-reply-to set","fromName":"Joe Perches","fromEmail":"joe@perches.com","sentAt":"2009-07-01T06:27:33Z","receivedAt":"2009-07-01T06:27:33Z","isPatch":true,"sender":{"key":"joe@perches.com","avatar":"https://avatars.githubusercontent.com/u/13122723?v=4"},"body":"On Wed, 2009-07-01 at 08:18 +0200, Markus Heidelberg wrote:\n> Joe Perches, 01.07.2009:\n> > using\n> >   git format-patch --thread=shallow -o <foo>\n> > and\n> >   git send-email --no-thread --no-chain-reply-to <foo>\n> \n> I guess you meant --thread here.\n\nActually, I did mean --no-thread.\nIf format-patch does the threading, send-email shouldn't.\n\n> > duplicates the headers\n> > \n> >   In-Reply-To:\n> >   References:\n> \n> You should run at least the test from the test suite for the particular\n> command you change. Test 49 (threading but no chain-reply-to) from t9001\n> now fails.\n> \n> That means, this will fail now (covered by test 49):\n> \n>   git format-patch -o <foo>\n>   git send-email --thread --no-chain-reply-to <foo>\n> \n> and also this (not covered by any test, maybe we should add one):\n> \n>   git format-patch -o <foo>\n>   git send-email --thread --chain-reply-to <foo>\n\nI didn't know the tests existed, thanks.\nI'll investigate a bit more.\n\ncheers, Joe\n"},{"id":"117303","messageId":"200907011900.00131.markus.heidelberg@web.de","threadId":"19988","inReplyTo":"1246429653.6259.111.camel@Joe-Laptop.home","subject":"Re: [PATCH 1/2] git-send-email.perl: Don't add header \"In-Reply-To:\" when --no-chain-reply-to set","fromName":"Markus Heidelberg","fromEmail":"markus.heidelberg@web.de","sentAt":"2009-07-01T16:59:59Z","receivedAt":"2009-07-01T16:59:59Z","isPatch":true,"sender":{"key":"markus.heidelberg@web.de","avatar":"https://avatars.githubusercontent.com/u/6334512?v=4"},"body":"Joe Perches, 01.07.2009:\n> On Wed, 2009-07-01 at 08:18 +0200, Markus Heidelberg wrote:\n> > Joe Perches, 01.07.2009:\n> > > using\n> > >   git format-patch --thread=shallow -o <foo>\n> > > and\n> > >   git send-email --no-thread --no-chain-reply-to <foo>\n> > \n> > I guess you meant --thread here.\n> \n> Actually, I did mean --no-thread.\n\nBut --no-thread doesn't duplicate, --thread does.\n\nAccording to the last line of your patch, you are using an old version\n1.6.3.1. After this version two threading bugs were fixed, so you may\nencounter a wrong behaviour with your old version.\n\n> If format-patch does the threading, send-email shouldn't.\n\nIf the user wants format-patch to do the threading, he shouldn't want\nsend-email to do it as well.\n\nMarkus\n"},{"id":"117305","messageId":"1246469115.28915.21.camel@Joe-Laptop.home","threadId":"19988","inReplyTo":"200907011900.00131.markus.heidelberg@web.de","subject":"Re: [PATCH 1/2] git-send-email.perl: Don't add header \"In-Reply-To:\" when --no-chain-reply-to set","fromName":"Joe Perches","fromEmail":"joe@perches.com","sentAt":"2009-07-01T17:25:15Z","receivedAt":"2009-07-01T17:25:15Z","isPatch":true,"sender":{"key":"joe@perches.com","avatar":"https://avatars.githubusercontent.com/u/13122723?v=4"},"body":"On Wed, 2009-07-01 at 18:59 +0200, Markus Heidelberg wrote:\n> Joe Perches, 01.07.2009:\n> > On Wed, 2009-07-01 at 08:18 +0200, Markus Heidelberg wrote:\n> > > Joe Perches, 01.07.2009:\n> > > > using\n> > > >   git format-patch --thread=shallow -o <foo>\n> > > > and\n> > > >   git send-email --no-thread --no-chain-reply-to <foo>\n> > > I guess you meant --thread here.\n> > Actually, I did mean --no-thread.\n> But --no-thread doesn't duplicate, --thread does.\n> \n> According to the last line of your patch, you are using an old version\n> 1.6.3.1. After this version two threading bugs were fixed, so you may\n> encounter a wrong behaviour with your old version.\n\nGreat, I'm glad the bug was fixed already and apologies\nfor the noise, I don't generally track the git list.\n\nReading the archives, I see you're responsible, thanks.\n\ncheers, Joe\n"},{"id":"117344","messageId":"4A4C5774.9050905@gmail.com","threadId":"19988","inReplyTo":"5035332845f173ac9c236a90621ca04ea6633b10.1246404999.git.joe@perches.com","subject":"Re: [PATCH 2/2] format-patch: Add --cover-letter-wrap","fromName":"Stephen Boyd","fromEmail":"bebarino@gmail.com","sentAt":"2009-07-02T06:45:08Z","receivedAt":"2009-07-02T06:45:08Z","isPatch":true,"sender":{"key":"bebarino@gmail.com","avatar":"https://avatars.githubusercontent.com/u/38832?v=4"},"body":"Joe Perches wrote:\n> @@ -792,6 +806,27 @@ static int output_directory_callback(const struct option *opt, const char *arg,\n>  \treturn 0;\n>  }\n>  \n> +static int cls_callback(const struct option *opt, const char *arg, int unset)\n> +{\n> +\tif (unset)\n> +\t\tcls.cover_letter_wrap = 0;\n> +\telse {\n> +\t\tint i1, i2, i3;\n> +\t\tif (!arg)\n> +\t\t\treturn 1;\n> +\t\tint arg_count = sscanf(arg, \"%d,%d,%d\", &i1, &i2, &i3);\n> +\t\tif (arg_count <= 0)\n> +\t\t\treturn 1;\n> +\t\tif (arg_count >= 1)\n> +\t\t\tcls.cover_letter_wrappos = i1;\n> +\t\tif (arg_count >= 2)\n> +\t\t\tcls.cover_letter_indent1 = i2;\n> +\t\tif (arg_count >= 3)\n> +\t\t\tcls.cover_letter_indent2 = i3;\n> +\t\t}\n\nThis bracket is one indent off.\n\nI'm not sure, but can this be simplified to just setting the struct\nmembers directly through sscanf? You won't need to have these if's in\nthat case. I think something like --cover-letter-wrap=\"\" would be\nequivalent to just using the defaults and not an error. Does that sound\nright?\n\n> +\treturn 0;\n> +}\n> +\n>  static int thread_callback(const struct option *opt, const char *arg, int unset)\n>  {\n>  \tint *thread = (int *)opt->value;\n> @@ -875,6 +910,9 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)\n>  \t\t\t    \"print patches to standard out\"),\n>  \t\tOPT_BOOLEAN(0, \"cover-letter\", &cover_letter,\n>  \t\t\t    \"generate a cover letter\"),\n> +\t\t{ OPTION_CALLBACK, 0, \"cover-letter-wrap\", &cls, NULL,\n> +\t\t\t    \"control the cover letter format\",\n> +\t\t\t    PARSE_OPT_OPTARG, cls_callback },\n\nWhy is this PARSE_OPT_OPTARG? I only see the choice of having arguments\nor prefixed with a --no. Also, please use PARSE_OPT_LITERAL_ARGHELP and\ngive it the help string you use in the docs\n(<width>[,<indent1>[,<indent2>]]).\n"}]}