log: add "--no-show-signature" command line option
authorMehul Jain <mehul.jain2029@gmail.com>
Wed, 22 Jun 2016 16:51:25 +0000 (22:21 +0530)
committerJunio C Hamano <gitster@pobox.com>
Fri, 24 Jun 2016 20:01:13 +0000 (13:01 -0700)
If an user creates an alias with "--show-signature" early in command
line, e.g.
[alias] logss = log --show-signature

then there is no way to countermand it through command line.

Teach git-log and related commands about "--no-show-signature" command
line option. This will make "git logss --no-show-signature" run
without showing GPG signature.

Signed-off-by: Mehul Jain <mehul.jain2029@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
revision.c
t/t4202-log.sh
index d30d1c4f802c77a47df0078f49247457bf22c1a3..3546ff9c1bcd64d8c0f2f1e67f4daae1c7ae240f 100644 (file)
@@ -1871,6 +1871,8 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
                revs->notes_opt.use_default_notes = 1;
        } else if (!strcmp(arg, "--show-signature")) {
                revs->show_signature = 1;
+       } else if (!strcmp(arg, "--no-show-signature")) {
+               revs->show_signature = 0;
        } else if (!strcmp(arg, "--show-linear-break") ||
                   starts_with(arg, "--show-linear-break=")) {
                if (starts_with(arg, "--show-linear-break="))
index b3d618c43da29a8e445181ca8396b694665197a8..449a5275d490fa087fd70f1bda91b14053461d83 100755 (executable)
@@ -893,6 +893,11 @@ test_expect_success GPG 'log --graph --show-signature for merged tag' '
        grep "^| | gpg: Good signature" actual
 '
 
+test_expect_success GPG '--no-show-signature overrides --show-signature' '
+       git log -1 --show-signature --no-show-signature signed >actual &&
+       ! grep "^gpg:" actual
+'
+
 test_expect_success 'log --graph --no-walk is forbidden' '
        test_must_fail git log --graph --no-walk
 '