{"thread":{"id":"23008","subject":"[PATCH] blame: fix indent of line numbers","startedAt":"2010-03-13T10:25:12Z","lastAt":"2010-03-13T20:53:06Z","messageCount":2,"participants":["René Scharfe","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"136719","messageId":"4B9B6808.9070302@lsrfire.ath.cx","threadId":"23008","inReplyTo":null,"subject":"[PATCH] blame: fix indent of line numbers","fromName":"René Scharfe","fromEmail":"rene.scharfe@lsrfire.ath.cx","sentAt":"2010-03-13T10:25:12Z","receivedAt":"2010-03-13T10:25:12Z","isPatch":true,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"Correct the calculation of the number of digits for line counts of the\nform 10^n-1 (9, 99, ...) in lineno_width().  This makes blame stop\nprinting an extra space before the line numbers of files with that many\ntotal lines.\n\nSigned-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>\n---\n builtin/blame.c  |    2 +-\n t/t8003-blame.sh |   20 +++++++++++++++++++-\n 2 files changed, 20 insertions(+), 2 deletions(-)\n\ndiff --git a/builtin/blame.c b/builtin/blame.c\nindex 10f7eac..fc15863 100644\n--- a/builtin/blame.c\n+++ b/builtin/blame.c\n@@ -1772,7 +1772,7 @@ static int lineno_width(int lines)\n {\n \tint i, width;\n \n-\tfor (width = 1, i = 10; i <= lines + 1; width++)\n+\tfor (width = 1, i = 10; i <= lines; width++)\n \t\ti *= 10;\n \treturn width;\n }\ndiff --git a/t/t8003-blame.sh b/t/t8003-blame.sh\nindex 3bbddd0..230143c 100755\n--- a/t/t8003-blame.sh\n+++ b/t/t8003-blame.sh\n@@ -11,7 +11,15 @@ test_expect_success setup '\n \techo B B B B B >two &&\n \techo C C C C C >tres &&\n \techo ABC >mouse &&\n-\tgit add one two tres mouse &&\n+\tfor i in 1 2 3 4 5 6 7 8 9\n+\tdo\n+\t\techo $i\n+\tdone >nine_lines &&\n+\tfor i in 1 2 3 4 5 6 7 8 9 a\n+\tdo\n+\t\techo $i\n+\tdone >ten_lines &&\n+\tgit add one two tres mouse nine_lines ten_lines &&\n \ttest_tick &&\n \tGIT_AUTHOR_NAME=Initial git commit -m Initial &&\n \n@@ -167,4 +175,14 @@ test_expect_success 'blame -L with invalid end' '\n \tgrep \"has only 2 lines\" errors\n '\n \n+test_expect_success 'indent of line numbers, nine lines' '\n+\tgit blame nine_lines >actual &&\n+\ttest $(grep -c \"  \" actual) = 0\n+'\n+\n+test_expect_success 'indent of line numbers, ten lines' '\n+\tgit blame ten_lines >actual &&\n+\ttest $(grep -c \"  \" actual) = 9\n+'\n+\n test_done\n-- \n1.7.0.2\n"},{"id":"136728","messageId":"7vk4tg7xl9.fsf@alter.siamese.dyndns.org","threadId":"23008","inReplyTo":"4B9B6808.9070302@lsrfire.ath.cx","subject":"Re: [PATCH] blame: fix indent of line numbers","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-03-13T20:53:06Z","receivedAt":"2010-03-13T20:53:06Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Thanks; embarrassed ;-)\n"}]}