{"thread":{"id":"37075","subject":"[PATCH] log: fix indentation for --graph --show-signature","startedAt":"2014-07-08T11:12:28Z","lastAt":"2014-07-09T02:10:21Z","messageCount":3,"participants":["Zoltan Klinger","Eric Sunshine"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"245517","messageId":"1404817948-7794-1-git-send-email-zoltan.klinger@gmail.com","threadId":"37075","inReplyTo":null,"subject":"[PATCH] log: fix indentation for --graph --show-signature","fromName":"Zoltan Klinger","fromEmail":"zoltan.klinger@gmail.com","sentAt":"2014-07-08T11:12:28Z","receivedAt":"2014-07-08T11:12:28Z","isPatch":true,"sender":{"key":"zoltan.klinger@gmail.com","avatar":"https://avatars.githubusercontent.com/u/95923?v=4"},"body":"The git log --graph --show-signature command incorrectly indents the gpg\ninformation about signed commits and merged signed tags. It does not\nfollow the level of indentation of the current commit.\n\nExample of garbled output:\n$ git log --show-signature --graph\n*   commit 258e0a237cb69aaa587b0a4fb528bb0316b1b776\n|\\  gpg: Signature made Mon, Jun 30, 2014 13:22:33 EDT using RSA key ID DA08\ngpg: Good signature from \"Jason Pyeron <jpye...@pdinc.us>\"\nMerge: 727c355 1ca13ed\n| | Author: Jason Pyeron <jpye...@pdinc.us>\n| | Date:   Mon Jun 30 13:22:29 2014 -0400\n| |\n| |     Merge of 1ca13ed2271d60ba9 branch - rebranding\n| |\n| * commit 1ca13ed2271d60ba93d40bcc8db17ced8545f172\n| | gpg: Signature made Mon, Jun 23, 2014  9:45:47 EDT using RSA key ID DD37\ngpg: Good signature from \"Stephen Robert Guglielmo <s...@guglielmo.us>\"\ngpg:                 aka \"Stephen Robert Guglielmo <srguglie...@gmail.com>\"\nAuthor: Stephen R Guglielmo <s...@guglielmo.us>\n| | Date:   Mon Jun 23 09:45:27 2014 -0400\n| |\n| |     Minor URL updates\n\nIn log-tree.c modify show_sig_lines() function to call graph_show_oneline()\nafter each line of gpg information it has printed in order to preserve\nthe level of indentation for the next output line.\n\nReported-by: Jason Pyeron <jpyeron@pdinc.us>\nSigned-off-by: Zoltan Klinger <zoltan.klinger@gmail.com>\n---\n log-tree.c     |  1 +\n t/t4202-log.sh | 29 +++++++++++++++++++++++++++++\n 2 files changed, 30 insertions(+)\n\ndiff --git a/log-tree.c b/log-tree.c\nindex 10e6844..f13b861 100644\n--- a/log-tree.c\n+++ b/log-tree.c\n@@ -365,6 +365,7 @@ static void show_sig_lines(struct rev_info *opt, int status, const char *bol)\n \t\teol = strchrnul(bol, '\\n');\n \t\tprintf(\"%s%.*s%s%s\", color, (int)(eol - bol), bol, reset,\n \t\t       *eol ? \"\\n\" : \"\");\n+\t\tgraph_show_oneline(opt->graph);\n \t\tbol = (*eol) ? (eol + 1) : eol;\n \t}\n }\ndiff --git a/t/t4202-log.sh b/t/t4202-log.sh\nindex cb03d28..b429aff 100755\n--- a/t/t4202-log.sh\n+++ b/t/t4202-log.sh\n@@ -3,6 +3,7 @@\n test_description='git log'\n \n . ./test-lib.sh\n+. \"$TEST_DIRECTORY/lib-gpg.sh\"\n \n test_expect_success setup '\n \n@@ -841,4 +842,32 @@ test_expect_success 'dotdot is a parent directory' '\n \ttest_cmp expect actual\n '\n \n+test_expect_success GPG 'log --graph --show-signature' '\n+\tgit checkout -b signed master &&\n+\techo foo >foo &&\n+\tgit add foo &&\n+\tgit commit -S -m signed_commit &&\n+\tgit log --graph --show-signature -n1 signed >actual &&\n+\tgrep \"^| gpg: Signature made\" actual &&\n+\tgrep \"^| gpg: Good signature\" actual\n+'\n+\n+test_expect_success GPG 'log --graph --show-signature for merged tag' '\n+\tgit checkout -b plain master &&\n+\techo aaa >bar &&\n+\tgit add bar &&\n+\tgit commit -m bar_commit\n+\tgit checkout -b tagged master &&\n+\techo bbb >baz &&\n+\tgit add baz &&\n+\tgit commit -m baz_commit\n+\tgit tag -s -m signed_tag_msg signed_tag &&\n+\tgit checkout plain &&\n+\tgit merge --no-ff -m msg signed_tag &&\n+\tgit log --graph --show-signature -n1 plain >actual &&\n+\tgrep \"^|\\\\\\  merged tag\" actual &&\n+\tgrep \"^| | gpg: Signature made\" actual &&\n+\tgrep \"^| | gpg: Good signature\" actual\n+'\n+\n test_done\n-- \n2.0.0\n"},{"id":"245556","messageId":"CAPig+cT1xcpH7GzfGO8ZkNsN0=waS34p=Yejd-Mv7che1U0i2Q@mail.gmail.com","threadId":"37075","inReplyTo":"1404817948-7794-1-git-send-email-zoltan.klinger@gmail.com","subject":"Re: [PATCH] log: fix indentation for --graph --show-signature","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2014-07-08T21:33:04Z","receivedAt":"2014-07-08T21:33:04Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Tue, Jul 8, 2014 at 7:12 AM, Zoltan Klinger <zoltan.klinger@gmail.com> wrote:\n> The git log --graph --show-signature command incorrectly indents the gpg\n> information about signed commits and merged signed tags. It does not\n> follow the level of indentation of the current commit.\n>\n> Reported-by: Jason Pyeron <jpyeron@pdinc.us>\n> Signed-off-by: Zoltan Klinger <zoltan.klinger@gmail.com>\n> ---\n> diff --git a/t/t4202-log.sh b/t/t4202-log.sh\n> index cb03d28..b429aff 100755\n> --- a/t/t4202-log.sh\n> +++ b/t/t4202-log.sh\n> @@ -3,6 +3,7 @@\n>  test_description='git log'\n>\n>  . ./test-lib.sh\n> +. \"$TEST_DIRECTORY/lib-gpg.sh\"\n>\n>  test_expect_success setup '\n>\n> @@ -841,4 +842,32 @@ test_expect_success 'dotdot is a parent directory' '\n>         test_cmp expect actual\n>  '\n>\n> +test_expect_success GPG 'log --graph --show-signature' '\n> +       git checkout -b signed master &&\n\nDo you want\n\n    test_when_finished 'git reset --hard && git checkout master' &&\n\nhere in case of failure in this test in order to restore sanity for\ntests which might be added later?\n\n> +       echo foo >foo &&\n> +       git add foo &&\n> +       git commit -S -m signed_commit &&\n> +       git log --graph --show-signature -n1 signed >actual &&\n> +       grep \"^| gpg: Signature made\" actual &&\n> +       grep \"^| gpg: Good signature\" actual\n> +'\n> +\n> +test_expect_success GPG 'log --graph --show-signature for merged tag' '\n> +       git checkout -b plain master &&\n> +       echo aaa >bar &&\n> +       git add bar &&\n> +       git commit -m bar_commit\n\nBroken &&-chain.\n\n> +       git checkout -b tagged master &&\n\nDitto regarding test_when_finished.\n\n> +       echo bbb >baz &&\n> +       git add baz &&\n> +       git commit -m baz_commit\n\nBroken &&-chain.\n\n> +       git tag -s -m signed_tag_msg signed_tag &&\n> +       git checkout plain &&\n> +       git merge --no-ff -m msg signed_tag &&\n> +       git log --graph --show-signature -n1 plain >actual &&\n> +       grep \"^|\\\\\\  merged tag\" actual &&\n> +       grep \"^| | gpg: Signature made\" actual &&\n> +       grep \"^| | gpg: Good signature\" actual\n> +'\n> +\n>  test_done\n> --\n> 2.0.0\n"},{"id":"245565","messageId":"1404871821-12659-1-git-send-email-zoltan.klinger@gmail.com","threadId":"37075","inReplyTo":"1404817948-7794-1-git-send-email-zoltan.klinger@gmail.com","subject":"[PATCH v2] log: fix indentation for --graph --show-signature","fromName":"Zoltan Klinger","fromEmail":"zoltan.klinger@gmail.com","sentAt":"2014-07-09T02:10:21Z","receivedAt":"2014-07-09T02:10:21Z","isPatch":true,"sender":{"key":"zoltan.klinger@gmail.com","avatar":"https://avatars.githubusercontent.com/u/95923?v=4"},"body":"The git log --graph --show-signature command incorrectly indents the gpg\ninformation about signed commits and merged signed tags. It does not\nfollow the level of indentation of the current commit.\n\nExample of garbled output:\n$ git log --show-signature --graph\n*   commit 258e0a237cb69aaa587b0a4fb528bb0316b1b776\n|\\  gpg: Signature made Mon, Jun 30, 2014 13:22:33 EDT using RSA key ID DA08\ngpg: Good signature from \"Jason Pyeron <jpye...@pdinc.us>\"\nMerge: 727c355 1ca13ed\n| | Author: Jason Pyeron <jpye...@pdinc.us>\n| | Date:   Mon Jun 30 13:22:29 2014 -0400\n| |\n| |     Merge of 1ca13ed2271d60ba9 branch - rebranding\n| |\n| * commit 1ca13ed2271d60ba93d40bcc8db17ced8545f172\n| | gpg: Signature made Mon, Jun 23, 2014  9:45:47 EDT using RSA key ID DD37\ngpg: Good signature from \"Stephen Robert Guglielmo <s...@guglielmo.us>\"\ngpg:                 aka \"Stephen Robert Guglielmo <srguglie...@gmail.com>\"\nAuthor: Stephen R Guglielmo <s...@guglielmo.us>\n| | Date:   Mon Jun 23 09:45:27 2014 -0400\n| |\n| |     Minor URL updates\n\nIn log-tree.c modify show_sig_lines() function to call graph_show_oneline()\nafter each line of gpg information it has printed in order to preserve\nthe level of indentation for the next output line.\n\nReported-by: Jason Pyeron <jpyeron@pdinc.us>\nSigned-off-by: Zoltan Klinger <zoltan.klinger@gmail.com>\n---\n\n Changes since v1:\n   t/t4202-log.sh file:\n       * fix broken &&-chain in test cases\n       * add test_when_finished scripts to  test cases to\n         reset things to master branch\n\n log-tree.c     |  1 +\n t/t4202-log.sh | 31 +++++++++++++++++++++++++++++++\n 2 files changed, 32 insertions(+)\n\ndiff --git a/log-tree.c b/log-tree.c\nindex 10e6844..f13b861 100644\n--- a/log-tree.c\n+++ b/log-tree.c\n@@ -365,6 +365,7 @@ static void show_sig_lines(struct rev_info *opt, int status, const char *bol)\n \t\teol = strchrnul(bol, '\\n');\n \t\tprintf(\"%s%.*s%s%s\", color, (int)(eol - bol), bol, reset,\n \t\t       *eol ? \"\\n\" : \"\");\n+\t\tgraph_show_oneline(opt->graph);\n \t\tbol = (*eol) ? (eol + 1) : eol;\n \t}\n }\ndiff --git a/t/t4202-log.sh b/t/t4202-log.sh\nindex cb03d28..99ab7ca 100755\n--- a/t/t4202-log.sh\n+++ b/t/t4202-log.sh\n@@ -3,6 +3,7 @@\n test_description='git log'\n \n . ./test-lib.sh\n+. \"$TEST_DIRECTORY/lib-gpg.sh\"\n \n test_expect_success setup '\n \n@@ -841,4 +842,34 @@ test_expect_success 'dotdot is a parent directory' '\n \ttest_cmp expect actual\n '\n \n+test_expect_success GPG 'log --graph --show-signature' '\n+\ttest_when_finished \"git reset --hard && git checkout master\" &&\n+\tgit checkout -b signed master &&\n+\techo foo >foo &&\n+\tgit add foo &&\n+\tgit commit -S -m signed_commit &&\n+\tgit log --graph --show-signature -n1 signed >actual &&\n+\tgrep \"^| gpg: Signature made\" actual &&\n+\tgrep \"^| gpg: Good signature\" actual\n+'\n+\n+test_expect_success GPG 'log --graph --show-signature for merged tag' '\n+\ttest_when_finished \"git reset --hard && git checkout master\" &&\n+\tgit checkout -b plain master &&\n+\techo aaa >bar &&\n+\tgit add bar &&\n+\tgit commit -m bar_commit &&\n+\tgit checkout -b tagged master &&\n+\techo bbb >baz &&\n+\tgit add baz &&\n+\tgit commit -m baz_commit &&\n+\tgit tag -s -m signed_tag_msg signed_tag &&\n+\tgit checkout plain &&\n+\tgit merge --no-ff -m msg signed_tag &&\n+\tgit log --graph --show-signature -n1 plain >actual &&\n+\tgrep \"^|\\\\\\  merged tag\" actual &&\n+\tgrep \"^| | gpg: Signature made\" actual &&\n+\tgrep \"^| | gpg: Good signature\" actual\n+'\n+\n test_done\n-- \n2.0.0\n"}]}