{"thread":{"id":"46446","subject":"Remove help advice text from git editors for interactive rebase and reword","startedAt":"2017-07-23T10:04:02Z","lastAt":"2017-07-24T21:47:42Z","messageCount":7,"participants":["Kirill Likhodedov","Alexei Lozovsky","Junio C Hamano","Jeff King","SZEDER Gábor"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"324913","messageId":"241D60E0-1687-4DD8-A18C-CF7310DBFAEB@jetbrains.com","threadId":"46446","inReplyTo":null,"subject":"Remove help advice text from git editors for interactive rebase and reword","fromName":"Kirill Likhodedov","fromEmail":"kirill.likhodedov@jetbrains.com","sentAt":"2017-07-23T10:03:49Z","receivedAt":"2017-07-23T10:04:02Z","isPatch":false,"sender":{"key":"kirill.likhodedov@jetbrains.com","avatar":"https://gravatar.com/avatar/9fd55d2a110e8e96deb3ed7b503d7f3b9b5b1ed5ca9ef6683c15525b11b94e63?d=mp&s=160"},"body":"Hello,\n\nis it possible to remove the helping text which appears at the bottom of the Git interactive rebase editor (the one with the list of instructions), and the one which appears at the bottom of the commit editor (which appears on rewording a commit or squashing commits)? \n\nThe texts I'm talking about are:\n\n# Rebase e025896..efc3d17 onto e025896¬\n#¬\n# Commands:¬\n#  p, pick = use commit¬\n...\n\nand\n\n# Please enter the commit message for your changes. Lines starting¬\n# with '#' will be ignored, and an empty message aborts the commit.\n# Not currently on any branch.¬\n...\n\n\nIf there is no way to do it now, do you think it makes sense to provide a configuration variable for this, e.g. to introduce more advice.* config variables in addition to existing ones?\n\nMy motivation is the following: I'm improving the Git client inside of IntelliJ IDEA IDE and I would like to provide only the plain commit message text to the user (any hints can be shown separately, not inside the editor).\n\nI know I can load the original commit message myself (but I prefer not to make extra calls when possible); and I can parse and strip out the help pages (but it is not very reliable since the text may change in future), so I'd appreciate any other solution to my problem, as well.\n\nHowever I suppose that experienced command line users could also benefit from such configuration, since this helping text is intended only for newbies and is more like a noise for advanced users."},{"id":"324914","messageId":"CALhvvbbud3oTTyzErQVumgUcdSPCcfGV4D31c66-J7P-jneqbQ@mail.gmail.com","threadId":"46446","inReplyTo":"241D60E0-1687-4DD8-A18C-CF7310DBFAEB@jetbrains.com","subject":"Re: Remove help advice text from git editors for interactive rebase and reword","fromName":"Alexei Lozovsky","fromEmail":"a.lozovsky@gmail.com","sentAt":"2017-07-23T12:42:18Z","receivedAt":"2017-07-23T12:42:43Z","isPatch":false,"sender":{"key":"a.lozovsky@gmail.com","avatar":"https://gravatar.com/avatar/8bb8ff5ec366dd64bd8e08f768082934513da367ae047bcb0039292e4ed6bda5?d=mp&s=160"},"body":"On 23 July 2017 at 13:03, Kirill Likhodedov wrote:\n> Hello,\n>\n> is it possible to remove the helping text which appears at the bottom\n> of the Git interactive rebase editor (the one with the list of\n> instructions)\n\nI believe currently there is not way to do it. The interactive rebase\nis implemented in git-rebase--interactive.sh which always makes a call\nto append_todo_help to append the help text to the todo list of commits.\n\n> and the one which appears at the bottom of the commit editor (which\n> appears on rewording a commit or squashing commits)?\n\nThis one too seems to be hardcoded in builtin/commit.c.\n\n> I can parse and strip out the help pages (but it is not very reliable\n> since the text may change in future)\n\nI doubt the syntax of the interactive rebase todo list will ever change,\nso you can reliably remove all lines that are empty or start with the\n$(git config --get core.commentchar) or '#' if that's empty or 'auto'.\n\nHowever, it's harder with the commit messages during --amend as the\ncomment character is not really fixed and can be dynamically selected\nto not conflict with the characters used in the commit message if the\ncore.commentchar is set to 'auto'.\n\n> However I suppose that experienced command line users could also\n> benefit from such configuration, since this helping text is intended\n> only for newbies and is more like a noise for advanced users.\n\nWell, the text is appended to the todo list of commits, so not that it\ngets too much in the way of editing the list by humans.\n"},{"id":"324922","messageId":"xmqqshhmerf1.fsf@gitster.mtv.corp.google.com","threadId":"46446","inReplyTo":"241D60E0-1687-4DD8-A18C-CF7310DBFAEB@jetbrains.com","subject":"Re: Remove help advice text from git editors for interactive rebase and reword","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2017-07-23T22:09:54Z","receivedAt":"2017-07-23T22:10:00Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Kirill Likhodedov <kirill.likhodedov@jetbrains.com> writes:\n\n> My motivation is the following: I'm improving the Git client\n> inside of IntelliJ IDEA IDE and I would like to provide only the\n> plain commit message text to the user (any hints can be shown\n> separately, not inside the editor).\n\nWho is running \"git commit --amend\" and \"git rebase -i\" in the\nworkflow of a user of your tool?  Is it the end user who types these\ncommands to the shell command prompt, or does your tool formulate\nthe command line and does an equivalent of system(3) to run it?\n\nI am assuming that the answer is the latter in my response.\n\n> If there is no way to do it now, do you think it makes sense to\n> provide a configuration variable for this, e.g. to introduce more\n> advice.* config variables in addition to existing ones?\n\nNot at all interested, as that would mean your tool will tell its\nusers to set such a configuration variable and their interactive use\nof Git outside your tool will behave differently from other people\nwho use vanilla Git, and they will complain to us.\n\nBut I do not think adding a new command line option that only is\npassed by a tool like yours when it runs \"git rebase -i\" via\nsystem(3) equivalent would introduce such an issue, so that may be\nworkable.\n\nBut stepping back a bit, as you said in the parentheses, your tool\nwould need to grab these \"hints\" from Git, instead of having a\nseparate hardcoded hints that will go stale while the underlying Git\ncommand improves, to be able to show them \"separately\".  Which means\nto me that you would need to get the output Git would normally show\nto the end user and do your own splitting and parsing anyway.  Which\nin turn would mean that a configuration or a command line option to\nsquelch these, which would rob your tool the ability to read what\nGit would have told to your users, would be a bad idea and not a\nuseful addition to the overall system.  So...\n\n\n"},{"id":"324924","messageId":"CEDBC0C9-03F7-4536-809C-9ADB8901B722@jetbrains.com","threadId":"46446","inReplyTo":"xmqqshhmerf1.fsf@gitster.mtv.corp.google.com","subject":"Re: Remove help advice text from git editors for interactive rebase and reword","fromName":"Kirill Likhodedov","fromEmail":"kirill.likhodedov@jetbrains.com","sentAt":"2017-07-23T22:26:09Z","receivedAt":"2017-07-23T22:26:20Z","isPatch":false,"sender":{"key":"kirill.likhodedov@jetbrains.com","avatar":"https://gravatar.com/avatar/9fd55d2a110e8e96deb3ed7b503d7f3b9b5b1ed5ca9ef6683c15525b11b94e63?d=mp&s=160"},"body":"\n> On 24 Jul 2017, at 01:09 , Junio C Hamano <gitster@pobox.com> wrote:\n> \n> Who is running \"git commit --amend\" and \"git rebase -i\" in the\n> workflow of a user of your tool?  Is it the end user who types these\n> commands to the shell command prompt, or does your tool formulate\n> the command line and does an equivalent of system(3) to run it?\n> \n> I am assuming that the answer is the latter in my response.\n\nYes, it is the latter case: the tool formulates the command line and forks a process.\n\n> Not at all interested, as that would mean your tool will tell its\n> users to set such a configuration variable and their interactive use\n> of Git outside your tool will behave differently from other people\n> who use vanilla Git, and they will complain to us.\n\nThat's not true, since the tool can (and would) use the `git -c config.var=value rebase -i` syntax to set the configuration variable just for this particular command, without affecting the environment.\n\nBtw, if my proposal is so uninteresting, why the existing advice.* variables were previously introduced? I don't know the motivation, but assume that it was about making Git less wordy for experienced users. So I don't see any difference here.\n\n> But stepping back a bit, as you said in the parentheses, your tool\n> would need to grab these \"hints\" from Git, instead of having a\n> separate hardcoded hints that will go stale while the underlying Git\n> command improves, to be able to show them \"separately\".  \n\nThere is no need to call Git to get these \"hints\". They are quite obvious, well-known and can be hardcoded. However, I don't plan to use these hints anyway, since they are a bit foreign to the GUI of the tool I develop. For instance, for reword I'd like to show an editor containing just the plain commit message that the user is about to change. \n"},{"id":"324960","messageId":"20170724172335.hcigpdzt4bewlk6w@sigill.intra.peff.net","threadId":"46446","inReplyTo":"CEDBC0C9-03F7-4536-809C-9ADB8901B722@jetbrains.com","subject":"Re: Remove help advice text from git editors for interactive rebase and reword","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2017-07-24T17:23:35Z","receivedAt":"2017-07-24T17:24:07Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Jul 24, 2017 at 01:26:09AM +0300, Kirill Likhodedov wrote:\n\n> > Not at all interested, as that would mean your tool will tell its\n> > users to set such a configuration variable and their interactive use\n> > of Git outside your tool will behave differently from other people\n> > who use vanilla Git, and they will complain to us.\n> \n> That's not true, since the tool can (and would) use the `git -c\n> config.var=value rebase -i` syntax to set the configuration variable\n> just for this particular command, without affecting the environment.\n\nYes, but if you are adding a config variable that is only ever meant to\nbe used from the command line, it probably makes sense to just add a\ncommand-line option.\n\n> Btw, if my proposal is so uninteresting, why the existing advice.*\n> variables were previously introduced? I don't know the motivation, but\n> assume that it was about making Git less wordy for experienced users.\n> So I don't see any difference here.\n\nThat is exactly what advice.* is for, but it is about the _user_\ndeciding that they don't care about seeing that text. Not a tool that is\ncalling Git deciding that in one particular context, it would like to\nsuppress the hint text.\n\nSo I actually would be OK with having an advice.* option to squelch\nrebase and/or commit instructions. But only if users decide they would\nnever like to see that text. So yes, your tool could piggy-back on that\nconfig option, but it would be a slight abuse of the intent.\n\n> > But stepping back a bit, as you said in the parentheses, your tool\n> > would need to grab these \"hints\" from Git, instead of having a\n> > separate hardcoded hints that will go stale while the underlying Git\n> > command improves, to be able to show them \"separately\".  \n> \n> There is no need to call Git to get these \"hints\". They are quite\n> obvious, well-known and can be hardcoded. However, I don't plan to use\n> these hints anyway, since they are a bit foreign to the GUI of the\n> tool I develop. For instance, for reword I'd like to show an editor\n> containing just the plain commit message that the user is about to\n> change.\n\nIf this is all scripted anyway, wouldn't it be an option to just process\nthe commit message in your program?  The format is well-known, with\nhints and instructions on lines marked by core.commentChar (\"#\" by\ndefault).\n\nI'm not sure exactly of the flow in which the user sees the commit\nmessage buffer (i.e., if you are invoking the editor yourself, or if you\nare relying on git-commit to do so). But even in the latter case, you\ncan hook the editor invocation to do whatever you like. For example:\n\n  GIT_EDITOR='f() { sed -i /^#/d \"$1\"; $EDITOR \"$1\"; }; f' git commit\n\nThat allows you not only to strip out the existing instructions, but to\ninsert whatever other instructions you choose.\n\n-Peff\n"},{"id":"324968","messageId":"20170724184707.22828-1-szeder.dev@gmail.com","threadId":"46446","inReplyTo":"20170724172335.hcigpdzt4bewlk6w@sigill.intra.peff.net","subject":"Re: Remove help advice text from git editors for interactive rebase and reword","fromName":"SZEDER Gábor","fromEmail":"szeder.dev@gmail.com","sentAt":"2017-07-24T18:47:07Z","receivedAt":"2017-07-24T18:54:09Z","isPatch":false,"sender":{"key":"szeder.dev@gmail.com","avatar":"https://avatars.githubusercontent.com/u/116324?v=4"},"body":"\n> So I actually would be OK with having an advice.* option to squelch\n> rebase and/or commit instructions. But only if users decide they would\n> never like to see that text. So yes, your tool could piggy-back on that\n> config option, but it would be a slight abuse of the intent.\n\nI don't mind the advice in the interactive rebase TODO list.  It's at\nthe end of the file, nothing comes after that, so it's never in the\nway.\n\nHowever, I do care about the advices in the commit message template,\nbecause they are _between_ the commit message I'm writing and the diff\n(using commit.verbose=true) I'm writing about.  So I build git\nfor my own use with the patch below for a couple of years now, but\nnever submitted it.\n\n\nOn a related note, when committing a merge or cherry-pick the commit\nmessage templates includes this:\n\n  # It looks like you may be committing a merge.\n  # If this is not correct, please remove the file\n  #       .git/MERGE_HEAD\n  # and try again.\n\nThis text traces back almost to the dawn of time, to commit 9c065315f\n(Make \"git commit\" work correctly in the presense of a manual merge,\n2005-06-08).  Now, I can well imagine that stray MERGE_HEAD files\ncaused troubles back then, especially with those \"manual merges\"...  \nBut is it really an issue with modern git?!  I think this is long\noutdated and could be removed.\n\n\n  -- >8 --\n\nSubject: [PATCH] commit: allow suppression of commit message template advices\n\nThe commit message template includes a lot of advices:\n\n  - The default commit message template asks the user nicely to write\n    a commit message and tells about comments and how to abort.\n  - It includes some outdated hints about merges and cherry-picks.\n  - Finally, in case of 'git commit -v' it reminds about the role of\n    the scissors line separating the commit message from the diff.\n\nWhile these reminders are useful for new users, with time they learn\nwhat the score is, and experienced users might find these advices are\njust wasting a couple of lines' worth of screen real estate.\n\nMake displaying these advices configurable via the 'advice.commitMsg'\nconfig variable.\n\nSigned-off-by: SZEDER Gábor <szeder.dev@gmail.com>\n---\n Documentation/config.txt |  2 ++\n advice.c                 |  2 ++\n advice.h                 |  1 +\n builtin/commit.c         | 69 ++++++++++++++++++++++++++----------------------\n wt-status.c              | 14 +++++-----\n 5 files changed, 50 insertions(+), 38 deletions(-)\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex d5c9c4cab..29c8736b1 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -331,6 +331,8 @@ advice.*::\n \tcommitBeforeMerge::\n \t\tAdvice shown when linkgit:git-merge[1] refuses to\n \t\tmerge to avoid overwriting local changes.\n+\tcommitMsg::\n+\t\tAdvices shown in the commit message template.\n \tresolveConflict::\n \t\tAdvice shown by various commands when conflicts\n \t\tprevent the operation from being performed.\ndiff --git a/advice.c b/advice.c\nindex d81e1cb74..7851bb20c 100644\n--- a/advice.c\n+++ b/advice.c\n@@ -10,6 +10,7 @@ int advice_push_needs_force = 1;\n int advice_status_hints = 1;\n int advice_status_u_option = 1;\n int advice_commit_before_merge = 1;\n+int advice_commit_msg = 1;\n int advice_resolve_conflict = 1;\n int advice_implicit_identity = 1;\n int advice_detached_head = 1;\n@@ -31,6 +32,7 @@ static struct {\n \t{ \"statushints\", &advice_status_hints },\n \t{ \"statusuoption\", &advice_status_u_option },\n \t{ \"commitbeforemerge\", &advice_commit_before_merge },\n+\t{ \"commitmsg\", &advice_commit_msg },\n \t{ \"resolveconflict\", &advice_resolve_conflict },\n \t{ \"implicitidentity\", &advice_implicit_identity },\n \t{ \"detachedhead\", &advice_detached_head },\ndiff --git a/advice.h b/advice.h\nindex c84a44531..92c9937d6 100644\n--- a/advice.h\n+++ b/advice.h\n@@ -12,6 +12,7 @@ extern int advice_push_needs_force;\n extern int advice_status_hints;\n extern int advice_status_u_option;\n extern int advice_commit_before_merge;\n+extern int advice_commit_msg;\n extern int advice_resolve_conflict;\n extern int advice_implicit_identity;\n extern int advice_detached_head;\ndiff --git a/builtin/commit.c b/builtin/commit.c\nindex 8e9380251..ead7bf5ef 100644\n--- a/builtin/commit.c\n+++ b/builtin/commit.c\n@@ -810,38 +810,42 @@ static int prepare_to_commit(const char *index_file, const char *prefix,\n \t\tif (whence != FROM_COMMIT) {\n \t\t\tif (cleanup_mode == CLEANUP_SCISSORS)\n \t\t\t\twt_status_add_cut_line(s->fp);\n-\t\t\tstatus_printf_ln(s, GIT_COLOR_NORMAL,\n-\t\t\t    whence == FROM_MERGE\n-\t\t\t\t? _(\"\\n\"\n-\t\t\t\t\t\"It looks like you may be committing a merge.\\n\"\n-\t\t\t\t\t\"If this is not correct, please remove the file\\n\"\n-\t\t\t\t\t\"\t%s\\n\"\n-\t\t\t\t\t\"and try again.\\n\")\n-\t\t\t\t: _(\"\\n\"\n-\t\t\t\t\t\"It looks like you may be committing a cherry-pick.\\n\"\n-\t\t\t\t\t\"If this is not correct, please remove the file\\n\"\n-\t\t\t\t\t\"\t%s\\n\"\n-\t\t\t\t\t\"and try again.\\n\"),\n-\t\t\t\twhence == FROM_MERGE ?\n-\t\t\t\t\tgit_path_merge_head() :\n-\t\t\t\t\tgit_path_cherry_pick_head());\n+\t\t\tif (advice_commit_msg)\n+\t\t\t\tstatus_printf_ln(s, GIT_COLOR_NORMAL,\n+\t\t\t\t    whence == FROM_MERGE\n+\t\t\t\t\t? _(\"\\n\"\n+\t\t\t\t\t\t\"It looks like you may be committing a merge.\\n\"\n+\t\t\t\t\t\t\"If this is not correct, please remove the file\\n\"\n+\t\t\t\t\t\t\"\t%s\\n\"\n+\t\t\t\t\t\t\"and try again.\\n\")\n+\t\t\t\t\t: _(\"\\n\"\n+\t\t\t\t\t\t\"It looks like you may be committing a cherry-pick.\\n\"\n+\t\t\t\t\t\t\"If this is not correct, please remove the file\\n\"\n+\t\t\t\t\t\t\"\t%s\\n\"\n+\t\t\t\t\t\t\"and try again.\\n\"),\n+\t\t\t\t\twhence == FROM_MERGE ?\n+\t\t\t\t\t\tgit_path_merge_head() :\n+\t\t\t\t\t\tgit_path_cherry_pick_head());\n \t\t}\n \n \t\tfprintf(s->fp, \"\\n\");\n-\t\tif (cleanup_mode == CLEANUP_ALL)\n-\t\t\tstatus_printf(s, GIT_COLOR_NORMAL,\n-\t\t\t\t_(\"Please enter the commit message for your changes.\"\n-\t\t\t\t  \" Lines starting\\nwith '%c' will be ignored, and an empty\"\n-\t\t\t\t  \" message aborts the commit.\\n\"), comment_line_char);\n-\t\telse if (cleanup_mode == CLEANUP_SCISSORS && whence == FROM_COMMIT)\n+\t\tif (cleanup_mode == CLEANUP_ALL) {\n+\t\t\tif (advice_commit_msg)\n+\t\t\t\tstatus_printf(s, GIT_COLOR_NORMAL,\n+\t\t\t\t\t_(\"Please enter the commit message for your changes.\"\n+\t\t\t\t\t  \" Lines starting\\nwith '%c' will be ignored, and an empty\"\n+\t\t\t\t\t  \" message aborts the commit.\\n\"), comment_line_char);\n+\t\t} else if (cleanup_mode == CLEANUP_SCISSORS && whence == FROM_COMMIT)\n \t\t\twt_status_add_cut_line(s->fp);\n-\t\telse /* CLEANUP_SPACE, that is. */\n-\t\t\tstatus_printf(s, GIT_COLOR_NORMAL,\n-\t\t\t\t_(\"Please enter the commit message for your changes.\"\n-\t\t\t\t  \" Lines starting\\n\"\n-\t\t\t\t  \"with '%c' will be kept; you may remove them\"\n-\t\t\t\t  \" yourself if you want to.\\n\"\n-\t\t\t\t  \"An empty message aborts the commit.\\n\"), comment_line_char);\n+\t\telse /* CLEANUP_SPACE, that is. */ {\n+\t\t\tif (advice_commit_msg)\n+\t\t\t\tstatus_printf(s, GIT_COLOR_NORMAL,\n+\t\t\t\t\t_(\"Please enter the commit message for your changes.\"\n+\t\t\t\t\t  \" Lines starting\\n\"\n+\t\t\t\t\t  \"with '%c' will be kept; you may remove them\"\n+\t\t\t\t\t  \" yourself if you want to.\\n\"\n+\t\t\t\t\t  \"An empty message aborts the commit.\\n\"), comment_line_char);\n+\t\t}\n \n \t\t/*\n \t\t * These should never fail because they come from our own\n@@ -856,7 +860,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,\n \t\t\tstatus_printf_ln(s, GIT_COLOR_NORMAL,\n \t\t\t\t_(\"%s\"\n \t\t\t\t\"Author:    %.*s <%.*s>\"),\n-\t\t\t\tident_shown++ ? \"\" : \"\\n\",\n+\t\t\t\tident_shown++ || !advice_commit_msg ? \"\" : \"\\n\",\n \t\t\t\t(int)(ai.name_end - ai.name_begin), ai.name_begin,\n \t\t\t\t(int)(ai.mail_end - ai.mail_begin), ai.mail_begin);\n \n@@ -864,18 +868,19 @@ static int prepare_to_commit(const char *index_file, const char *prefix,\n \t\t\tstatus_printf_ln(s, GIT_COLOR_NORMAL,\n \t\t\t\t_(\"%s\"\n \t\t\t\t\"Date:      %s\"),\n-\t\t\t\tident_shown++ ? \"\" : \"\\n\",\n+\t\t\t\tident_shown++ || !advice_commit_msg ? \"\" : \"\\n\",\n \t\t\t\tshow_ident_date(&ai, DATE_MODE(NORMAL)));\n \n \t\tif (!committer_ident_sufficiently_given())\n \t\t\tstatus_printf_ln(s, GIT_COLOR_NORMAL,\n \t\t\t\t_(\"%s\"\n \t\t\t\t\"Committer: %.*s <%.*s>\"),\n-\t\t\t\tident_shown++ ? \"\" : \"\\n\",\n+\t\t\t\tident_shown++ || !advice_commit_msg ? \"\" : \"\\n\",\n \t\t\t\t(int)(ci.name_end - ci.name_begin), ci.name_begin,\n \t\t\t\t(int)(ci.mail_end - ci.mail_begin), ci.mail_begin);\n \n-\t\tstatus_printf_ln(s, GIT_COLOR_NORMAL, \"%s\", \"\"); /* Add new line for clarity */\n+\t\tif (ident_shown || advice_commit_msg)\n+\t\t\tstatus_printf_ln(s, GIT_COLOR_NORMAL, \"%s\", \"\"); /* Add new line for clarity */\n \n \t\tsaved_color_setting = s->use_color;\n \t\ts->use_color = 0;\ndiff --git a/wt-status.c b/wt-status.c\nindex 77c27c511..09cb24be9 100644\n--- a/wt-status.c\n+++ b/wt-status.c\n@@ -934,13 +934,15 @@ size_t wt_status_locate_end(const char *s, size_t len)\n \n void wt_status_add_cut_line(FILE *fp)\n {\n-\tconst char *explanation = _(\"Do not touch the line above.\\nEverything below will be removed.\");\n-\tstruct strbuf buf = STRBUF_INIT;\n-\n \tfprintf(fp, \"%c %s\", comment_line_char, cut_line);\n-\tstrbuf_add_commented_lines(&buf, explanation, strlen(explanation));\n-\tfputs(buf.buf, fp);\n-\tstrbuf_release(&buf);\n+\tif (advice_commit_msg) {\n+\t\tconst char *explanation = _(\"Do not touch the line above.\\nEverything below will be removed.\");\n+\t\tstruct strbuf buf = STRBUF_INIT;\n+\n+\t\tstrbuf_add_commented_lines(&buf, explanation, strlen(explanation));\n+\t\tfputs(buf.buf, fp);\n+\t\tstrbuf_release(&buf);\n+\t}\n }\n \n static void wt_longstatus_print_verbose(struct wt_status *s)\n-- \n2.14.0.rc0.88.ge338f4246\n\n"},{"id":"325007","messageId":"xmqqvamhbj7z.fsf@gitster.mtv.corp.google.com","threadId":"46446","inReplyTo":"20170724184707.22828-1-szeder.dev@gmail.com","subject":"Re: Remove help advice text from git editors for interactive rebase and reword","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2017-07-24T21:47:28Z","receivedAt":"2017-07-24T21:47:42Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"SZEDER Gábor <szeder.dev@gmail.com> writes:\n\n> While these reminders are useful for new users, with time they learn\n> what the score is, and experienced users might find these advices are\n> just wasting a couple of lines' worth of screen real estate.\n>\n> Make displaying these advices configurable via the 'advice.commitMsg'\n> config variable.\n\nIt may not be a bad idea, but the code after the patch does look\nugly with too deep indentation levels.  Can some refactoring help, I\nwonder?\n\nIs that advice.commitMsg?  It looks more like commitEditor advice to\nme but it may be just me.\n"}]}