{"thread":{"id":"42532","subject":"[PATCH 0/2] Introduce \"log.showSignature\" config variable","startedAt":"2016-06-05T15:39:31Z","lastAt":"2016-06-08T06:04:49Z","messageCount":5,"participants":["Mehul Jain","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"288395","messageId":"20160605153933.15231-1-mehul.jain2029@gmail.com","threadId":"42532","inReplyTo":null,"subject":"[PATCH 0/2] Introduce \"log.showSignature\" config variable","fromName":"Mehul Jain","fromEmail":"mehul.jain2029@gmail.com","sentAt":"2016-06-05T15:39:31Z","receivedAt":"2016-06-05T15:39:31Z","isPatch":true,"sender":{"key":"mehul.jain2029@gmail.com","avatar":"https://avatars.githubusercontent.com/u/14936539?v=4"},"body":"Add a new configuratation variable \"log.showSignature\" for git-log and\nrelated commands. This variable will enable user to see GPG signature\nby default.\n\n[Patch 1/2] \n\tIntroduce the config variable along with some tests.\n\n[Patch 2/2] \n\tTackles the problem: what if user wants to disable the\n\tsetting of \"log.showSignature=true\" using a command line\n\tswitch.\n\n* Thanks Junio, Jeff and Remi for helping in reference patch.\n\nPrevious reference patch: http://thread.gmane.org/gmane.comp.version-control.git/295649\n\nMehul Jain (2):\n  log: add \"log.showsignature\" configuration variable\n  log: \"--no-show-signature\" commmand-line option\n\n Documentation/git-log.txt |  4 ++++\n builtin/log.c             |  6 ++++++\n revision.c                |  2 ++\n t/t4202-log.sh            | 25 +++++++++++++++++++++++++\n t/t7510-signed-commit.sh  |  7 +++++++\n 5 files changed, 44 insertions(+)\n\n-- \n2.9.0.rc0.dirty\n"},{"id":"288396","messageId":"20160605153933.15231-2-mehul.jain2029@gmail.com","threadId":"42532","inReplyTo":"20160605153933.15231-1-mehul.jain2029@gmail.com","subject":"[PATCH 1/2] log: add \"log.showsignature\" configuration variable","fromName":"Mehul Jain","fromEmail":"mehul.jain2029@gmail.com","sentAt":"2016-06-05T15:39:32Z","receivedAt":"2016-06-05T15:39:32Z","isPatch":true,"sender":{"key":"mehul.jain2029@gmail.com","avatar":"https://avatars.githubusercontent.com/u/14936539?v=4"},"body":"People may want to always use \"--show-signature\" while using \"git log\"\nand related commands.\n\nWhen log.showSignature is set to true, \"git log\" and related commands\nwill behave as if \"--show-signature\" was given to them.\n\nSigned-off-by: Mehul Jain <mehul.jain2029@gmail.com>\n---\n Documentation/git-log.txt |  4 ++++\n builtin/log.c             |  6 ++++++\n t/t4202-log.sh            | 19 +++++++++++++++++++\n t/t7510-signed-commit.sh  |  7 +++++++\n 4 files changed, 36 insertions(+)\n\ndiff --git a/Documentation/git-log.txt b/Documentation/git-log.txt\nindex 03f9580..bbb5adc 100644\n--- a/Documentation/git-log.txt\n+++ b/Documentation/git-log.txt\n@@ -196,6 +196,10 @@ log.showRoot::\n \t`git log -p` output would be shown without a diff attached.\n \tThe default is `true`.\n \n+log.showSignature::\n+\tIf `true`, `git log` and related commands will act as if the\n+\t`--show-signature` option was passed to them.\n+\n mailmap.*::\n \tSee linkgit:git-shortlog[1].\n \ndiff --git a/builtin/log.c b/builtin/log.c\nindex 099f4f7..7103217 100644\n--- a/builtin/log.c\n+++ b/builtin/log.c\n@@ -33,6 +33,7 @@ static const char *default_date_mode = NULL;\n static int default_abbrev_commit;\n static int default_show_root = 1;\n static int default_follow;\n+static int default_show_signature;\n static int decoration_style;\n static int decoration_given;\n static int use_mailmap_config;\n@@ -119,6 +120,7 @@ static void cmd_log_init_defaults(struct rev_info *rev)\n \trev->abbrev_commit = default_abbrev_commit;\n \trev->show_root_diff = default_show_root;\n \trev->subject_prefix = fmt_patch_subject_prefix;\n+\trev->show_signature = default_show_signature;\n \tDIFF_OPT_SET(&rev->diffopt, ALLOW_TEXTCONV);\n \n \tif (default_date_mode)\n@@ -409,6 +411,10 @@ static int git_log_config(const char *var, const char *value, void *cb)\n \t\tuse_mailmap_config = git_config_bool(var, value);\n \t\treturn 0;\n \t}\n+\tif (!strcmp(var, \"log.showsignature\")) {\n+\t\tdefault_show_signature = git_config_bool(var, value);\n+\t\treturn 0;\n+\t}\n \n \tif (grep_config(var, value, cb) < 0)\n \t\treturn -1;\ndiff --git a/t/t4202-log.sh b/t/t4202-log.sh\nindex 128ba93..3e4a4ac 100755\n--- a/t/t4202-log.sh\n+++ b/t/t4202-log.sh\n@@ -890,6 +890,25 @@ test_expect_success GPG 'log --graph --show-signature for merged tag' '\n \tgrep \"^| | gpg: Good signature\" actual\n '\n \n+test_expect_success GPG 'log.showsignature=true behaves like --show-signature' '\n+\tgit checkout -b test_sign master &&\n+\techo foo >foo &&\n+\tgit add foo &&\n+\tgit commit -S -m signed_commit &&\n+\ttest_config log.showsignature true &&\n+\tgit log -1 signed >actual &&\n+\tgrep \"gpg: Signature made\" actual &&\n+\tgrep \"gpg: Good signature\" actual\n+'\n+\n+test_expect_success GPG '--show-signature overrides log.showsignature=false' '\n+\ttest_when_finished \"git reset --hard && git checkout master\" &&\n+\ttest_config log.showsignature false &&\n+\tgit log -1 --show-signature signed >actual &&\n+\tgrep \"gpg: Signature made\" actual &&\n+\tgrep \"gpg: Good signature\" actual\n+'\n+\n test_expect_success 'log --graph --no-walk is forbidden' '\n \ttest_must_fail git log --graph --no-walk\n '\ndiff --git a/t/t7510-signed-commit.sh b/t/t7510-signed-commit.sh\nindex 4177a86..6e839f5 100755\n--- a/t/t7510-signed-commit.sh\n+++ b/t/t7510-signed-commit.sh\n@@ -210,4 +210,11 @@ test_expect_success GPG 'show lack of signature with custom format' '\n \ttest_cmp expect actual\n '\n \n+test_expect_success GPG 'log.showsignature behaves like --show-signature' '\n+\ttest_config log.showsignature true &&\n+\tgit show initial >actual &&\n+\tgrep \"gpg: Signature made\" actual &&\n+\tgrep \"gpg: Good signature\" actual\n+'\n+\n test_done\n-- \n2.9.0.rc0.dirty\n"},{"id":"288397","messageId":"20160605153933.15231-3-mehul.jain2029@gmail.com","threadId":"42532","inReplyTo":"20160605153933.15231-1-mehul.jain2029@gmail.com","subject":"[PATCH 2/2] log: \"--no-show-signature\" commmand-line option","fromName":"Mehul Jain","fromEmail":"mehul.jain2029@gmail.com","sentAt":"2016-06-05T15:39:33Z","receivedAt":"2016-06-05T15:39:33Z","isPatch":true,"sender":{"key":"mehul.jain2029@gmail.com","avatar":"https://avatars.githubusercontent.com/u/14936539?v=4"},"body":"If \"log.showSignature=true\", then there is no way to override it using\ncommand line switch.\n\nTeach git-log and related commands about \"--no-showSignature\" command\nline option.\n\nNote that introduction of \"--no-show-signature\" is meant to tackle\nthe above mentioned problem for the following commands: git-log,\ngit-show, git-whatchanged and git-reflog. It does not suggest that\nwe need \"log.showSignature\" config variable to affect other git\ncommands, as currently \"log.showSignature\" is only meant to affect\ngit-log, git-show, git-whatchanged and git-reflog.\n\nSigned-off-by: Mehul Jain <mehul.jain2029@gmail.com>\n---\n revision.c     | 2 ++\n t/t4202-log.sh | 6 ++++++\n 2 files changed, 8 insertions(+)\n\ndiff --git a/revision.c b/revision.c\nindex d30d1c4..3546ff9 100644\n--- a/revision.c\n+++ b/revision.c\n@@ -1871,6 +1871,8 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg\n \t\trevs->notes_opt.use_default_notes = 1;\n \t} else if (!strcmp(arg, \"--show-signature\")) {\n \t\trevs->show_signature = 1;\n+\t} else if (!strcmp(arg, \"--no-show-signature\")) {\n+\t\trevs->show_signature = 0;\n \t} else if (!strcmp(arg, \"--show-linear-break\") ||\n \t\t   starts_with(arg, \"--show-linear-break=\")) {\n \t\tif (starts_with(arg, \"--show-linear-break=\"))\ndiff --git a/t/t4202-log.sh b/t/t4202-log.sh\nindex 3e4a4ac..026808e 100755\n--- a/t/t4202-log.sh\n+++ b/t/t4202-log.sh\n@@ -901,6 +901,12 @@ test_expect_success GPG 'log.showsignature=true behaves like --show-signature' '\n \tgrep \"gpg: Good signature\" actual\n '\n \n+test_expect_success GPG '--no-show-signature overrides log.showsignature=true' '\n+\ttest_config log.showsignature true &&\n+\tgit log -1 --no-show-signature signed >actual &&\n+\t! grep \"^gpg:\" actual\n+'\n+\n test_expect_success GPG '--show-signature overrides log.showsignature=false' '\n \ttest_when_finished \"git reset --hard && git checkout master\" &&\n \ttest_config log.showsignature false &&\n-- \n2.9.0.rc0.dirty\n"},{"id":"288470","messageId":"xmqq37oqxib8.fsf@gitster.mtv.corp.google.com","threadId":"42532","inReplyTo":"20160605153933.15231-3-mehul.jain2029@gmail.com","subject":"Re: [PATCH 2/2] log: \"--no-show-signature\" commmand-line option","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-06-06T18:50:51Z","receivedAt":"2016-06-06T18:50:51Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Mehul Jain <mehul.jain2029@gmail.com> writes:\n\n> If \"log.showSignature=true\", then there is no way to override it using\n> command line switch.\n>\n> Teach git-log and related commands about \"--no-showSignature\" command\n> line option.\n\nDoesn't that suggest that 1/2 alone will cause users problems?  The\nusers can by mistake set the configuration variable and there is no\nway for them to override it from the command line.\n\nIf you swap the order of the two patches, the topic makes more\nsense.  I.e.\n\n    [1/2] log: add \"--no-show-signature\" command line option\n\nmakes \"git log --show-signature --no-show-signature\" to run without\nGPG checks, which by itself is a worthy change.  And then\n\n    [2/2] log: add log.showSignature configuration variable\n\nmakes revs->show_signature default to the configured value, instead\nof always initializing it to false.\n"},{"id":"288677","messageId":"CA+DCAeRUObYLy1cP-i-iVoWnw8SEaMJZEWu20q0M2eVJZ3uMJg@mail.gmail.com","threadId":"42532","inReplyTo":"xmqq37oqxib8.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH 2/2] log: \"--no-show-signature\" commmand-line option","fromName":"Mehul Jain","fromEmail":"mehul.jain2029@gmail.com","sentAt":"2016-06-08T06:04:49Z","receivedAt":"2016-06-08T06:04:49Z","isPatch":true,"sender":{"key":"mehul.jain2029@gmail.com","avatar":"https://avatars.githubusercontent.com/u/14936539?v=4"},"body":"On Tue, Jun 7, 2016 at 12:20 AM, Junio C Hamano <gitster@pobox.com> wrote:\n> Mehul Jain <mehul.jain2029@gmail.com> writes:\n>\n>> If \"log.showSignature=true\", then there is no way to override it using\n>> command line switch.\n>>\n>> Teach git-log and related commands about \"--no-showSignature\" command\n>> line option.\n>\n> Doesn't that suggest that 1/2 alone will cause users problems?  The\n> users can by mistake set the configuration variable and there is no\n> way for them to override it from the command line.\n>\n> If you swap the order of the two patches, the topic makes more\n> sense.  I.e.\n>\n>     [1/2] log: add \"--no-show-signature\" command line option\n>\n> makes \"git log --show-signature --no-show-signature\" to run without\n> GPG checks, which by itself is a worthy change.  And then\n>\n>     [2/2] log: add log.showSignature configuration variable\n>\n> makes revs->show_signature default to the configured value, instead\n> of always initializing it to false.\n\nYes, it does make sense to swap the order of the patches.\nI will do a re-roll soon.\n\nThanks,\nMehul\n"}]}