log: add "--no-show-signature" command line option

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>

Mehul Jain committed Jun 22, 2016 at 22:21 UTC aa3799996c310da756c7845950def4f6d51cccf3
2 files changed +7
revision.c
+2
@@ -1871,6 +1871,8 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
1871 revs->notes_opt.use_default_notes = 1;
1872 } else if (!strcmp(arg, "--show-signature")) {
1873 revs->show_signature = 1;
1874 + } else if (!strcmp(arg, "--no-show-signature")) {
1875 + revs->show_signature = 0;
1876 } else if (!strcmp(arg, "--show-linear-break") ||
1877 starts_with(arg, "--show-linear-break=")) {
1878 if (starts_with(arg, "--show-linear-break="))
t/t4202-log.sh
+5
@@ -893,6 +893,11 @@ test_expect_success GPG 'log --graph --show-signature for merged tag' '
893 grep "^| | gpg: Good signature" actual
894 '
895
896 +test_expect_success GPG '--no-show-signature overrides --show-signature' '
897 + git log -1 --show-signature --no-show-signature signed >actual &&
898 + ! grep "^gpg:" actual
899 +'
900 +
901 test_expect_success 'log --graph --no-walk is forbidden' '
902 test_must_fail git log --graph --no-walk
903 '