{"thread":{"id":"47733","subject":"[PATCH] tag: add --edit option","startedAt":"2018-02-01T09:49:58Z","lastAt":"2018-02-01T15:25:58Z","messageCount":7,"participants":["Nicolas Morey-Chaisemartin","Eric Sunshine","Ramsay Jones"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"338007","messageId":"450140f4-d410-4f1a-e5c1-c56d345a7f7c@suse.com","threadId":"47733","inReplyTo":null,"subject":"[PATCH] tag: add --edit option","fromName":"Nicolas Morey-Chaisemartin","fromEmail":"nmoreychaisemartin@suse.com","sentAt":"2018-02-01T09:49:51Z","receivedAt":"2018-02-01T09:49:58Z","isPatch":true,"sender":{"key":"devel-git@morey-chaisemartin.com","avatar":"https://avatars.githubusercontent.com/u/108326?v=4"},"body":"Add a --edit option whichs allows modifying the messages provided by -m or -F,\nthe same way git commit --edit does.\n\nSigned-off-by: Nicolas Morey-Chaisemartin <NMoreyChaisemartin@suse.com>\n---\n Documentation/git-tag.txt |  6 ++++++\n builtin/tag.c             | 11 +++++++++--\n t/t7004-tag.sh            | 34 ++++++++++++++++++++++++++++++++++\n 3 files changed, 49 insertions(+), 2 deletions(-)\n\ndiff --git a/Documentation/git-tag.txt b/Documentation/git-tag.txt\nindex 956fc019f984..b9e5a993bea0 100644\n--- a/Documentation/git-tag.txt\n+++ b/Documentation/git-tag.txt\n@@ -167,6 +167,12 @@ This option is only applicable when listing tags without annotation lines.\n \tImplies `-a` if none of `-a`, `-s`, or `-u <keyid>`\n \tis given.\n \n+-e::\n+--edit::\n+\tThe message taken from file with `-F` and command line with\n+\t`-m` are usually used as the tag message unmodified.\n+\tThis option lets you further edit the message taken from these sources.\n+\n --cleanup=<mode>::\n \tThis option sets how the tag message is cleaned up.\n \tThe  '<mode>' can be one of 'verbatim', 'whitespace' and 'strip'.  The\ndiff --git a/builtin/tag.c b/builtin/tag.c\nindex a7e6a5b0f234..91c60829d5f9 100644\n--- a/builtin/tag.c\n+++ b/builtin/tag.c\n@@ -194,6 +194,7 @@ static int build_tag_object(struct strbuf *buf, int sign, struct object_id *resu\n \n struct create_tag_options {\n \tunsigned int message_given:1;\n+\tunsigned int use_editor:1;\n \tunsigned int sign;\n \tenum {\n \t\tCLEANUP_NONE,\n@@ -224,7 +225,7 @@ static void create_tag(const struct object_id *object, const char *tag,\n \t\t    tag,\n \t\t    git_committer_info(IDENT_STRICT));\n \n-\tif (!opt->message_given) {\n+\tif (!opt->message_given || opt->use_editor) {\n \t\tint fd;\n \n \t\t/* write the template message before editing: */\n@@ -233,7 +234,10 @@ static void create_tag(const struct object_id *object, const char *tag,\n \t\tif (fd < 0)\n \t\t\tdie_errno(_(\"could not create file '%s'\"), path);\n \n-\t\tif (!is_null_oid(prev)) {\n+\t\tif (opt->message_given) {\n+\t\t\twrite_or_die(fd, buf->buf, buf->len);\n+\t\t\tstrbuf_reset(buf);\n+\t\t} else if (!is_null_oid(prev)) {\n \t\t\twrite_tag_body(fd, prev);\n \t\t} else {\n \t\t\tstruct strbuf buf = STRBUF_INIT;\n@@ -372,6 +376,7 @@ int cmd_tag(int argc, const char **argv, const char *prefix)\n \tstatic struct ref_sorting *sorting = NULL, **sorting_tail = &sorting;\n \tstruct ref_format format = REF_FORMAT_INIT;\n \tint icase = 0;\n+\tint edit_flag = 0;\n \tstruct option options[] = {\n \t\tOPT_CMDMODE('l', \"list\", &cmdmode, N_(\"list tag names\"), 'l'),\n \t\t{ OPTION_INTEGER, 'n', NULL, &filter.lines, N_(\"n\"),\n@@ -386,6 +391,7 @@ int cmd_tag(int argc, const char **argv, const char *prefix)\n \t\tOPT_CALLBACK('m', \"message\", &msg, N_(\"message\"),\n \t\t\t     N_(\"tag message\"), parse_msg_arg),\n \t\tOPT_FILENAME('F', \"file\", &msgfile, N_(\"read message from file\")),\n+\t\tOPT_BOOL('e', \"edit\", &edit_flag, N_(\"force edit of commit\")),\n \t\tOPT_BOOL('s', \"sign\", &opt.sign, N_(\"annotated and GPG-signed tag\")),\n \t\tOPT_STRING(0, \"cleanup\", &cleanup_arg, N_(\"mode\"),\n \t\t\tN_(\"how to strip spaces and #comments from message\")),\n@@ -524,6 +530,7 @@ int cmd_tag(int argc, const char **argv, const char *prefix)\n \t\tdie(_(\"tag '%s' already exists\"), tag);\n \n \topt.message_given = msg.given || msgfile;\n+\topt.use_editor = edit_flag;\n \n \tif (!cleanup_arg || !strcmp(cleanup_arg, \"strip\"))\n \t\topt.cleanup_mode = CLEANUP_ALL;\ndiff --git a/t/t7004-tag.sh b/t/t7004-tag.sh\nindex a9af2de9960b..60e3a53f297f 100755\n--- a/t/t7004-tag.sh\n+++ b/t/t7004-tag.sh\n@@ -452,6 +452,23 @@ test_expect_success \\\n \ttest_cmp expect actual\n '\n \n+get_tag_header annotated-tag-edit $commit commit $time >expect\n+echo \"An edited message\" >>expect\n+test_expect_success 'set up editor' '\n+\tcat >editor <<-\\EOF &&\n+\t#!/bin/sh\n+\tsed -e \"s/A message/An edited message/g\" <\"$1\" >\"$1-\"\n+\tmv \"$1-\" \"$1\"\n+\tEOF\n+\tchmod 755 editor\n+'\n+test_expect_success \\\n+\t'creating an annotated tag with -m message --edit should succeed' '\n+\tEDITOR=./editor\tgit tag -m \"A message\" --edit annotated-tag-edit &&\n+\tget_tag_msg annotated-tag-edit >actual &&\n+\ttest_cmp expect actual\n+'\n+\n cat >msgfile <<EOF\n Another message\n in a file.\n@@ -465,6 +482,23 @@ test_expect_success \\\n \ttest_cmp expect actual\n '\n \n+get_tag_header file-annotated-tag-edit $commit commit $time >expect\n+sed -e \"s/Another message/Another edited message/g\" msgfile >>expect\n+test_expect_success 'set up editor' '\n+\tcat >editor <<-\\EOF &&\n+\t#!/bin/sh\n+\tsed -e \"s/Another message/Another edited message/g\" <\"$1\" >\"$1-\"\n+\tmv \"$1-\" \"$1\"\n+\tEOF\n+\tchmod 755 editor\n+'\n+test_expect_success \\\n+\t'creating an annotated tag with -F messagefile --edit should succeed' '\n+\tEDITOR=./editor\tgit tag -F msgfile --edit file-annotated-tag-edit &&\n+\tget_tag_msg file-annotated-tag-edit >actual &&\n+\ttest_cmp expect actual\n+'\n+\n cat >inputmsg <<EOF\n A message from the\n standard input\n-- \n2.16.1.72.g5be1f00a9a70.dirty\n\n"},{"id":"338014","messageId":"CAPig+cTFsp60KB+quuytW_nV2crLcjRV-PYN-3bO7tRY0_xu6w@mail.gmail.com","threadId":"47733","inReplyTo":"450140f4-d410-4f1a-e5c1-c56d345a7f7c@suse.com","subject":"Re: [PATCH] tag: add --edit option","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2018-02-01T10:16:11Z","receivedAt":"2018-02-01T10:16:20Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Thu, Feb 1, 2018 at 4:49 AM, Nicolas Morey-Chaisemartin\n<nmoreychaisemartin@suse.com> wrote:\n> Add a --edit option whichs allows modifying the messages provided by -m or -F,\n> the same way git commit --edit does.\n>\n> Signed-off-by: Nicolas Morey-Chaisemartin <NMoreyChaisemartin@suse.com>\n> ---\n> diff --git a/builtin/tag.c b/builtin/tag.c\n> @@ -224,7 +225,7 @@ static void create_tag(const struct object_id *object, const char *tag,\n> -       if (!opt->message_given) {\n> +       if (!opt->message_given || opt->use_editor) {\n>\n> -               if (!is_null_oid(prev)) {\n> +               if (opt->message_given) {\n> +                       write_or_die(fd, buf->buf, buf->len);\n> +                       strbuf_reset(buf);\n> +               } else if (!is_null_oid(prev)) {\n>                         write_tag_body(fd, prev);\n>                 } else {\n\nA little below this change is where launch_editor() is actually\ninvoked. If it fails for some reason, it prints:\n\n    Please supply the message using either -m or -F option.\n\nwhich seems a bit counterintuitive if the user *did* specify one of\nthose options along with --edit. I wonder if that message needs to be\nadjusted.\n\n> diff --git a/t/t7004-tag.sh b/t/t7004-tag.sh\n> @@ -452,6 +452,23 @@ test_expect_success \\\n> +get_tag_header annotated-tag-edit $commit commit $time >expect\n> +echo \"An edited message\" >>expect\n> +test_expect_success 'set up editor' '\n> +       cat >editor <<-\\EOF &&\n> +       #!/bin/sh\n> +       sed -e \"s/A message/An edited message/g\" <\"$1\" >\"$1-\"\n> +       mv \"$1-\" \"$1\"\n> +       EOF\n> +       chmod 755 editor\n\nIf you use write_script() to create the fake editor, then it supplies\nthe #!/bin/sh line for you and does the 'chmod', so you only need to\nsupply the actual script payload. Also, other \"editors\" in this test\nfile are named \"fakeeditor\", so perhaps follow suit.\n\n    write_script fakeeditor <<-\\EOF\n        sed -e \"s/A message/An edited message/g\" <\"$1\" >\"$1-\"\n        mv \"$1-\" \"$1\"\n    EOF\n"},{"id":"338016","messageId":"fb3387f9-a341-c4dc-fa37-581229fb2c1d@suse.de","threadId":"47733","inReplyTo":"CAPig+cTFsp60KB+quuytW_nV2crLcjRV-PYN-3bO7tRY0_xu6w@mail.gmail.com","subject":"Re: [PATCH] tag: add --edit option","fromName":"Nicolas Morey-Chaisemartin","fromEmail":"nmoreychaisemartin@suse.de","sentAt":"2018-02-01T10:34:00Z","receivedAt":"2018-02-01T10:34:13Z","isPatch":true,"sender":{"key":"nmoreychaisemartin@suse.de","avatar":"https://gravatar.com/avatar/5546322ccb9067f56b6939d9d5c758a40cab5b978b1379fd6ec8ab9b8a6a12b1?d=mp&s=160"},"body":"\n\nLe 01/02/2018 à 11:16, Eric Sunshine a écrit :\n> On Thu, Feb 1, 2018 at 4:49 AM, Nicolas Morey-Chaisemartin\n> <nmoreychaisemartin@suse.com> wrote:\n>> Add a --edit option whichs allows modifying the messages provided by -m or -F,\n>> the same way git commit --edit does.\n>>\n>> Signed-off-by: Nicolas Morey-Chaisemartin <NMoreyChaisemartin@suse.com>\n>> ---\n>> diff --git a/builtin/tag.c b/builtin/tag.c\n>> @@ -224,7 +225,7 @@ static void create_tag(const struct object_id *object, const char *tag,\n>> -       if (!opt->message_given) {\n>> +       if (!opt->message_given || opt->use_editor) {\n>>\n>> -               if (!is_null_oid(prev)) {\n>> +               if (opt->message_given) {\n>> +                       write_or_die(fd, buf->buf, buf->len);\n>> +                       strbuf_reset(buf);\n>> +               } else if (!is_null_oid(prev)) {\n>>                         write_tag_body(fd, prev);\n>>                 } else {\n> A little below this change is where launch_editor() is actually\n> invoked. If it fails for some reason, it prints:\n>\n>     Please supply the message using either -m or -F option.\n>\n> which seems a bit counterintuitive if the user *did* specify one of\n> those options along with --edit. I wonder if that message needs to be\n> adjusted.\n>\nYes I'll fix this.\n\n>> diff --git a/t/t7004-tag.sh b/t/t7004-tag.sh\n>> @@ -452,6 +452,23 @@ test_expect_success \\\n>> +get_tag_header annotated-tag-edit $commit commit $time >expect\n>> +echo \"An edited message\" >>expect\n>> +test_expect_success 'set up editor' '\n>> +       cat >editor <<-\\EOF &&\n>> +       #!/bin/sh\n>> +       sed -e \"s/A message/An edited message/g\" <\"$1\" >\"$1-\"\n>> +       mv \"$1-\" \"$1\"\n>> +       EOF\n>> +       chmod 755 editor\n> If you use write_script() to create the fake editor, then it supplies\n> the #!/bin/sh line for you and does the 'chmod', so you only need to\n> supply the actual script payload. Also, other \"editors\" in this test\n> file are named \"fakeeditor\", so perhaps follow suit.\n>\n>     write_script fakeeditor <<-\\EOF\n>         sed -e \"s/A message/An edited message/g\" <\"$1\" >\"$1-\"\n>         mv \"$1-\" \"$1\"\n>     EOF\n>\nI dumbly copied the test from commit --edit as it was my reference.\nI'll fix the names and switch to write_script.\n\nThanks\n\nNicolas\n"},{"id":"338018","messageId":"bbc03595-cb31-63b8-3f4c-cfa04bb9ff27@suse.de","threadId":"47733","inReplyTo":"fb3387f9-a341-c4dc-fa37-581229fb2c1d@suse.de","subject":"Re: [PATCH] tag: add --edit option","fromName":"Nicolas Morey-Chaisemartin","fromEmail":"nmoreychaisemartin@suse.de","sentAt":"2018-02-01T10:43:03Z","receivedAt":"2018-02-01T10:43:09Z","isPatch":true,"sender":{"key":"nmoreychaisemartin@suse.de","avatar":"https://gravatar.com/avatar/5546322ccb9067f56b6939d9d5c758a40cab5b978b1379fd6ec8ab9b8a6a12b1?d=mp&s=160"},"body":"\n\nLe 01/02/2018 à 11:34, Nicolas Morey-Chaisemartin a écrit :\n>\n> Le 01/02/2018 à 11:16, Eric Sunshine a écrit :\n>> On Thu, Feb 1, 2018 at 4:49 AM, Nicolas Morey-Chaisemartin\n>> <nmoreychaisemartin@suse.com> wrote:\n>>> Add a --edit option whichs allows modifying the messages provided by -m or -F,\n>>> the same way git commit --edit does.\n>>>\n>>> Signed-off-by: Nicolas Morey-Chaisemartin <NMoreyChaisemartin@suse.com>\n>>> ---\n>>> diff --git a/builtin/tag.c b/builtin/tag.c\n>>> @@ -224,7 +225,7 @@ static void create_tag(const struct object_id *object, const char *tag,\n>>> -       if (!opt->message_given) {\n>>> +       if (!opt->message_given || opt->use_editor) {\n>>>\n>>> -               if (!is_null_oid(prev)) {\n>>> +               if (opt->message_given) {\n>>> +                       write_or_die(fd, buf->buf, buf->len);\n>>> +                       strbuf_reset(buf);\n>>> +               } else if (!is_null_oid(prev)) {\n>>>                         write_tag_body(fd, prev);\n>>>                 } else {\n>> A little below this change is where launch_editor() is actually\n>> invoked. If it fails for some reason, it prints:\n>>\n>>     Please supply the message using either -m or -F option.\n>>\n>> which seems a bit counterintuitive if the user *did* specify one of\n>> those options along with --edit. I wonder if that message needs to be\n>> adjusted.\n>>\n> Yes I'll fix this.\nI just checked what commit.c does and it seems to behave as my patch:\n        if (launch_editor(git_path_commit_editmsg(), NULL, env.argv)) {\n            fprintf(stderr,\n            _(\"Please supply the message using either -m or -F option.\\n\"));\n            exit(1);\n        }\n\n\nTo be honest the message is not that clear either.\nIf I'm reading launch_editor right most (or all) its falire are du to a failure to launch the editor or the editor crashed/exited with an error.\nIn this case, I wouldn't advise the user to use -m or -F but to fix its editor.\n\nNicolas\n"},{"id":"338019","messageId":"CAPig+cTEoM3qYRN6j=zSVv1LPx_ggVuxqTMMK0SpjtYEqOiBMA@mail.gmail.com","threadId":"47733","inReplyTo":"bbc03595-cb31-63b8-3f4c-cfa04bb9ff27@suse.de","subject":"Re: [PATCH] tag: add --edit option","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2018-02-01T10:56:34Z","receivedAt":"2018-02-01T10:56:40Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Thu, Feb 1, 2018 at 5:43 AM, Nicolas Morey-Chaisemartin\n<NMoreyChaisemartin@suse.de> wrote:\n> Le 01/02/2018 à 11:34, Nicolas Morey-Chaisemartin a écrit :\n>> Le 01/02/2018 à 11:16, Eric Sunshine a écrit :\n>>> A little below this change is where launch_editor() is actually\n>>> invoked. If it fails for some reason, it prints:\n>>>\n>>>     Please supply the message using either -m or -F option.\n>>>\n>>> which seems a bit counterintuitive if the user *did* specify one of\n>>> those options along with --edit. I wonder if that message needs to be\n>>> adjusted.\n>>>\n>> Yes I'll fix this.\n> I just checked what commit.c does and it seems to behave as my patch:\n>         if (launch_editor(git_path_commit_editmsg(), NULL, env.argv)) {\n>             fprintf(stderr,\n>             _(\"Please supply the message using either -m or -F option.\\n\"));\n>\n> To be honest the message is not that clear either.\n> If I'm reading launch_editor right most (or all) its falire are du to a failure to launch the editor or the editor crashed/exited with an error.\n> In this case, I wouldn't advise the user to use -m or -F but to fix its editor.\n\nIndeed, I also looked at the implementation of launch_editor(), and my\n\"wondering\" about whether the message needed adjustment was just that.\nThe message seems somewhat counterintuitive in this case, but I didn't\nnecessarily have a better suggestion. A valid response, therefore,\nmight be to punt on it and leave that change for the future, or\nperhaps take it on as a second patch which adjusts the message in both\ncommands. I don't have strong feelings about it at this time.\n"},{"id":"338030","messageId":"4929bb41-54e7-4ba4-459f-e0d0649a14bf@suse.de","threadId":"47733","inReplyTo":"CAPig+cTEoM3qYRN6j=zSVv1LPx_ggVuxqTMMK0SpjtYEqOiBMA@mail.gmail.com","subject":"Re: [PATCH] tag: add --edit option","fromName":"Nicolas Morey-Chaisemartin","fromEmail":"nmoreychaisemartin@suse.de","sentAt":"2018-02-01T14:05:04Z","receivedAt":"2018-02-01T14:05:23Z","isPatch":true,"sender":{"key":"nmoreychaisemartin@suse.de","avatar":"https://gravatar.com/avatar/5546322ccb9067f56b6939d9d5c758a40cab5b978b1379fd6ec8ab9b8a6a12b1?d=mp&s=160"},"body":"\n\nLe 01/02/2018 à 11:56, Eric Sunshine a écrit :\n> On Thu, Feb 1, 2018 at 5:43 AM, Nicolas Morey-Chaisemartin\n> <NMoreyChaisemartin@suse.de> wrote:\n>> Le 01/02/2018 à 11:34, Nicolas Morey-Chaisemartin a écrit :\n>>> Le 01/02/2018 à 11:16, Eric Sunshine a écrit :\n>>>> A little below this change is where launch_editor() is actually\n>>>> invoked. If it fails for some reason, it prints:\n>>>>\n>>>>     Please supply the message using either -m or -F option.\n>>>>\n>>>> which seems a bit counterintuitive if the user *did* specify one of\n>>>> those options along with --edit. I wonder if that message needs to be\n>>>> adjusted.\n>>>>\n>>> Yes I'll fix this.\n>> I just checked what commit.c does and it seems to behave as my patch:\n>>         if (launch_editor(git_path_commit_editmsg(), NULL, env.argv)) {\n>>             fprintf(stderr,\n>>             _(\"Please supply the message using either -m or -F option.\\n\"));\n>>\n>> To be honest the message is not that clear either.\n>> If I'm reading launch_editor right most (or all) its falire are du to a failure to launch the editor or the editor crashed/exited with an error.\n>> In this case, I wouldn't advise the user to use -m or -F but to fix its editor.\n> Indeed, I also looked at the implementation of launch_editor(), and my\n> \"wondering\" about whether the message needed adjustment was just that.\n> The message seems somewhat counterintuitive in this case, but I didn't\n> necessarily have a better suggestion. A valid response, therefore,\n> might be to punt on it and leave that change for the future, or\n> perhaps take it on as a second patch which adjusts the message in both\n> commands. I don't have strong feelings about it at this time.\n\nIt seems all the error paths from launch_editor have an error message.\nA simple \"Editor failure, cancelling {commit, tag}\" would probably be a better error message.\nI'll post another series for that.\n"},{"id":"338031","messageId":"0157dde9-4450-6528-31a5-2a3f95e2afec@ramsayjones.plus.com","threadId":"47733","inReplyTo":"450140f4-d410-4f1a-e5c1-c56d345a7f7c@suse.com","subject":"Re: [PATCH] tag: add --edit option","fromName":"Ramsay Jones","fromEmail":"ramsay@ramsayjones.plus.com","sentAt":"2018-02-01T15:25:49Z","receivedAt":"2018-02-01T15:25:58Z","isPatch":true,"sender":{"key":"ramsay@ramsayjones.plus.com","avatar":"https://avatars.githubusercontent.com/u/33702710?v=4"},"body":"\n\nOn 01/02/18 09:49, Nicolas Morey-Chaisemartin wrote:\n> Add a --edit option whichs allows modifying the messages provided by -m or -F,\n> the same way git commit --edit does.\n> \n> Signed-off-by: Nicolas Morey-Chaisemartin <NMoreyChaisemartin@suse.com>\n> ---\n>  Documentation/git-tag.txt |  6 ++++++\n>  builtin/tag.c             | 11 +++++++++--\n>  t/t7004-tag.sh            | 34 ++++++++++++++++++++++++++++++++++\n>  3 files changed, 49 insertions(+), 2 deletions(-)\n> \n> diff --git a/Documentation/git-tag.txt b/Documentation/git-tag.txt\n> index 956fc019f984..b9e5a993bea0 100644\n> --- a/Documentation/git-tag.txt\n> +++ b/Documentation/git-tag.txt\n> @@ -167,6 +167,12 @@ This option is only applicable when listing tags without annotation lines.\n>  \tImplies `-a` if none of `-a`, `-s`, or `-u <keyid>`\n>  \tis given.\n>  \n> +-e::\n> +--edit::\n> +\tThe message taken from file with `-F` and command line with\n> +\t`-m` are usually used as the tag message unmodified.\n> +\tThis option lets you further edit the message taken from these sources.\n> +\n>  --cleanup=<mode>::\n>  \tThis option sets how the tag message is cleaned up.\n>  \tThe  '<mode>' can be one of 'verbatim', 'whitespace' and 'strip'.  The\n> diff --git a/builtin/tag.c b/builtin/tag.c\n> index a7e6a5b0f234..91c60829d5f9 100644\n> --- a/builtin/tag.c\n> +++ b/builtin/tag.c\n> @@ -194,6 +194,7 @@ static int build_tag_object(struct strbuf *buf, int sign, struct object_id *resu\n>  \n>  struct create_tag_options {\n>  \tunsigned int message_given:1;\n> +\tunsigned int use_editor:1;\n>  \tunsigned int sign;\n>  \tenum {\n>  \t\tCLEANUP_NONE,\n> @@ -224,7 +225,7 @@ static void create_tag(const struct object_id *object, const char *tag,\n>  \t\t    tag,\n>  \t\t    git_committer_info(IDENT_STRICT));\n>  \n> -\tif (!opt->message_given) {\n> +\tif (!opt->message_given || opt->use_editor) {\n>  \t\tint fd;\n>  \n>  \t\t/* write the template message before editing: */\n> @@ -233,7 +234,10 @@ static void create_tag(const struct object_id *object, const char *tag,\n>  \t\tif (fd < 0)\n>  \t\t\tdie_errno(_(\"could not create file '%s'\"), path);\n>  \n> -\t\tif (!is_null_oid(prev)) {\n> +\t\tif (opt->message_given) {\n> +\t\t\twrite_or_die(fd, buf->buf, buf->len);\n> +\t\t\tstrbuf_reset(buf);\n> +\t\t} else if (!is_null_oid(prev)) {\n>  \t\t\twrite_tag_body(fd, prev);\n>  \t\t} else {\n>  \t\t\tstruct strbuf buf = STRBUF_INIT;\n> @@ -372,6 +376,7 @@ int cmd_tag(int argc, const char **argv, const char *prefix)\n>  \tstatic struct ref_sorting *sorting = NULL, **sorting_tail = &sorting;\n>  \tstruct ref_format format = REF_FORMAT_INIT;\n>  \tint icase = 0;\n> +\tint edit_flag = 0;\n>  \tstruct option options[] = {\n>  \t\tOPT_CMDMODE('l', \"list\", &cmdmode, N_(\"list tag names\"), 'l'),\n>  \t\t{ OPTION_INTEGER, 'n', NULL, &filter.lines, N_(\"n\"),\n> @@ -386,6 +391,7 @@ int cmd_tag(int argc, const char **argv, const char *prefix)\n>  \t\tOPT_CALLBACK('m', \"message\", &msg, N_(\"message\"),\n>  \t\t\t     N_(\"tag message\"), parse_msg_arg),\n>  \t\tOPT_FILENAME('F', \"file\", &msgfile, N_(\"read message from file\")),\n> +\t\tOPT_BOOL('e', \"edit\", &edit_flag, N_(\"force edit of commit\")),\n\ns/commit/tag message/ ?\n\nATB,\nRamsay Jones\n\n"}]}