{"thread":{"id":"41654","subject":"[PATCH] add a commit.verbose config variable","startedAt":"2016-03-09T18:49:15Z","lastAt":"2016-03-09T21:21:54Z","messageCount":3,"participants":["Pranit Bauva","Matthieu Moy"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"280503","messageId":"010201535cb62b56-9aa72755-b730-478c-9244-41a1ee69e231-000000@eu-west-1.amazonses.com","threadId":"41654","inReplyTo":null,"subject":"[PATCH] add a commit.verbose config variable","fromName":"Pranit Bauva","fromEmail":"pranit.bauva@gmail.com","sentAt":"2016-03-09T18:49:15Z","receivedAt":"2016-03-09T18:49:15Z","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, and would\nprefer not to use the argument again and again but instead specify it in\nthe configuration file.\n\nAlso add a override-verbose option in git-commit if no verbose is required\nwhen the commit.verbose is true in the configuration file.\n\nSigned-off-by: Pranit Bauva <pranit.bauva@gmail.com>\n---\n Documentation/config.txt     | 4 ++++\n Documentation/git-commit.txt | 7 ++++++-\n builtin/commit.c             | 7 +++++++\n 3 files changed, 17 insertions(+), 1 deletion(-)\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex 01cca0a..cf2f48b 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..0972b45 100644\n--- a/Documentation/git-commit.txt\n+++ b/Documentation/git-commit.txt\n@@ -290,12 +290,17 @@ 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\n changes to tracked files.\n \n+--override-verbose::\n+\tDisable verbose for the commit if you have activated it\n+\tpermanently in the configuration variable `commit.verbose`.\n+\n -q::\n --quiet::\n \tSuppress commit summary message.\ndiff --git a/builtin/commit.c b/builtin/commit.c\nindex b3bd2d4..0577968 100644\n--- a/builtin/commit.c\n+++ b/builtin/commit.c\n@@ -114,6 +114,7 @@ static char *fixup_message, *squash_message;\n static int all, also, interactive, patch_interactive, only, amend, signoff;\n static int edit_flag = -1; /* unspecified */\n static int quiet, verbose, no_verify, allow_empty, dry_run, renew_authorship;\n+static int override_verbose;\n static int no_post_rewrite, allow_empty_message;\n static char *untracked_files_arg, *force_date, *ignore_submodule_arg;\n static char *sign_commit;\n@@ -1590,6 +1591,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)\n \t\tOPT_BOOL('e', \"edit\", &edit_flag, N_(\"force edit of commit\")),\n \t\tOPT_STRING(0, \"cleanup\", &cleanup_arg, N_(\"default\"), N_(\"how to strip spaces and #comments from message\")),\n \t\tOPT_BOOL(0, \"status\", &include_status, N_(\"include status in commit message template\")),\n+\t\tOPT_BOOL(0, \"override-verbose\", &override_verbose, N_(\"override the verbose setting in configuration file\")),\n \t\t{ OPTION_STRING, 'S', \"gpg-sign\", &sign_commit, N_(\"key-id\"),\n \t\t  N_(\"GPG sign commit\"), PARSE_OPT_OPTARG, NULL, (intptr_t) \"\" },\n \t\t/* end commit message options */\n@@ -1654,6 +1656,11 @@ int cmd_commit(int argc, const char **argv, const char *prefix)\n \targc = parse_and_validate_options(argc, argv, builtin_commit_options,\n \t\t\t\t\t  builtin_commit_usage,\n \t\t\t\t\t  prefix, current_head, &s);\n+\n+\tif( !override_verbose )\n+\t\tif( !verbose )\n+\t\t\tgit_config_get_bool(\"commit.verbose\", &verbose);\n+\n \tif (dry_run)\n \t\treturn dry_run_commit(argc, argv, prefix, current_head, &s);\n \tindex_file = prepare_index(argc, argv, prefix, current_head, 0);\n\n--\nhttps://github.com/git/git/pull/204\n"},{"id":"280508","messageId":"CAFZEwPM6XLkp07ekBfDaAPcJLvKxRNCW=deFy+GasWYeqcjk-A@mail.gmail.com","threadId":"41654","inReplyTo":"010201535cb62b56-9aa72755-b730-478c-9244-41a1ee69e231-000000@eu-west-1.amazonses.com","subject":"Re: [PATCH] add a commit.verbose config variable","fromName":"Pranit Bauva","fromEmail":"pranit.bauva@gmail.com","sentAt":"2016-03-09T20:32:28Z","receivedAt":"2016-03-09T20:32:28Z","isPatch":true,"sender":{"key":"pranit.bauva@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2959938?v=4"},"body":"A previous version of this patch can be found at\nhttp://news.gmane.org/gmane.comp.version-control.git/287540 .\n\nThe changes in the patch are :-\n - Fix typo \"git config\" to \"git commit\"\n - Use a better commit message\n - Drop a paragraph in commit message so as to not misguide readers\n - Consider additional tests as suggested by Eric Sunshine\n - Add an option \"override-verbose\" to git commit to override the\n\"always true\" setting if set in the configuration file\n\nIt took me quite some time to send this patch. I was trying to write\ntests for this and send the patch together but I could not find the\ntest examples that could be used from the existing code base. If\nsomeone has an idea in mind then I could probably write the tests.\nThough I have tested this personally for all the cases but I think it\nwould be preferable to automate the job.\n\nRegards,\nPranit Bauva\nIIT Kharagpur\n"},{"id":"280510","messageId":"vpqlh5r9wjx.fsf@anie.imag.fr","threadId":"41654","inReplyTo":"010201535cb62b56-9aa72755-b730-478c-9244-41a1ee69e231-000000@eu-west-1.amazonses.com","subject":"Re: [PATCH] add a commit.verbose config variable","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2016-03-09T21:21:54Z","receivedAt":"2016-03-09T21:21:54Z","isPatch":true,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Hi,\n\nThis is v2, right? Then call it [PATCH v2] in the title, and summarize\nthe diff wrt v1. As much as possible, Cc people who participated in the\nreview of v1.\n\nPranit Bauva <pranit.bauva@gmail.com> writes:\n\n> Since many people always run the command with this option, and would\n> prefer not to use the argument again and again but instead specify it in\n> the configuration file.\n\n\"Since ... and ...\" calls for a verb to end the sentence (already noted\nby Eric with v1).\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\nEither say \"See linkgit:git-commit[1]\" between parenthesis, or add a\nperiod (.) at the end of the sentence.\n\n> +--override-verbose::\n> +\tDisable verbose for the commit if you have activated it\n> +\tpermanently in the configuration variable `commit.verbose`.\n\nThe convention is to call this --no-verbose. --override-verbose is not a\ngood name for such option.\n\nLook how other similar cases are managed (e.g. status.short,\nstatus.branch, am.threeway)\n\n> @@ -1654,6 +1656,11 @@ int cmd_commit(int argc, const char **argv, const char *prefix)\n>  \targc = parse_and_validate_options(argc, argv, builtin_commit_options,\n>  \t\t\t\t\t  builtin_commit_usage,\n>  \t\t\t\t\t  prefix, current_head, &s);\n> +\n> +\tif( !override_verbose )\n> +\t\tif( !verbose )\n\nStyle: spaces between if and (, but not inside ( ).\n\n> +\t\t\tgit_config_get_bool(\"commit.verbose\", &verbose);\n\nThis is a strange way to write the \"cli takes precedence over config\".\nThe usual way is to read from least precedence to highest precedence,\ni.e. git_config_get_bool before calling parse_option.\n\nYou dropped the \"RFC\" tag from the subject line, but your patch still\nlacks a test. It cannot be called final without.\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"}]}