{"thread":{"id":"41665","subject":"[PATCH/RFC v3] add a commit.verbose config variable","startedAt":"2016-03-10T18:58:48Z","lastAt":"2016-03-10T21:49:19Z","messageCount":6,"participants":["Pranit Bauva","Junio C Hamano"],"isPatch":true,"patchVersion":3,"patchTotal":null},"messages":[{"id":"280567","messageId":"0102015361e5441b-bbc448b5-7307-451d-a951-f016f7ae4b1d-000000@eu-west-1.amazonses.com","threadId":"41665","inReplyTo":null,"subject":"[PATCH/RFC v3] add a commit.verbose config variable","fromName":"Pranit Bauva","fromEmail":"pranit.bauva@gmail.com","sentAt":"2016-03-10T18:58:48Z","receivedAt":"2016-03-10T18:58:48Z","isPatch":true,"sender":{"key":"pranit.bauva@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2959938?v=4"},"body":"Since many people always run the command with this option, it would be\npreferrable to specify it in the configuration file instead of passing\nthe option with `git commit` again and again.\n\nSigned-off-by: Pranit Bauva <pranit.bauva@gmail.com>\n---\n Documentation/config.txt     | 4 ++++\n Documentation/git-commit.txt | 3 ++-\n builtin/commit.c             | 4 ++++\n 3 files changed, 10 insertions(+), 1 deletion(-)\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex 01cca0a..9b93f6c 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -1110,6 +1110,10 @@ commit.template::\n \t\"`~/`\" is expanded to the value of `$HOME` and \"`~user/`\" to the\n \tspecified user's home directory.\n \n+commit.verbose::\n+\tA boolean to specify whether to always include the verbose option\n+\twith `git commit`. See linkgit:git-commit[1].\n+\n credential.helper::\n \tSpecify an external helper to be called when a username or\n \tpassword credential is needed; the helper may consult external\ndiff --git a/Documentation/git-commit.txt b/Documentation/git-commit.txt\nindex 9ec6b3c..3dcaac7 100644\n--- a/Documentation/git-commit.txt\n+++ b/Documentation/git-commit.txt\n@@ -290,7 +290,8 @@ configuration variable documented in linkgit:git-config[1].\n \twhat changes the commit has.\n \tNote that this diff output doesn't have its\n \tlines prefixed with '#'. This diff will not be a part\n-\tof the commit message.\n+\tof the commit message. To activate this option permanently, the\n+\tconfiguration variable `commit.verbose` can be set to true.\n +\n If specified twice, show in addition the unified diff between\n what would be committed and the worktree files, i.e. the unstaged\ndiff --git a/builtin/commit.c b/builtin/commit.c\nindex b3bd2d4..63ee0f2 100644\n--- a/builtin/commit.c\n+++ b/builtin/commit.c\n@@ -1310,6 +1310,10 @@ static int git_status_config(const char *k, const char *v, void *cb)\n \t\t\treturn error(_(\"Invalid untracked files mode '%s'\"), v);\n \t\treturn 0;\n \t}\n+\tif (!strcmp(k, \"commit.verbose\")) {\n+\t\tverbose = git_config_bool(k, v);\n+\t\treturn 0;\n+\t}\n \treturn git_diff_ui_config(k, v, NULL);\n }\n \n\n--\nhttps://github.com/git/git/pull/205\n"},{"id":"280568","messageId":"CAFZEwPNYFBXrUUt9sgHtOYvUVZwQYV-VbyNLWzMz5MFFqH+CkA@mail.gmail.com","threadId":"41665","inReplyTo":"0102015361e5441b-bbc448b5-7307-451d-a951-f016f7ae4b1d-000000@eu-west-1.amazonses.com","subject":"Re: [PATCH/RFC v3] add a commit.verbose config variable","fromName":"Pranit Bauva","fromEmail":"pranit.bauva@gmail.com","sentAt":"2016-03-10T19:46:45Z","receivedAt":"2016-03-10T19:46:45Z","isPatch":true,"sender":{"key":"pranit.bauva@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2959938?v=4"},"body":"Older versions of this patch can be found at :-\n[v2] : http://thread.gmane.org/gmane.comp.version-control.git/288569\n[v1] : http://thread.gmane.org/gmane.comp.version-control.git/287540\n\nThe changes are :\n - Remove the concept of override-verbose\n - Add the git_config_bool to the method git_status_config instead of cmd_commit\n\nI have to yet figure out how to write the tests for this. I will see\nthe examples that Matthieu Moy mentioned for their implementation.\n\nRegards,\nPranit Bauva,\nIIT Kharagpur\n"},{"id":"280577","messageId":"xmqq7fhadnkv.fsf@gitster.mtv.corp.google.com","threadId":"41665","inReplyTo":"0102015361e5441b-bbc448b5-7307-451d-a951-f016f7ae4b1d-000000@eu-west-1.amazonses.com","subject":"Re: [PATCH/RFC v3] add a commit.verbose config variable","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-03-10T21:34:24Z","receivedAt":"2016-03-10T21:34:24Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Pranit Bauva <pranit.bauva@gmail.com> writes:\n\n> diff --git a/builtin/commit.c b/builtin/commit.c\n> index b3bd2d4..63ee0f2 100644\n> --- a/builtin/commit.c\n> +++ b/builtin/commit.c\n> @@ -1310,6 +1310,10 @@ static int git_status_config(const char *k, const char *v, void *cb)\n>  \t\t\treturn error(_(\"Invalid untracked files mode '%s'\"), v);\n>  \t\treturn 0;\n>  \t}\n> +\tif (!strcmp(k, \"commit.verbose\")) {\n> +\t\tverbose = git_config_bool(k, v);\n> +\t\treturn 0;\n> +\t}\n>  \treturn git_diff_ui_config(k, v, NULL);\n>  }\n\nChecking the code flow in cmd_commit(), we first do the config, and\nthen later call parse_options(), so it is clear that giving the\ninitial value of 0 or 1 depending on the boolean setting would be\nall that is necessary to support \"--no-verbose\", which makes the\npatch very compact.  Good.\n\nBut doesn't this belong to git_commit_config(), not\ngit_STATUS_config()?  Should \"commit.verbose\" make output from \"git\nstatus\" verbose?\n"},{"id":"280578","messageId":"CAFZEwPP5_rBKH_=0pv_3PszLYtnznXeGJg1+yjwbiH0m_BqdZQ@mail.gmail.com","threadId":"41665","inReplyTo":"xmqq7fhadnkv.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH/RFC v3] add a commit.verbose config variable","fromName":"Pranit Bauva","fromEmail":"pranit.bauva@gmail.com","sentAt":"2016-03-10T21:38:51Z","receivedAt":"2016-03-10T21:38:51Z","isPatch":true,"sender":{"key":"pranit.bauva@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2959938?v=4"},"body":"On Fri, Mar 11, 2016 at 3:04 AM, Junio C Hamano <gitster@pobox.com>\nwrote:\n> But doesn't this belong to git_commit_config(), not\n> git_STATUS_config()?  Should \"commit.verbose\" make output from \"git\n> status\" verbose?\n\nTrue. It should belong to git_commit_config(). My bad. But\nsurprisingly this code works. I have no idea why. I will update the\nPatch and I have also finished writing test so I will include that\nalso.\n"},{"id":"280581","messageId":"xmqqy49qc8ga.fsf@gitster.mtv.corp.google.com","threadId":"41665","inReplyTo":"CAFZEwPP5_rBKH_=0pv_3PszLYtnznXeGJg1+yjwbiH0m_BqdZQ@mail.gmail.com","subject":"Re: [PATCH/RFC v3] add a commit.verbose config variable","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-03-10T21:46:29Z","receivedAt":"2016-03-10T21:46:29Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Pranit Bauva <pranit.bauva@gmail.com> writes:\n\n> On Fri, Mar 11, 2016 at 3:04 AM, Junio C Hamano <gitster@pobox.com>\n> wrote:\n>> But doesn't this belong to git_commit_config(), not\n>> git_STATUS_config()?  Should \"commit.verbose\" make output from \"git\n>> status\" verbose?\n>\n> True. It should belong to git_commit_config(). My bad. But\n> surprisingly this code works. I have no idea why. I will update the\n> Patch and I have also finished writing test so I will include that\n> also.\n\nIf that is surprising to you, that indicates that you only tested\n\"commit\" and not \"status\", I think.  If you choose commit.verbose to\napply only to \"commit\", but not \"status\", then your test should\ncover both commands, i.e. when the configuration is set to true, the\ndefault verbosity level for \"git commit\" should be raised, and the\nverbosity level for \"git status\" should not be--both must be\nverified in your test script.\n"},{"id":"280582","messageId":"CAFZEwPN=4TD+jzmwJ3gyMq+3NURB_m-6-AhqXLO+Rvx19GTTtQ@mail.gmail.com","threadId":"41665","inReplyTo":"CAFZEwPP5_rBKH_=0pv_3PszLYtnznXeGJg1+yjwbiH0m_BqdZQ@mail.gmail.com","subject":"Re: [PATCH/RFC v3] add a commit.verbose config variable","fromName":"Pranit Bauva","fromEmail":"pranit.bauva@gmail.com","sentAt":"2016-03-10T21:49:19Z","receivedAt":"2016-03-10T21:49:19Z","isPatch":true,"sender":{"key":"pranit.bauva@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2959938?v=4"},"body":"I figured it out, It first runs status_init_config(). I might have\nthought \"status\" as status of the options and thus I may have edited\nthere.\n\nOn Fri, Mar 11, 2016 at 3:08 AM, Pranit Bauva <pranit.bauva@gmail.com> wrote:\n> On Fri, Mar 11, 2016 at 3:04 AM, Junio C Hamano <gitster@pobox.com>\n> wrote:\n>> But doesn't this belong to git_commit_config(), not\n>> git_STATUS_config()?  Should \"commit.verbose\" make output from \"git\n>> status\" verbose?\n>\n> True. It should belong to git_commit_config(). My bad. But\n> surprisingly this code works. I have no idea why. I will update the\n> Patch and I have also finished writing test so I will include that\n> also.\n"}]}