{"thread":{"id":"15254","subject":"[PATCH] git-commit: '--no-status' Allow suppression of status summary in commit msg","startedAt":"2008-08-28T18:46:55Z","lastAt":"2008-08-29T05:49:27Z","messageCount":7,"participants":["Marcus Griep","Junio C Hamano","Alex Riesen","Marius Storm-Olsen"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"88943","messageId":"1219949215-10189-1-git-send-email-marcus@griep.us","threadId":"15254","inReplyTo":null,"subject":"[PATCH] git-commit: '--no-status' Allow suppression of status summary in commit msg","fromName":"Marcus Griep","fromEmail":"marcus@griep.us","sentAt":"2008-08-28T18:46:55Z","receivedAt":"2008-08-28T18:46:55Z","isPatch":true,"sender":{"key":"marcus@griep.us","avatar":"https://gravatar.com/avatar/0a841f2aad3f9a38c9bcf87a567c2a1751cb08924bae1bc46ee171395bcf9794?d=mp&s=160"},"body":"Currently, using any editor to edit a commit message for 'git commit'\nkicks of a 'git status' which is then included as comments to give\nthe commit author some context. However, in some situations, such as\nhaving a working tree of many hundred thousand files or on an inefficient\nfilesystem, a 'git status' can take a long time to process before\ndisplaying the commit for editing.\n\nThis patch provides an option to disable the status summary, documents it\nand provides test cases for its operation.\n\nSigned-off-by: Marcus Griep <marcus@griep.us>\n---\n Documentation/git-commit.txt |    9 +++++++++\n builtin-commit.c             |   16 +++++++++++-----\n t/t7500-commit.sh            |   32 ++++++++++++++++++++++++++++++++\n t/t7500/check-for-status     |    9 +++++++++\n 4 files changed, 61 insertions(+), 5 deletions(-)\n create mode 100755 t/t7500/check-for-status\n\ndiff --git a/Documentation/git-commit.txt b/Documentation/git-commit.txt\nindex 0e25bb8..0d5d35c 100644\n--- a/Documentation/git-commit.txt\n+++ b/Documentation/git-commit.txt\n@@ -190,6 +190,15 @@ specified.\n --quiet::\n \tSuppress commit summary message.\n \n+-S::\n+--no-status::\n+\tSuppress inclusion of the git status summary comments\n+\tthat are normally included when the commit message\n+\teditor is invoked. This can be helpful if `git status`\n+\tis an expensive operation on your machine, and you\n+\tdon't wish to incur that cost when editing a commit\n+\tmessage.\n+\n \\--::\n \tDo not interpret any more arguments as options.\n \ndiff --git a/builtin-commit.c b/builtin-commit.c\nindex 649c8be..153f436 100644\n--- a/builtin-commit.c\n+++ b/builtin-commit.c\n@@ -51,7 +51,7 @@ static const char *template_file;\n static char *edit_message, *use_message;\n static char *author_name, *author_email, *author_date;\n static int all, edit_flag, also, interactive, only, amend, signoff;\n-static int quiet, verbose, no_verify, allow_empty;\n+static int quiet, verbose, no_verify, no_status, allow_empty;\n static char *untracked_files_arg;\n /*\n  * The default commit message cleanup mode will remove the lines\n@@ -103,6 +103,7 @@ static struct option builtin_commit_options[] = {\n \tOPT_BOOLEAN(0, \"interactive\", &interactive, \"interactively add files\"),\n \tOPT_BOOLEAN('o', \"only\", &only, \"commit only specified files\"),\n \tOPT_BOOLEAN('n', \"no-verify\", &no_verify, \"bypass pre-commit hook\"),\n+\tOPT_BOOLEAN('S', \"no-status\", &no_status, \"don't include status summary comments in editor\"),\n \tOPT_BOOLEAN(0, \"amend\", &amend, \"amend previous commit\"),\n \t{ OPTION_STRING, 'u', \"untracked-files\", &untracked_files_arg, \"mode\", \"show untracked files, optional modes: all, normal, no. (Default: all)\", PARSE_OPT_OPTARG, NULL, (intptr_t)\"all\" },\n \tOPT_BOOLEAN(0, \"allow-empty\", &allow_empty, \"ok to record an empty change\"),\n@@ -590,10 +591,12 @@ static int prepare_to_commit(const char *index_file, const char *prefix)\n \t\tif (ident_shown)\n \t\t\tfprintf(fp, \"#\\n\");\n \n-\t\tsaved_color_setting = wt_status_use_color;\n-\t\twt_status_use_color = 0;\n-\t\tcommitable = run_status(fp, index_file, prefix, 1);\n-\t\twt_status_use_color = saved_color_setting;\n+\t\tif (!no_status) {\n+\t\t\tsaved_color_setting = wt_status_use_color;\n+\t\t\twt_status_use_color = 0;\n+\t\t\tcommitable = run_status(fp, index_file, prefix, 1);\n+\t\t\twt_status_use_color = saved_color_setting;\n+\t\t}\n \t} else {\n \t\tstruct rev_info rev;\n \t\tunsigned char sha1[20];\n@@ -893,6 +896,9 @@ static int git_commit_config(const char *k, const char *v, void *cb)\n \tif (!strcmp(k, \"commit.template\"))\n \t\treturn git_config_string(&template_file, k, v);\n \n+\tif (!strcmp(k, \"commit.nostatus\"))\n+\t\treturn git_config_bool_or_int(k, v, &no_status);\n+\n \treturn git_status_config(k, v, cb);\n }\n \ndiff --git a/t/t7500-commit.sh b/t/t7500-commit.sh\nindex 7ae0bd0..5579463 100755\n--- a/t/t7500-commit.sh\n+++ b/t/t7500-commit.sh\n@@ -186,4 +186,36 @@ test_expect_success 'commit message from stdin' '\n \tcommit_msg_is \"Log with foo word\"\n '\n \n+test_expect_success 'commit message in editor should include status' '\n+\techo \"Test status\" > fooey &&\n+\tgit add fooey &&\n+\t(\n+\t\ttest_set_editor \"$TEST_DIRECTORY\"/t7500/check-for-status &&\n+\t\tgit commit\n+\t) &&\n+\tcommit_msg_is \"Status\"\n+'\n+\n+test_expect_success 'no-status flag should suppress including status summary' '\n+\techo \"Test no-status\" > fooey &&\n+\tgit add fooey &&\n+\t(\n+\t\ttest_set_editor \"$TEST_DIRECTORY\"/t7500/check-for-status &&\n+\t\tgit commit --no-status\n+\t) &&\n+\tcommit_msg_is \"No Status\"\n+'\n+\n+test_expect_success 'no-status config should suppress status summary' '\n+\techo \"Test no-status config\" > fooey &&\n+\tgit add fooey &&\n+\t(\n+\t\tgit config commit.nostatus true &&\n+\t\ttest_set_editor \"$TEST_DIRECTORY\"/t7500/check-for-status &&\n+\t\tgit commit &&\n+\t\tgit config --unset commit.nostatus\n+\t) &&\n+\tcommit_msg_is \"No Status\"\n+'\n+\n test_done\ndiff --git a/t/t7500/check-for-status b/t/t7500/check-for-status\nnew file mode 100755\nindex 0000000..5c6efdf\n--- /dev/null\n+++ b/t/t7500/check-for-status\n@@ -0,0 +1,9 @@\n+#!/bin/sh\n+val=`sed -n 's/^# On branch .*$/1/p' \"$1\"`\n+cat \"$1\"\n+if [ $val ]; then\n+\techo Status >> \"$1\"\n+else\n+\techo No Status >> \"$1\"\n+fi\n+exit 0\n-- \n1.6.0.rc3.286.gd4df\n"},{"id":"88947","messageId":"7vd4jtdki8.fsf@gitster.siamese.dyndns.org","threadId":"15254","inReplyTo":"1219949215-10189-1-git-send-email-marcus@griep.us","subject":"Re: [PATCH] git-commit: '--no-status' Allow suppression of status summary in commit msg","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-08-28T19:09:35Z","receivedAt":"2008-08-28T19:09:35Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Marcus Griep <marcus@griep.us> writes:\n\n> Currently, using any editor to edit a commit message for 'git commit'\n> kicks of a 'git status' which is then included as comments to give\n> the commit author some context. However, in some situations, such as\n> having a working tree of many hundred thousand files or on an inefficient\n> filesystem,\n\nI am not interested in this particular patch, especially the part that\nhoards a short-and-nice -S flag that we could use for something more\nuseful.  Also calling the configuration variable \"nostatus\" is backwards;\nI'd name it to \"showstatus\" that defaults to \"true\" if I were doing this.\n\nYou did not mention exactly how the \"hundred thousand files on an\ninefficient filesystem\" is a problem, but if it is about listing untracked\nfiles, I thought Marius Storm-Olsen added a feature to address that with\n4bfee30 (Add an optional <mode> argument to commit/status -u|--untracked-files\noption, 2008-06-05).\n\nIf that is not still enough for your particular use case, I think you can\nhave a custom wrapper that does:\n\n\t#!/bin/sh\n\t: >.log-message-file &&\n        vi .log-message-file &&\n        git commit -F .log-message-file \"$@\" &&\n        rm -f .log-message-file \n\nwithout touching git at all.\n"},{"id":"88948","messageId":"20080828191302.GA2704@blimp.local","threadId":"15254","inReplyTo":"1219949215-10189-1-git-send-email-marcus@griep.us","subject":"Re: [PATCH] git-commit: '--no-status' Allow suppression of status summary in commit msg","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2008-08-28T19:13:02Z","receivedAt":"2008-08-28T19:13:02Z","isPatch":true,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"Marcus Griep, Thu, Aug 28, 2008 20:46:55 +0200:\n> Currently, using any editor to edit a commit message for 'git commit'\n> kicks of a 'git status' which is then included as comments to give\n> the commit author some context. However, in some situations, such as\n> having a working tree of many hundred thousand files or on an inefficient\n> filesystem, a 'git status' can take a long time to process before\n> displaying the commit for editing.\n> \n> This patch provides an option to disable the status summary, documents it\n> and provides test cases for its operation.\n\nThere is prior art:\n\n    http://thread.gmane.org/gmane.comp.version-control.git/66183/focus=66251\n\nand resolution (in the thread, somewhat unclear).\n"},{"id":"88951","messageId":"48B6FB57.5030406@griep.us","threadId":"15254","inReplyTo":"20080828191302.GA2704@blimp.local","subject":"Re: [PATCH] git-commit: '--no-status' Allow suppression of status summary in commit msg","fromName":"Marcus Griep","fromEmail":"marcus@griep.us","sentAt":"2008-08-28T19:24:07Z","receivedAt":"2008-08-28T19:24:07Z","isPatch":true,"sender":{"key":"marcus@griep.us","avatar":"https://gravatar.com/avatar/0a841f2aad3f9a38c9bcf87a567c2a1751cb08924bae1bc46ee171395bcf9794?d=mp&s=160"},"body":"Using --untracked-files=no cuts the time to display the editor from down to 12 seconds,\nso that is perfectly fine.  The patch can be ignored.  However, would config option to\nchange the default --untracked-files value be entertained?  Allowing:\n\n[commit]\n\tuntrackedfiles=no\n\nwhich defaults (as stated in the documentation for --untracked-files) to all?\n\nAlex Riesen wrote:\n> Marcus Griep, Thu, Aug 28, 2008 20:46:55 +0200:\n>> Currently, using any editor to edit a commit message for 'git commit'\n>> kicks of a 'git status' which is then included as comments to give\n>> the commit author some context. However, in some situations, such as\n>> having a working tree of many hundred thousand files or on an inefficient\n>> filesystem, a 'git status' can take a long time to process before\n>> displaying the commit for editing.\n>>\n>> This patch provides an option to disable the status summary, documents it\n>> and provides test cases for its operation.\n> \n> There is prior art:\n> \n>     http://thread.gmane.org/gmane.comp.version-control.git/66183/focus=66251\n> \n> and resolution (in the thread, somewhat unclear).\n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n\n-- \nMarcus Griep\nGPG Key ID: 0x5E968152\n——\nhttp://www.boohaunt.net\nאת.ψο´\n\n"},{"id":"88956","messageId":"20080828193423.GA6825@blimp.local","threadId":"15254","inReplyTo":"7vd4jtdki8.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] git-commit: '--no-status' Allow suppression of status summary in commit msg","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2008-08-28T19:34:23Z","receivedAt":"2008-08-28T19:34:23Z","isPatch":true,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"Junio C Hamano, Thu, Aug 28, 2008 21:09:35 +0200:\n> Marcus Griep <marcus@griep.us> writes:\n> \n> > Currently, using any editor to edit a commit message for 'git commit'\n> > kicks of a 'git status' which is then included as comments to give\n> > the commit author some context. However, in some situations, such as\n> > having a working tree of many hundred thousand files or on an inefficient\n> > filesystem,\n> \n> I am not interested in this particular patch, especially the part that\n> hoards a short-and-nice -S flag that we could use for something more\n> useful.  Also calling the configuration variable \"nostatus\" is backwards;\n> I'd name it to \"showstatus\" that defaults to \"true\" if I were doing this.\n\nI like it (almost. I agree, it is not a very good idea to use up \"-S\"\nfor such a thing). Not because of \"inefficient filesystem\" (I have\nproper systems at home), but because I more often need no file list in\nthe commit message than I do need one. It is just annoyance.  OTOH,\nmaybe I'm just too used to put things in the index and trust that. Or\nmaybe it is again that stupid user-friendliness.\n\n> If that is not still enough for your particular use case, I think you can\n> have a custom wrapper that does:\n> \n> \t#!/bin/sh\n> \t: >.log-message-file &&\n>         vi .log-message-file &&\n>         git commit -F .log-message-file \"$@\" &&\n>         rm -f .log-message-file \n> \n> without touching git at all.\n\nThat's not enough. Consider \"-mMessage -e\", \"-t\" or \"-c\" flags of git\ncommit. The wrapper would have to catch them all! Not to mention the\nfuture flags in the same ballpark.\n\nATM, I just use that \"--cached\" (from the patch I mentioned in the\nother mail) with \"--cleanup=verbatim\" to get the commit message just\nhow I like them.\n"},{"id":"89085","messageId":"48B78B82.5010908@trolltech.com","threadId":"15254","inReplyTo":"48B6FB57.5030406@griep.us","subject":"Re: [PATCH] git-commit: '--no-status' Allow suppression of status summary in commit msg","fromName":"Marius Storm-Olsen","fromEmail":"marius@trolltech.com","sentAt":"2008-08-29T05:39:14Z","receivedAt":"2008-08-29T05:39:14Z","isPatch":true,"sender":{"key":"marius@trolltech.com","avatar":"https://gravatar.com/avatar/a40071d8f651862c6ab10bd7996f0ad84d94f06c0399de9e3fa4f06beb390a71?d=mp&s=160"},"body":"Marcus Griep said the following on 28.08.2008 21:24:\n> Using --untracked-files=no cuts the time to display the editor from down to 12 seconds,\n> so that is perfectly fine.  The patch can be ignored.  However, would config option to\n> change the default --untracked-files value be entertained?  Allowing:\n> \n> [commit]\n> \tuntrackedfiles=no\n> \n> which defaults (as stated in the documentation for --untracked-files) to all?\n\nThat was already added in the commit d6293d. Just set\n     status.showUntrackedFiles=no\n\n-- \n.marius [@trolltech.com]\n'if you know what you're doing, it's not research'\n\n"},{"id":"89086","messageId":"48B78DE7.3070700@trolltech.com","threadId":"15254","inReplyTo":"48B78B82.5010908@trolltech.com","subject":"Re: [PATCH] git-commit: '--no-status' Allow suppression of status summary in commit msg","fromName":"Marius Storm-Olsen","fromEmail":"marius@trolltech.com","sentAt":"2008-08-29T05:49:27Z","receivedAt":"2008-08-29T05:49:27Z","isPatch":true,"sender":{"key":"marius@trolltech.com","avatar":"https://gravatar.com/avatar/a40071d8f651862c6ab10bd7996f0ad84d94f06c0399de9e3fa4f06beb390a71?d=mp&s=160"},"body":"Marius Storm-Olsen said the following on 29.08.2008 07:39:\n> Marcus Griep said the following on 28.08.2008 21:24:\n>> Using --untracked-files=no cuts the time to display the editor from down to 12 seconds,\n>> so that is perfectly fine.  The patch can be ignored.  However, would config option to\n>> change the default --untracked-files value be entertained?  Allowing:\n>>\n>> [commit]\n>> \tuntrackedfiles=no\n>>\n>> which defaults (as stated in the documentation for --untracked-files) to all?\n> \n> That was already added in the commit d6293d. Just set\n>      status.showUntrackedFiles=no\nWith that, I of course mean:\n\n[status]\n\tshowUntrackedFiles=no\n\n-- \n.marius [@trolltech.com]\n'if you know what you're doing, it's not research'\n\n"}]}