{"thread":{"id":"34787","subject":"[RFC/PATCH] status: introduce status.displayCommentChar to disable display of #","startedAt":"2013-08-28T08:32:32Z","lastAt":"2013-08-31T00:00:20Z","messageCount":21,"participants":["Matthieu Moy","Johannes Sixt","Junio C Hamano","Jeff King","Jens Lehmann","David Aguilar","Jonathan Nieder","brian m. carlson"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"226082","messageId":"1377678752-16302-1-git-send-email-Matthieu.Moy@imag.fr","threadId":"34787","inReplyTo":null,"subject":"[RFC/PATCH] status: introduce status.displayCommentChar to disable display of #","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2013-08-28T08:32:32Z","receivedAt":"2013-08-28T08:32:32Z","isPatch":true,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"Historically, \"git status\" needed to prefix each output line with '#' so\nthat the output could be added as comment to the commit message. This\nprefix comment has no real purpose when \"git status\" is ran from the\ncommand-line, and this may distract users from the real content.\n\nAllow the user to disable this prefix comment. In the long run, if users\nlike the non-prefix output, it may make sense to flip the default value\nto true.\n\nObviously, status.displayCommentChar applies to \"git status\" but is\nignored by \"git commit\", so the status is still commented in\nCOMMIT_EDITMSG.\n\nSigned-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>\n---\nAs a beginner (long ago), I found this comment-prefixed output really\nweird. I got used to it, so it stopped bugging me and I didn't do\nanything to fix it.\n\n Documentation/config.txt |  5 +++++\n builtin/commit.c         |  5 +++++\n t/t7508-status.sh        | 20 ++++++++++++++++++++\n wt-status.c              | 26 +++++++++++++++++++-------\n wt-status.h              |  1 +\n 5 files changed, 50 insertions(+), 7 deletions(-)\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex ec57a15..dacf4b9 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -2118,6 +2118,11 @@ status.branch::\n \tSet to true to enable --branch by default in linkgit:git-status[1].\n \tThe option --no-branch takes precedence over this variable.\n \n+status.displayCommentChar::\n+\tIf set to false, linkgit:git-status[1] will not prefix each\n+\tline with the comment char (`core.commentchar`, i.e. `#` by\n+\tdefault). Defaults to true.\n+\n status.showUntrackedFiles::\n \tBy default, linkgit:git-status[1] and linkgit:git-commit[1] show\n \tfiles which are not currently tracked by Git. Directories which\ndiff --git a/builtin/commit.c b/builtin/commit.c\nindex 10acc53..6d6b9d2 100644\n--- a/builtin/commit.c\n+++ b/builtin/commit.c\n@@ -1182,6 +1182,10 @@ static int git_status_config(const char *k, const char *v, void *cb)\n \t\ts->use_color = git_config_colorbool(k, v);\n \t\treturn 0;\n \t}\n+\tif (!strcmp(k, \"status.displaycommentchar\")) {\n+\t\ts->display_comment_char = git_config_bool(k, v);\n+\t\treturn 0;\n+\t}\n \tif (!prefixcmp(k, \"status.color.\") || !prefixcmp(k, \"color.status.\")) {\n \t\tint slot = parse_status_slot(k, 13);\n \t\tif (slot < 0)\n@@ -1496,6 +1500,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)\n \tgitmodules_config();\n \tgit_config(git_commit_config, &s);\n \tstatus_format = STATUS_FORMAT_NONE; /* Ignore status.short */\n+\ts.display_comment_char = 1; /* Ignore status.displayCommentChar */\n \tdetermine_whence(&s);\n \ts.colopts = 0;\n \ndiff --git a/t/t7508-status.sh b/t/t7508-status.sh\nindex ac3d0fe..7736426 100755\n--- a/t/t7508-status.sh\n+++ b/t/t7508-status.sh\n@@ -113,6 +113,26 @@ test_expect_success 'status (2)' '\n \ttest_i18ncmp expect output\n '\n \n+test_expect_success 'status with status.displayCommentChar=false' '\n+\t\"$PERL_PATH\" -pi -e \"s/^\\# //; s/^\\#$//; s/^#\\t/\\t/\" expect &&\n+\tgit -c status.displayCommentChar=false status >output &&\n+\ttest_i18ncmp expect output\n+'\n+\n+test_expect_success 'commit ignores status.displayCommentChar=false in COMMIT_EDITMSG' '\n+\tcat >.git/editor <<-\\EOF &&\n+\t#! /bin/sh\n+\tcp \"$1\" output\n+EOF\n+\tchmod 755 .git/editor &&\n+\t(\n+\t\tEDITOR=.git/editor &&\n+\t\texport EDITOR &&\n+\t\ttest_must_fail git commit\n+\t) &&\n+\t! grep \"^[^#]\" output\n+'\n+\n cat >expect <<\\EOF\n # On branch master\n # Changes to be committed:\ndiff --git a/wt-status.c b/wt-status.c\nindex cb24f1f..765599d 100644\n--- a/wt-status.c\n+++ b/wt-status.c\n@@ -45,9 +45,11 @@ static void status_vprintf(struct wt_status *s, int at_bol, const char *color,\n \n \tstrbuf_vaddf(&sb, fmt, ap);\n \tif (!sb.len) {\n-\t\tstrbuf_addch(&sb, comment_line_char);\n-\t\tif (!trail)\n-\t\t\tstrbuf_addch(&sb, ' ');\n+\t\tif (s->display_comment_char) {\n+\t\t\tstrbuf_addch(&sb, comment_line_char);\n+\t\t\tif (!trail)\n+\t\t\t\tstrbuf_addch(&sb, ' ');\n+\t\t}\n \t\tcolor_print_strbuf(s->fp, color, &sb);\n \t\tif (trail)\n \t\t\tfprintf(s->fp, \"%s\", trail);\n@@ -58,7 +60,7 @@ static void status_vprintf(struct wt_status *s, int at_bol, const char *color,\n \t\teol = strchr(line, '\\n');\n \n \t\tstrbuf_reset(&linebuf);\n-\t\tif (at_bol) {\n+\t\tif (at_bol && s->display_comment_char) {\n \t\t\tstrbuf_addch(&linebuf, comment_line_char);\n \t\t\tif (*line != '\\n' && *line != '\\t')\n \t\t\t\tstrbuf_addch(&linebuf, ' ');\n@@ -128,6 +130,7 @@ void wt_status_prepare(struct wt_status *s)\n \ts->untracked.strdup_strings = 1;\n \ts->ignored.strdup_strings = 1;\n \ts->show_branch = -1;  /* unspecified */\n+\ts->display_comment_char = 1;\n }\n \n static void wt_status_print_unmerged_header(struct wt_status *s)\n@@ -774,12 +777,21 @@ static void wt_status_print_tracking(struct wt_status *s)\n \tif (!format_tracking_info(branch, &sb))\n \t\treturn;\n \n+\tchar comment_line_string[3];\n+\tint i = 0;\n+\tif (s->display_comment_char) {\n+\t\tcomment_line_string[i++] = comment_line_char;\n+\t\tcomment_line_string[i++] = ' ';\n+\t}\n+\tcomment_line_string[i] = '\\0';\n+\n \tfor (cp = sb.buf; (ep = strchr(cp, '\\n')) != NULL; cp = ep + 1)\n \t\tcolor_fprintf_ln(s->fp, color(WT_STATUS_HEADER, s),\n-\t\t\t\t \"%c %.*s\", comment_line_char,\n+\t\t\t\t \"%s%.*s\", comment_line_string,\n \t\t\t\t (int)(ep - cp), cp);\n-\tcolor_fprintf_ln(s->fp, color(WT_STATUS_HEADER, s), \"%c\",\n-\t\t\t comment_line_char);\n+\tif (s->display_comment_char)\n+\t\tcolor_fprintf_ln(s->fp, color(WT_STATUS_HEADER, s), \"%c\",\n+\t\t\t\t comment_line_char);\n }\n \n static int has_unmerged(struct wt_status *s)\ndiff --git a/wt-status.h b/wt-status.h\nindex fb7152e..ac02c64 100644\n--- a/wt-status.h\n+++ b/wt-status.h\n@@ -50,6 +50,7 @@ struct wt_status {\n \tenum commit_whence whence;\n \tint nowarn;\n \tint use_color;\n+\tint display_comment_char;\n \tint relative_paths;\n \tint submodule_summary;\n \tint show_ignored_files;\n-- \n1.8.4.9.g95f16b1\n"},{"id":"226084","messageId":"521DD8EC.6050800@viscovery.net","threadId":"34787","inReplyTo":"1377678752-16302-1-git-send-email-Matthieu.Moy@imag.fr","subject":"Re: [RFC/PATCH] status: introduce status.displayCommentChar to disable display of #","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2013-08-28T11:03:08Z","receivedAt":"2013-08-28T11:03:08Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 8/28/2013 10:32, schrieb Matthieu Moy:\n> Historically, \"git status\" needed to prefix each output line with '#' so\n> that the output could be added as comment to the commit message. This\n> prefix comment has no real purpose when \"git status\" is ran from the\n> command-line, and this may distract users from the real content.\n> \n> Allow the user to disable this prefix comment. In the long run, if users\n> like the non-prefix output, it may make sense to flip the default value\n> to true.\n> \n> Obviously, status.displayCommentChar applies to \"git status\" but is\n> ignored by \"git commit\", so the status is still commented in\n> COMMIT_EDITMSG.\n> \n> Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>\n> ---\n> As a beginner (long ago), I found this comment-prefixed output really\n> weird. I got used to it,...\n\nYou have my sympathy.\n\nHow does your solution work when dirty submodules are involved and\nsubmodule status is included?\n\n> +test_expect_success 'status with status.displayCommentChar=false' '\n> +\t\"$PERL_PATH\" -pi -e \"s/^\\# //; s/^\\#$//; s/^#\\t/\\t/\" expect &&\n\nPerl's -i does not work on Windows when no backup file extension is given.\nTherefore, please use a temporary file or \"... -pi.bak ...\"\n\n> +\tgit -c status.displayCommentChar=false status >output &&\n> +\ttest_i18ncmp expect output\n> +'\n\n-- Hannes\n"},{"id":"226085","messageId":"vpqhaeaasuf.fsf@anie.imag.fr","threadId":"34787","inReplyTo":"521DD8EC.6050800@viscovery.net","subject":"Re: [RFC/PATCH] status: introduce status.displayCommentChar to disable display of #","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2013-08-28T12:43:36Z","receivedAt":"2013-08-28T12:43:36Z","isPatch":true,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Johannes Sixt <j.sixt@viscovery.net> writes:\n\n> How does your solution work when dirty submodules are involved and\n> submodule status is included?f\n\nBadly ;-).\n\nI didn't notice the subcommand call for submodules summary. It's a bit\nmore tricky to get right, as the \"git sumbodule summary --for-status\"\ncall did not know whether it was called from commit or from status.\n\nI fixed this by adding a --[no-]-display-comment-char to git submodule\nsummary.\n\n>> +test_expect_success 'status with status.displayCommentChar=false' '\n>> +\t\"$PERL_PATH\" -pi -e \"s/^\\# //; s/^\\#$//; s/^#\\t/\\t/\" expect &&\n>\n> Perl's -i does not work on Windows when no backup file extension is given.\n> Therefore, please use a temporary file or \"... -pi.bak ...\"\n\nOK I didn't know that. I went the old good sed+mv way.\n\nNew series comming.\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"226086","messageId":"1377694024-24173-1-git-send-email-Matthieu.Moy@imag.fr","threadId":"34787","inReplyTo":"vpqhaeaasuf.fsf@anie.imag.fr","subject":"[RFC/PATCH v2 1/3] builtin/stripspace.c: fix broken indentation","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2013-08-28T12:47:02Z","receivedAt":"2013-08-28T12:47:02Z","isPatch":true,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>\n---\nI normally don't like whitespace-only patches, but the indentation was\nseriously broken here.\n\nCan safely be dropped.\n\n builtin/stripspace.c | 8 ++++----\n 1 file changed, 4 insertions(+), 4 deletions(-)\n\ndiff --git a/builtin/stripspace.c b/builtin/stripspace.c\nindex e981dfb..1259ed7 100644\n--- a/builtin/stripspace.c\n+++ b/builtin/stripspace.c\n@@ -89,11 +89,11 @@ int cmd_stripspace(int argc, const char **argv, const char *prefix)\n \n \tif (argc == 2) {\n \t\tif (!strcmp(argv[1], \"-s\") ||\n-\t\t\t!strcmp(argv[1], \"--strip-comments\")) {\n-\t\t\t strip_comments = 1;\n+\t\t    !strcmp(argv[1], \"--strip-comments\")) {\n+\t\t\tstrip_comments = 1;\n \t\t} else if (!strcmp(argv[1], \"-c\") ||\n-\t\t\t\t\t !strcmp(argv[1], \"--comment-lines\")) {\n-\t\t\t mode = COMMENT_LINES;\n+\t\t\t   !strcmp(argv[1], \"--comment-lines\")) {\n+\t\t\tmode = COMMENT_LINES;\n \t\t} else {\n \t\t\tmode = INVAL;\n \t\t}\n-- \n1.8.4.11.g9db5bc7.dirty\n"},{"id":"226087","messageId":"1377694024-24173-2-git-send-email-Matthieu.Moy@imag.fr","threadId":"34787","inReplyTo":"1377694024-24173-1-git-send-email-Matthieu.Moy@imag.fr","subject":"[RFC/PATCH v2 2/3] submodule: introduce --[no-]display-comment-char","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2013-08-28T12:47:03Z","receivedAt":"2013-08-28T12:47:03Z","isPatch":true,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>\n---\n(--for-status was undocumented, so I didn't bother documenting this either)\n\n git-submodule.sh | 20 ++++++++++++++++----\n 1 file changed, 16 insertions(+), 4 deletions(-)\n\ndiff --git a/git-submodule.sh b/git-submodule.sh\nindex 2979197..ac0fdad 100755\n--- a/git-submodule.sh\n+++ b/git-submodule.sh\n@@ -966,6 +966,7 @@ set_name_rev () {\n cmd_summary() {\n \tsummary_limit=-1\n \tfor_status=\n+\tdisplay_comment_char=t\n \tdiff_cmd=diff-index\n \n \t# parse $args after \"submodule ... summary\".\n@@ -981,6 +982,12 @@ cmd_summary() {\n \t\t--for-status)\n \t\t\tfor_status=\"$1\"\n \t\t\t;;\n+\t\t--display-comment-char)\n+\t\t\tdisplay_comment_char=t\n+\t\t\t;;\n+\t\t--no-display-comment-char)\n+\t\t\tdisplay_comment_char=\n+\t\t\t;;\n \t\t-n|--summary-limit)\n \t\t\tsummary_limit=\"$2\"\n \t\t\tisnumber \"$summary_limit\" || usage\n@@ -1151,13 +1158,18 @@ cmd_summary() {\n \t\techo\n \tdone |\n \tif test -n \"$for_status\"; then\n+\t\tif test -n \"$display_comment_char\"; then\n+\t\t\tfilter_cmd='git stripspace -c'\n+\t\telse\n+\t\t\tfilter_cmd=cat\n+\t\tfi\n \t\tif [ -n \"$files\" ]; then\n-\t\t\tgettextln \"Submodules changed but not updated:\" | git stripspace -c\n+\t\t\tgettextln \"Submodules changed but not updated:\" | $filter_cmd\n \t\telse\n-\t\t\tgettextln \"Submodule changes to be committed:\" | git stripspace -c\n+\t\t\tgettextln \"Submodule changes to be committed:\" | $filter_cmd\n \t\tfi\n-\t\tprintf \"\\n\" | git stripspace -c\n-\t\tgit stripspace -c\n+\t\tprintf \"\\n\" | $filter_cmd\n+\t\t$filter_cmd\n \telse\n \t\tcat\n \tfi\n-- \n1.8.4.11.g9db5bc7.dirty\n"},{"id":"226088","messageId":"1377694024-24173-3-git-send-email-Matthieu.Moy@imag.fr","threadId":"34787","inReplyTo":"1377694024-24173-1-git-send-email-Matthieu.Moy@imag.fr","subject":"[RFC/PATCH v2 3/3] status: introduce status.displayCommentChar to disable display of #","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2013-08-28T12:47:04Z","receivedAt":"2013-08-28T12:47:04Z","isPatch":true,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"Historically, \"git status\" needed to prefix each output line with '#' so\nthat the output could be added as comment to the commit message. This\nprefix comment has no real purpose when \"git status\" is ran from the\ncommand-line, and this may distract users from the real content.\n\nAllow the user to disable this prefix comment. In the long run, if users\nlike the non-prefix output, it may make sense to flip the default value\nto true.\n\nObviously, status.displayCommentChar applies to \"git status\" but is\nignored by \"git commit\", so the status is still commented in\nCOMMIT_EDITMSG.\n\nSigned-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>\n---\nChange since v1:\n\n* removed perl -pi use.\n\n* test and fix submodule summary.\n\n Documentation/config.txt |  5 +++++\n builtin/commit.c         |  9 +++++++++\n t/t7508-status.sh        | 43 +++++++++++++++++++++++++++++++++++++++++++\n wt-status.c              | 37 +++++++++++++++++++++++++------------\n wt-status.h              |  1 +\n 5 files changed, 83 insertions(+), 12 deletions(-)\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex ec57a15..dacf4b9 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -2118,6 +2118,11 @@ status.branch::\n \tSet to true to enable --branch by default in linkgit:git-status[1].\n \tThe option --no-branch takes precedence over this variable.\n \n+status.displayCommentChar::\n+\tIf set to false, linkgit:git-status[1] will not prefix each\n+\tline with the comment char (`core.commentchar`, i.e. `#` by\n+\tdefault). Defaults to true.\n+\n status.showUntrackedFiles::\n \tBy default, linkgit:git-status[1] and linkgit:git-commit[1] show\n \tfiles which are not currently tracked by Git. Directories which\ndiff --git a/builtin/commit.c b/builtin/commit.c\nindex 10acc53..d4cfced 100644\n--- a/builtin/commit.c\n+++ b/builtin/commit.c\n@@ -1182,6 +1182,10 @@ static int git_status_config(const char *k, const char *v, void *cb)\n \t\ts->use_color = git_config_colorbool(k, v);\n \t\treturn 0;\n \t}\n+\tif (!strcmp(k, \"status.displaycommentchar\")) {\n+\t\ts->display_comment_char = git_config_bool(k, v);\n+\t\treturn 0;\n+\t}\n \tif (!prefixcmp(k, \"status.color.\") || !prefixcmp(k, \"color.status.\")) {\n \t\tint slot = parse_status_slot(k, 13);\n \t\tif (slot < 0)\n@@ -1496,6 +1500,11 @@ int cmd_commit(int argc, const char **argv, const char *prefix)\n \tgitmodules_config();\n \tgit_config(git_commit_config, &s);\n \tstatus_format = STATUS_FORMAT_NONE; /* Ignore status.short */\n+\t/*\n+\t * Ignore status.displayCommentChar: we do need comments in\n+\t * COMMIT_EDITMSG.\n+\t */\n+\ts.display_comment_char = 1;\n \tdetermine_whence(&s);\n \ts.colopts = 0;\n \ndiff --git a/t/t7508-status.sh b/t/t7508-status.sh\nindex ac3d0fe..d0d7c4a 100755\n--- a/t/t7508-status.sh\n+++ b/t/t7508-status.sh\n@@ -113,6 +113,39 @@ test_expect_success 'status (2)' '\n \ttest_i18ncmp expect output\n '\n \n+strip_comments () {\n+\tsed \"s/^\\# //; s/^\\#$//; s/^#\\t/\\t/\" <\"$1\" >\"$1\".tmp &&\n+\trm \"$1\" && mv \"$1\".tmp \"$1\"\n+}\n+\n+test_expect_success 'status with status.displayCommentChar=false' '\n+\tstrip_comments expect &&\n+\tgit -c status.displayCommentChar=false status >output &&\n+\ttest_i18ncmp expect output\n+'\n+\n+test_expect_success 'setup fake editor' '\n+\tcat >.git/editor <<-\\EOF &&\n+\t#! /bin/sh\n+\tcp \"$1\" output\n+EOF\n+\tchmod 755 .git/editor\n+'\n+\n+commit_template_commented () {\n+\t(\n+\t\tEDITOR=.git/editor &&\n+\t\texport EDITOR &&\n+\t\t# Fails due to empty message\n+\t\ttest_must_fail git commit\n+\t) &&\n+\t! grep '^[^#]' output\n+}\n+\n+test_expect_success 'commit ignores status.displayCommentChar=false in COMMIT_EDITMSG' '\n+\tcommit_template_commented\n+'\n+\n cat >expect <<\\EOF\n # On branch master\n # Changes to be committed:\n@@ -872,6 +905,16 @@ test_expect_success 'status submodule summary' '\n \ttest_i18ncmp expect output\n '\n \n+test_expect_success 'status submodule summary with status.displayCommentChar=false' '\n+\tstrip_comments expect &&\n+\tgit -c status.displayCommentChar=false status >output &&\n+\ttest_i18ncmp expect output\n+'\n+\n+test_expect_success 'commit with submodule summary ignores displayCommentChar' '\n+\tcommit_template_commented\n+'\n+\n cat >expect <<EOF\n  M dir1/modified\n A  dir2/added\ndiff --git a/wt-status.c b/wt-status.c\nindex cb24f1f..97068d5 100644\n--- a/wt-status.c\n+++ b/wt-status.c\n@@ -45,9 +45,11 @@ static void status_vprintf(struct wt_status *s, int at_bol, const char *color,\n \n \tstrbuf_vaddf(&sb, fmt, ap);\n \tif (!sb.len) {\n-\t\tstrbuf_addch(&sb, comment_line_char);\n-\t\tif (!trail)\n-\t\t\tstrbuf_addch(&sb, ' ');\n+\t\tif (s->display_comment_char) {\n+\t\t\tstrbuf_addch(&sb, comment_line_char);\n+\t\t\tif (!trail)\n+\t\t\t\tstrbuf_addch(&sb, ' ');\n+\t\t}\n \t\tcolor_print_strbuf(s->fp, color, &sb);\n \t\tif (trail)\n \t\t\tfprintf(s->fp, \"%s\", trail);\n@@ -58,7 +60,7 @@ static void status_vprintf(struct wt_status *s, int at_bol, const char *color,\n \t\teol = strchr(line, '\\n');\n \n \t\tstrbuf_reset(&linebuf);\n-\t\tif (at_bol) {\n+\t\tif (at_bol && s->display_comment_char) {\n \t\t\tstrbuf_addch(&linebuf, comment_line_char);\n \t\t\tif (*line != '\\n' && *line != '\\t')\n \t\t\t\tstrbuf_addch(&linebuf, ' ');\n@@ -128,6 +130,7 @@ void wt_status_prepare(struct wt_status *s)\n \ts->untracked.strdup_strings = 1;\n \ts->ignored.strdup_strings = 1;\n \ts->show_branch = -1;  /* unspecified */\n+\ts->display_comment_char = 1;\n }\n \n static void wt_status_print_unmerged_header(struct wt_status *s)\n@@ -663,17 +666,18 @@ static void wt_status_print_submodule_summary(struct wt_status *s, int uncommitt\n \tchar summary_limit[64];\n \tchar index[PATH_MAX];\n \tconst char *env[] = { NULL, NULL };\n-\tconst char *argv[8];\n+\tconst char *argv[9];\n \n \tenv[0] =\tindex;\n \targv[0] =\t\"submodule\";\n \targv[1] =\t\"summary\";\n \targv[2] =\tuncommitted ? \"--files\" : \"--cached\";\n \targv[3] =\t\"--for-status\";\n-\targv[4] =\t\"--summary-limit\";\n-\targv[5] =\tsummary_limit;\n-\targv[6] =\tuncommitted ? NULL : (s->amend ? \"HEAD^\" : \"HEAD\");\n-\targv[7] =\tNULL;\n+\targv[4] =\ts->display_comment_char ? \"--display-comment-char\" : \"--no-display-comment-char\";\n+\targv[5] =\t\"--summary-limit\";\n+\targv[6] =\tsummary_limit;\n+\targv[7] =\tuncommitted ? NULL : (s->amend ? \"HEAD^\" : \"HEAD\");\n+\targv[8] =\tNULL;\n \n \tsprintf(summary_limit, \"%d\", s->submodule_summary);\n \tsnprintf(index, sizeof(index), \"GIT_INDEX_FILE=%s\", s->index_file);\n@@ -774,12 +778,21 @@ static void wt_status_print_tracking(struct wt_status *s)\n \tif (!format_tracking_info(branch, &sb))\n \t\treturn;\n \n+\tchar comment_line_string[3];\n+\tint i = 0;\n+\tif (s->display_comment_char) {\n+\t\tcomment_line_string[i++] = comment_line_char;\n+\t\tcomment_line_string[i++] = ' ';\n+\t}\n+\tcomment_line_string[i] = '\\0';\n+\n \tfor (cp = sb.buf; (ep = strchr(cp, '\\n')) != NULL; cp = ep + 1)\n \t\tcolor_fprintf_ln(s->fp, color(WT_STATUS_HEADER, s),\n-\t\t\t\t \"%c %.*s\", comment_line_char,\n+\t\t\t\t \"%s%.*s\", comment_line_string,\n \t\t\t\t (int)(ep - cp), cp);\n-\tcolor_fprintf_ln(s->fp, color(WT_STATUS_HEADER, s), \"%c\",\n-\t\t\t comment_line_char);\n+\tif (s->display_comment_char)\n+\t\tcolor_fprintf_ln(s->fp, color(WT_STATUS_HEADER, s), \"%c\",\n+\t\t\t\t comment_line_char);\n }\n \n static int has_unmerged(struct wt_status *s)\ndiff --git a/wt-status.h b/wt-status.h\nindex fb7152e..ac02c64 100644\n--- a/wt-status.h\n+++ b/wt-status.h\n@@ -50,6 +50,7 @@ struct wt_status {\n \tenum commit_whence whence;\n \tint nowarn;\n \tint use_color;\n+\tint display_comment_char;\n \tint relative_paths;\n \tint submodule_summary;\n \tint show_ignored_files;\n-- \n1.8.4.11.g9db5bc7.dirty\n"},{"id":"226106","messageId":"xmqq1u5da8dp.fsf@gitster.dls.corp.google.com","threadId":"34787","inReplyTo":"1377694024-24173-3-git-send-email-Matthieu.Moy@imag.fr","subject":"Re: [RFC/PATCH v2 3/3] status: introduce status.displayCommentChar to disable display of #","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-08-28T20:05:38Z","receivedAt":"2013-08-28T20:05:38Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Matthieu Moy <Matthieu.Moy@imag.fr> writes:\n\n> diff --git a/Documentation/config.txt b/Documentation/config.txt\n> index ec57a15..dacf4b9 100644\n> --- a/Documentation/config.txt\n> +++ b/Documentation/config.txt\n> @@ -2118,6 +2118,11 @@ status.branch::\n>  \tSet to true to enable --branch by default in linkgit:git-status[1].\n>  \tThe option --no-branch takes precedence over this variable.\n>  \n> +status.displayCommentChar::\n> +\tIf set to false, linkgit:git-status[1] will not prefix each\n> +\tline with the comment char (`core.commentchar`, i.e. `#` by\n> +\tdefault). Defaults to true.\n\nWe prefix core.commentchar followed by a single space for non-empty\nlines; is that worth mentioning, I wonder?\n\nAlso I envision that we would extend core.commentchar to be more\nthan a single character.  Is \"displayCommentChar\" still a good name\nfor this setting?\n\n\"status.omitCommentPrefix\" that defaults to false might be a better\nsetting, I suspect.  I further suspect that in the longer term, we\nmay want to consider flipping its default to true (for Git 2.0, it\nis too late).  I do not think we need these comment prefix in the\nhuman readable \"status\" output---after all, there is no line that is\nnot commented (other than \"nothing added to commit\" at the end) in\nthe current output, so the comment prefix only wastes the screen\nreal estate.\n\nWhat are our plans to help existing scripts people have written over\ntime, especially before \"status -s\" was invented, that will be\nbroken by use of this?\n\n> @@ -663,17 +666,18 @@ static void wt_status_print_submodule_summary(struct wt_status *s, int uncommitt\n>  \tchar summary_limit[64];\n>  \tchar index[PATH_MAX];\n>  \tconst char *env[] = { NULL, NULL };\n> -\tconst char *argv[8];\n> +\tconst char *argv[9];\n>  \n>  \tenv[0] =\tindex;\n>  \targv[0] =\t\"submodule\";\n>  \targv[1] =\t\"summary\";\n>  \targv[2] =\tuncommitted ? \"--files\" : \"--cached\";\n>  \targv[3] =\t\"--for-status\";\n> -\targv[4] =\t\"--summary-limit\";\n> -\targv[5] =\tsummary_limit;\n> -\targv[6] =\tuncommitted ? NULL : (s->amend ? \"HEAD^\" : \"HEAD\");\n> -\targv[7] =\tNULL;\n> +\targv[4] =\ts->display_comment_char ? \"--display-comment-char\" : \"--no-display-comment-char\";\n> +\targv[5] =\t\"--summary-limit\";\n> +\targv[6] =\tsummary_limit;\n> +\targv[7] =\tuncommitted ? NULL : (s->amend ? \"HEAD^\" : \"HEAD\");\n> +\targv[8] =\tNULL;\n\nNot strictly your fault, but we should lose these funny indent after\n\"=\" and use argv_array API here.\n"},{"id":"226108","messageId":"xmqqwqn58tkr.fsf@gitster.dls.corp.google.com","threadId":"34787","inReplyTo":"xmqq1u5da8dp.fsf@gitster.dls.corp.google.com","subject":"Re: [RFC/PATCH v2 3/3] status: introduce status.displayCommentChar to disable display of #","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-08-28T20:10:44Z","receivedAt":"2013-08-28T20:10:44Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> \"status.omitCommentPrefix\" that defaults to false might be a better\n> setting, I suspect.\n\nOr status.showCommentPrefix that defaults to true; I didn't mean to\nsay a setting that defaults to false is preferred over one that\ndefaults to true in my message.\n"},{"id":"226109","messageId":"20130828201803.GB8088@sigill.intra.peff.net","threadId":"34787","inReplyTo":"xmqq1u5da8dp.fsf@gitster.dls.corp.google.com","subject":"Re: [RFC/PATCH v2 3/3] status: introduce status.displayCommentChar to disable display of #","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2013-08-28T20:18:03Z","receivedAt":"2013-08-28T20:18:03Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Aug 28, 2013 at 01:05:38PM -0700, Junio C Hamano wrote:\n\n> What are our plans to help existing scripts people have written over\n> time, especially before \"status -s\" was invented, that will be\n> broken by use of this?\n\nI thought that our response to parsing the long output of \"git status\"\nwas always \"you are doing it wrong\". The right way has always been to\nrun the plumbing tools yourself, followed eventually by the --porcelain\nmode to \"git status\" being blessed as a convenient plumbing.\n\nI will not say that people might not do it anyway, but at what point do\nwe say \"you were warned\"?\n\n-Peff\n"},{"id":"226114","messageId":"vpq61up5y5s.fsf@anie.imag.fr","threadId":"34787","inReplyTo":"xmqq1u5da8dp.fsf@gitster.dls.corp.google.com","subject":"Re: [RFC/PATCH v2 3/3] status: introduce status.displayCommentChar to disable display of #","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2013-08-28T20:59:59Z","receivedAt":"2013-08-28T20:59:59Z","isPatch":true,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Matthieu Moy <Matthieu.Moy@imag.fr> writes:\n>\n>> diff --git a/Documentation/config.txt b/Documentation/config.txt\n>> index ec57a15..dacf4b9 100644\n>> --- a/Documentation/config.txt\n>> +++ b/Documentation/config.txt\n>> @@ -2118,6 +2118,11 @@ status.branch::\n>>  \tSet to true to enable --branch by default in linkgit:git-status[1].\n>>  \tThe option --no-branch takes precedence over this variable.\n>>  \n>> +status.displayCommentChar::\n>> +\tIf set to false, linkgit:git-status[1] will not prefix each\n>> +\tline with the comment char (`core.commentchar`, i.e. `#` by\n>> +\tdefault). Defaults to true.\n>\n> We prefix core.commentchar followed by a single space for non-empty\n> lines; is that worth mentioning, I wonder?\n\n(and sometimes # is followed by a tab)\n\nI don't think it's worth the trouble. The goal is not to document the\nformat precisely, but to explain the user how to use the variable.\n\n> Also I envision that we would extend core.commentchar to be more\n> than a single character.  Is \"displayCommentChar\" still a good name\n> for this setting?\n\nIt is as good as core.commentChar ;-).\n\nI chose the variable name to remind commentChar (after finding\ncommentChar, one can grep it and find status.displayCommentChar). I tend\nto think that it's better than omitCommentPrefix, but I can change is\npeople think it's better.\n\n> What are our plans to help existing scripts people have written over\n> time, especially before \"status -s\" was invented, that will be\n> broken by use of this?\n\nI don't know what's the best plan, but I think any sensible plan starts\nby waiting for a few releases, so that Git version not implementing\nstatus.displayCommentChar become rare enough. So we can delay the actual\nplan until next year I guess.\n\nThat said, I had an idea that may help the transition: allow \"auto\" as a\nvalue, just like we did for colors. A patch implementing this (on top of\nthe previous series) is below. Good point: \"auto\" is a safe value, as it\nwon't break scripts. There is one drawback, though: \"auto\" is not a\nreally good default value in the long run, since newcommers may wonder\nwhy there are differences between \"git status\" and \"git status | cat\".\n\nI still find this tempting, and it would make the transition so much\neasier. I would even argue to flip the default to \"auto\" for Git 2.0\nthen (after all, we didn't even wait for this to change color.ui).\n\nMaybe, later, a transition from \"auto\" to \"never\" could be done. Or\nperhaps it's not so terrible to keep auto (my \"ls\" and \"ls | cat\"\nproduce very different outputs, and it never bugged me).\n\ndiff --git a/builtin/commit.c b/builtin/commit.c\nindex d4cfced..00e9487 100644\n--- a/builtin/commit.c\n+++ b/builtin/commit.c\n@@ -163,6 +163,21 @@ static void determine_whence(struct wt_status *s)\n \t\ts->whence = whence;\n }\n \n+static void determine_comment_mode(struct wt_status *s)\n+{\n+\tif (s->display_comment_char == COMMENT_AUTO) {\n+\t\t/*\n+\t\t * determine_comment_mode is used only for cmd_status,\n+\t\t * which always prints to stdout.\n+\t\t */\n+\t\tif (isatty(1) || pager_in_use()) {\n+\t\t\ts->display_comment_char = COMMENT_NEVER;\n+\t\t} else {\n+\t\t\ts->display_comment_char = COMMENT_ALWAYS;\n+\t\t}\n+\t}\n+}\n+\n static void rollback_index_files(void)\n {\n \tswitch (commit_style) {\n@@ -1183,6 +1198,20 @@ static int git_status_config(const char *k, const char *v, void *cb)\n \t\treturn 0;\n \t}\n \tif (!strcmp(k, \"status.displaycommentchar\")) {\n+\t\tif (v) {\n+\t\t\tif (!strcasecmp(v, \"never\")) {\n+\t\t\t\ts->display_comment_char = COMMENT_NEVER;\n+\t\t\t\treturn 0;\n+\t\t\t}\n+\t\t\tif (!strcasecmp(v, \"always\")) {\n+\t\t\t\ts->display_comment_char = COMMENT_ALWAYS;\n+\t\t\t\treturn 0;\n+\t\t\t}\n+\t\t\tif (!strcasecmp(v, \"auto\")) {\n+\t\t\t\ts->display_comment_char = COMMENT_AUTO;\n+\t\t\t\treturn 0;\n+\t\t\t}\n+\t\t}\n \t\ts->display_comment_char = git_config_bool(k, v);\n \t\treturn 0;\n \t}\n@@ -1254,6 +1283,7 @@ int cmd_status(int argc, const char **argv, const char *prefix)\n \tgitmodules_config();\n \tgit_config(git_status_config, &s);\n \tdetermine_whence(&s);\n+\tdetermine_comment_mode(&s);\n \targc = parse_options(argc, argv, prefix,\n \t\t\t     builtin_status_options,\n \t\t\t     builtin_status_usage, 0);\n@@ -1504,7 +1534,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)\n \t * Ignore status.displayCommentChar: we do need comments in\n \t * COMMIT_EDITMSG.\n \t */\n-\ts.display_comment_char = 1;\n+\ts.display_comment_char = COMMENT_ALWAYS;\n \tdetermine_whence(&s);\n \ts.colopts = 0;\n \ndiff --git a/wt-status.h b/wt-status.h\nindex ac02c64..dbc706e 100644\n--- a/wt-status.h\n+++ b/wt-status.h\n@@ -40,6 +40,12 @@ struct wt_status_change_data {\n \tunsigned new_submodule_commits : 1;\n };\n \n+enum comment_mode {\n+\tCOMMENT_NEVER = 0,\n+\tCOMMENT_ALWAYS = 1,\n+\tCOMMENT_AUTO\n+};\n+\n struct wt_status {\n \tint is_initial;\n \tchar *branch;\n@@ -50,7 +56,7 @@ struct wt_status {\n \tenum commit_whence whence;\n \tint nowarn;\n \tint use_color;\n-\tint display_comment_char;\n+\tenum comment_mode display_comment_char;\n \tint relative_paths;\n \tint submodule_summary;\n \tint show_ignored_files;\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"226116","messageId":"521E6674.1010201@web.de","threadId":"34787","inReplyTo":"1377694024-24173-2-git-send-email-Matthieu.Moy@imag.fr","subject":"Re: [RFC/PATCH v2 2/3] submodule: introduce --[no-]display-comment-char","fromName":"Jens Lehmann","fromEmail":"jens.lehmann@web.de","sentAt":"2013-08-28T21:07:00Z","receivedAt":"2013-08-28T21:07:00Z","isPatch":true,"sender":{"key":"jens.lehmann@web.de","avatar":"https://avatars.githubusercontent.com/u/135220?v=4"},"body":"Am 28.08.2013 14:47, schrieb Matthieu Moy:\n> Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>\n> ---\n> (--for-status was undocumented, so I didn't bother documenting this either)\n\nThat's fine, as both if these options will - hopefully - only be used\nby wt-status.c internally.\n\nBut I'm not terribly happy about having the --for-status option in the\nsubmodule script in the first place, as I believe it should rather be\nhandled by wt-status.c itself (reading the output of submodule summary\nusing the start_command()/finish_command() combo instead of the simple\nrun_command() currently used and prepending the comment char by using\nstatus_printf() & friends for each line).\n\nHaving said that (and currently not having the time to do the above\nmyself), if we go along the route you are currently taking I'd prefer\nto only add one other to-be-obsoleted-some-time-later option to the\nsubmodule script. So what about only adding --no-display-comment-char\n(and maybe call it --drop-status-comment-char or such to make meaning\nand context a bit more obvious ;-)?\n\n>  git-submodule.sh | 20 ++++++++++++++++----\n>  1 file changed, 16 insertions(+), 4 deletions(-)\n> \n> diff --git a/git-submodule.sh b/git-submodule.sh\n> index 2979197..ac0fdad 100755\n> --- a/git-submodule.sh\n> +++ b/git-submodule.sh\n> @@ -966,6 +966,7 @@ set_name_rev () {\n>  cmd_summary() {\n>  \tsummary_limit=-1\n>  \tfor_status=\n> +\tdisplay_comment_char=t\n>  \tdiff_cmd=diff-index\n>  \n>  \t# parse $args after \"submodule ... summary\".\n> @@ -981,6 +982,12 @@ cmd_summary() {\n>  \t\t--for-status)\n>  \t\t\tfor_status=\"$1\"\n>  \t\t\t;;\n> +\t\t--display-comment-char)\n> +\t\t\tdisplay_comment_char=t\n> +\t\t\t;;\n> +\t\t--no-display-comment-char)\n> +\t\t\tdisplay_comment_char=\n> +\t\t\t;;\n>  \t\t-n|--summary-limit)\n>  \t\t\tsummary_limit=\"$2\"\n>  \t\t\tisnumber \"$summary_limit\" || usage\n> @@ -1151,13 +1158,18 @@ cmd_summary() {\n>  \t\techo\n>  \tdone |\n>  \tif test -n \"$for_status\"; then\n> +\t\tif test -n \"$display_comment_char\"; then\n> +\t\t\tfilter_cmd='git stripspace -c'\n> +\t\telse\n> +\t\t\tfilter_cmd=cat\n> +\t\tfi\n>  \t\tif [ -n \"$files\" ]; then\n> -\t\t\tgettextln \"Submodules changed but not updated:\" | git stripspace -c\n> +\t\t\tgettextln \"Submodules changed but not updated:\" | $filter_cmd\n>  \t\telse\n> -\t\t\tgettextln \"Submodule changes to be committed:\" | git stripspace -c\n> +\t\t\tgettextln \"Submodule changes to be committed:\" | $filter_cmd\n>  \t\tfi\n> -\t\tprintf \"\\n\" | git stripspace -c\n> -\t\tgit stripspace -c\n> +\t\tprintf \"\\n\" | $filter_cmd\n> +\t\t$filter_cmd\n>  \telse\n>  \t\tcat\n>  \tfi\n> \n"},{"id":"226121","messageId":"xmqqmwo18pgw.fsf@gitster.dls.corp.google.com","threadId":"34787","inReplyTo":"20130828201803.GB8088@sigill.intra.peff.net","subject":"Re: [RFC/PATCH v2 3/3] status: introduce status.displayCommentChar to disable display of #","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-08-28T21:39:27Z","receivedAt":"2013-08-28T21:39:27Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> On Wed, Aug 28, 2013 at 01:05:38PM -0700, Junio C Hamano wrote:\n>\n>> What are our plans to help existing scripts people have written over\n>> time, especially before \"status -s\" was invented, that will be\n>> broken by use of this?\n>\n> I thought that our response to parsing the long output of \"git status\"\n> was always \"you are doing it wrong\". The right way has always been to\n> run the plumbing tools yourself, followed eventually by the --porcelain\n> mode to \"git status\" being blessed as a convenient plumbing.\n>\n> I will not say that people might not do it anyway, but at what point do\n> we say \"you were warned\"?\n\nOK, sounds good enough.\n"},{"id":"226122","messageId":"xmqqioyp8oz0.fsf@gitster.dls.corp.google.com","threadId":"34787","inReplyTo":"1377694024-24173-3-git-send-email-Matthieu.Moy@imag.fr","subject":"Re: [RFC/PATCH v2 3/3] status: introduce status.displayCommentChar to disable display of #","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-08-28T21:50:11Z","receivedAt":"2013-08-28T21:50:11Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Matthieu Moy <Matthieu.Moy@imag.fr> writes:\n\n> diff --git a/wt-status.c b/wt-status.c\n> index cb24f1f..97068d5 100644\n> --- a/wt-status.c\n> +++ b/wt-status.c\n> @@ -774,12 +778,21 @@ static void wt_status_print_tracking(struct wt_status *s)\n>  \tif (!format_tracking_info(branch, &sb))\n>  \t\treturn;\n>  \n> +\tchar comment_line_string[3];\n> +\tint i = 0;\n\ndecl-after-statement; queued with a fix to be squashed in.\n"},{"id":"226123","messageId":"xmqqeh9d8ou4.fsf@gitster.dls.corp.google.com","threadId":"34787","inReplyTo":"vpq61up5y5s.fsf@anie.imag.fr","subject":"Re: [RFC/PATCH v2 3/3] status: introduce status.displayCommentChar to disable display of #","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-08-28T21:53:07Z","receivedAt":"2013-08-28T21:53:07Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:\n\n> Junio C Hamano <gitster@pobox.com> writes:\n>\n>> Matthieu Moy <Matthieu.Moy@imag.fr> writes:\n>>\n>>> diff --git a/Documentation/config.txt b/Documentation/config.txt\n>>> index ec57a15..dacf4b9 100644\n>>> --- a/Documentation/config.txt\n>>> +++ b/Documentation/config.txt\n>>> @@ -2118,6 +2118,11 @@ status.branch::\n>>>  \tSet to true to enable --branch by default in linkgit:git-status[1].\n>>>  \tThe option --no-branch takes precedence over this variable.\n>>>  \n>>> +status.displayCommentChar::\n>>> +\tIf set to false, linkgit:git-status[1] will not prefix each\n>>> +\tline with the comment char (`core.commentchar`, i.e. `#` by\n>>> +\tdefault). Defaults to true.\n>>\n>> We prefix core.commentchar followed by a single space for non-empty\n>> lines; is that worth mentioning, I wonder?\n>\n> (and sometimes # is followed by a tab)\n>\n> I don't think it's worth the trouble. The goal is not to document the\n> format precisely, but to explain the user how to use the variable.\n>\n>> Also I envision that we would extend core.commentchar to be more\n>> than a single character.  Is \"displayCommentChar\" still a good name\n>> for this setting?\n>\n> It is as good as core.commentChar ;-).\n\nNot really; taken together with \"# has a space after it\", calling\nit \"prefix\" in the mechanism to omit it makes tons of sense.\n\n>> What are our plans to help existing scripts people have written over\n>> time, especially before \"status -s\" was invented, that will be\n>> broken by use of this?\n>\n> I don't know what's the best plan, but I think any sensible plan starts\n> by waiting for a few releases, so that Git version not implementing\n> status.displayCommentChar become rare enough. So we can delay the actual\n> plan until next year I guess.\n\nActually as Peff pointed out, we've already told number of times\nthat \"status\" output is for human consumption and scripts should not\nattempt to parse it, long before we gave them -s/--porcelain\noptions, so we are good without \"auto\".\n"},{"id":"226125","messageId":"CAJDDKr6RDiAxgUdaE5aH4-wxYRY7fKnUukX1D-t07=-_P0CZAg@mail.gmail.com","threadId":"34787","inReplyTo":"xmqqmwo18pgw.fsf@gitster.dls.corp.google.com","subject":"Re: [RFC/PATCH v2 3/3] status: introduce status.displayCommentChar to disable display of #","fromName":"David Aguilar","fromEmail":"davvid@gmail.com","sentAt":"2013-08-28T21:59:52Z","receivedAt":"2013-08-28T21:59:52Z","isPatch":true,"sender":{"key":"davvid@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13196?v=4"},"body":"On Wed, Aug 28, 2013 at 2:39 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> Jeff King <peff@peff.net> writes:\n>\n>> On Wed, Aug 28, 2013 at 01:05:38PM -0700, Junio C Hamano wrote:\n>>\n>>> What are our plans to help existing scripts people have written over\n>>> time, especially before \"status -s\" was invented, that will be\n>>> broken by use of this?\n>>\n>> I thought that our response to parsing the long output of \"git status\"\n>> was always \"you are doing it wrong\". The right way has always been to\n>> run the plumbing tools yourself, followed eventually by the --porcelain\n>> mode to \"git status\" being blessed as a convenient plumbing.\n>>\n>> I will not say that people might not do it anyway, but at what point do\n>> we say \"you were warned\"?\n>\n> OK, sounds good enough.\n\nI personally think it's a little strange for this to be configurable.\n\nI have a poor imagination and cannot imagine why it needs to be\nswitchable.  If someone switches it to \"a\" does that mean that any\ncommit message line that starts with the letter \"a\" will be filtered\nout?\n\nSpecifically, core.commentchar seems really unnecessary to me.  What\nis the benefit?\n\nI do see downsides -- folks do parse the output, they don't read the\nrelease notes, they don't know any better, but, hey, \"it works\", so\nthey'll be broken just because someone doesn't like \"#\"?\n\nWhat about hooks that write custom commit messages?  Do they need to\nstart caring about core.commentchar?\n\nCurious,\n-- \nDavid\n"},{"id":"226128","messageId":"xmqqy57l780k.fsf@gitster.dls.corp.google.com","threadId":"34787","inReplyTo":"CAJDDKr6RDiAxgUdaE5aH4-wxYRY7fKnUukX1D-t07=-_P0CZAg@mail.gmail.com","subject":"Re: [RFC/PATCH v2 3/3] status: introduce status.displayCommentChar to disable display of #","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-08-28T22:41:47Z","receivedAt":"2013-08-28T22:41:47Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"David Aguilar <davvid@gmail.com> writes:\n\n> On Wed, Aug 28, 2013 at 2:39 PM, Junio C Hamano <gitster@pobox.com> wrote:\n>> Jeff King <peff@peff.net> writes:\n>>\n>>> On Wed, Aug 28, 2013 at 01:05:38PM -0700, Junio C Hamano wrote:\n>>>\n>>>> What are our plans to help existing scripts people have written over\n>>>> time, especially before \"status -s\" was invented, that will be\n>>>> broken by use of this?\n>>>\n>>> I thought that our response to parsing the long output of \"git status\"\n>>> was always \"you are doing it wrong\". The right way has always been to\n>>> run the plumbing tools yourself, followed eventually by the --porcelain\n>>> mode to \"git status\" being blessed as a convenient plumbing.\n>>>\n>>> I will not say that people might not do it anyway, but at what point do\n>>> we say \"you were warned\"?\n>>\n>> OK, sounds good enough.\n>\n> I personally think it's a little strange for this to be configurable.\n>\n> I have a poor imagination and cannot imagine why it needs to be\n> switchable.  If someone switches it to \"a\" does that mean that any\n> commit message line that starts with the letter \"a\" will be filtered\n> out?\n>\n> Specifically, core.commentchar seems really unnecessary to me.  What\n> is the benefit?\n>\n> I do see downsides -- folks do parse the output, they don't read the\n> release notes, they don't know any better, but, hey, \"it works\", so\n> they'll be broken just because someone doesn't like \"#\"?\n>\n> What about hooks that write custom commit messages?  Do they need to\n> start caring about core.commentchar?\n\nThey are valid questions, I think, but are best asked to those who\nwanted core.commentchar configuration, not to people involved in\nthis thread.  Also unfortunately it is too late by two releases to\nask that question.\n"},{"id":"226129","messageId":"20130828231326.GA4110@google.com","threadId":"34787","inReplyTo":"1377694024-24173-3-git-send-email-Matthieu.Moy@imag.fr","subject":"Re: [RFC/PATCH v2 3/3] status: introduce status.displayCommentChar to disable display of #","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2013-08-28T23:13:26Z","receivedAt":"2013-08-28T23:13:26Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Matthieu Moy wrote:\n\n> Historically, \"git status\" needed to prefix each output line with '#' so\n> that the output could be added as comment to the commit message. This\n> prefix comment has no real purpose when \"git status\" is ran from the\n> command-line, and this may distract users from the real content.\n>\n> Allow the user to disable this prefix comment.\n\nWhy not do this unconditionally?\n\n>                                                In the long run, if users\n> like the non-prefix output, it may make sense to flip the default value\n> to true.\n\nHmm, do you mean that the configuration is to give the change-averse\nsome time to get used to the new output?  I think it would make sense\nto do it all at once (and even think that that would be less\nconfusing).\n\nThe rest of the idea and execution seem sane.\n\nThanks,\nJonathan\n"},{"id":"226138","messageId":"vpqppsx3s8d.fsf@anie.imag.fr","threadId":"34787","inReplyTo":"20130828231326.GA4110@google.com","subject":"Re: [RFC/PATCH v2 3/3] status: introduce status.displayCommentChar to disable display of #","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2013-08-29T06:50:58Z","receivedAt":"2013-08-29T06:50:58Z","isPatch":true,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Jonathan Nieder <jrnieder@gmail.com> writes:\n\n> Matthieu Moy wrote:\n>\n>>                                                In the long run, if users\n>> like the non-prefix output, it may make sense to flip the default value\n>> to true.\n>\n> Hmm, do you mean that the configuration is to give the change-averse\n> some time to get used to the new output?  I think it would make sense\n> to do it all at once (and even think that that would be less\n> confusing).\n\nThe actual reason was that I initially thought the change would be much\nmore controversial. I wanted to live with the option on for some time to\nsee how much I liked it, and allow others to do the same without forcing\nthe change.\n\nIf everybody agree that status it better without the comment, and that\nthe switch does not need a config option, then I'm fine with dropping\nthe config option.\n\nWe can also keep the config option, but document it as a transitional\noption only (\"the behavior changed in Git XXX, to keep the old behavior,\nset this to YYY\"). Then it could be status.oldStyle instead.\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"226140","messageId":"vpqeh9d3rwe.fsf@anie.imag.fr","threadId":"34787","inReplyTo":"CAJDDKr6RDiAxgUdaE5aH4-wxYRY7fKnUukX1D-t07=-_P0CZAg@mail.gmail.com","subject":"Re: [RFC/PATCH v2 3/3] status: introduce status.displayCommentChar to disable display of #","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2013-08-29T06:58:09Z","receivedAt":"2013-08-29T06:58:09Z","isPatch":true,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"David Aguilar <davvid@gmail.com> writes:\n\n> I have a poor imagination and cannot imagine why it needs to be\n> switchable.\n\nI could not either, but I found the reason in the commit message:\neff80a9fd990\n\n    Some users do want to write a line that begin with a pound sign, #,\n    in their commit log message.  Many tracking system recognise\n    a token of #<bugid> form, for example.\n    \n    The support we offer these use cases is not very friendly to the end\n    users.  They have a choice between\n    \n     - Don't do it.  Avoid such a line by rewrapping or indenting; and\n    \n     - Use --cleanup=whitespace but remove all the hint lines we add.\n    \n    Give them a way to set a custom comment char, e.g.\n    \n        $ git -c core.commentchar=\"%\" commit\n    \n    so that they do not have to do either of the two workarounds.\n\nI personnally think allowing an escape scheme (\\#) would have been\nbetter.\n\nBut as Junio said, it's too late. My change is not about commentchar\ncustomizability, but about disabling the comment in \"git status\".\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"226141","messageId":"vpq7gf53rlk.fsf@anie.imag.fr","threadId":"34787","inReplyTo":"521E6674.1010201@web.de","subject":"Re: [RFC/PATCH v2 2/3] submodule: introduce --[no-]display-comment-char","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2013-08-29T07:04:39Z","receivedAt":"2013-08-29T07:04:39Z","isPatch":true,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Jens Lehmann <Jens.Lehmann@web.de> writes:\n\n> But I'm not terribly happy about having the --for-status option in the\n> submodule script in the first place, as I believe it should rather be\n> handled by wt-status.c itself (reading the output of submodule summary\n> using the start_command()/finish_command() combo instead of the simple\n> run_command() currently used and prepending the comment char by using\n> status_printf() & friends for each line).\n\nI went the --for-status way because it's easier to do this in shell than\nin C. But I'm close to be convinced that implementing this on the\nwt-status.c side is better. I'll try a re-roll doing this when I get\ntime.\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"226385","messageId":"20130831000019.GA899703@vauxhall.crustytoothpaste.net","threadId":"34787","inReplyTo":"20130828201803.GB8088@sigill.intra.peff.net","subject":"Re: [RFC/PATCH v2 3/3] status: introduce status.displayCommentChar to disable display of #","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2013-08-31T00:00:20Z","receivedAt":"2013-08-31T00:00:20Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"On Wed, Aug 28, 2013 at 04:18:03PM -0400, Jeff King wrote:\n> On Wed, Aug 28, 2013 at 01:05:38PM -0700, Junio C Hamano wrote:\n> \n> > What are our plans to help existing scripts people have written over\n> > time, especially before \"status -s\" was invented, that will be\n> > broken by use of this?\n> \n> I thought that our response to parsing the long output of \"git status\"\n> was always \"you are doing it wrong\". The right way has always been to\n> run the plumbing tools yourself, followed eventually by the --porcelain\n> mode to \"git status\" being blessed as a convenient plumbing.\n> \n> I will not say that people might not do it anyway, but at what point do\n> we say \"you were warned\"?\n\nIt already has changed.  At cPanel, we had code that broke with a new\nversion of git because the output of git status changed between 1.7.11\nand 1.8.3.  We fixed it to use --porcelain and had no problems.\n\n-- \nbrian m. carlson / brian with sandals: Houston, Texas, US\n+1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only\nOpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187\n"}]}