aboutsummaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorRené Scharfe <rene.scharfe@lsrfire.ath.cx>2010-03-13 11:25:12 +0100
committerJunio C Hamano <gitster@pobox.com>2010-03-13 12:04:17 -0800
commit00fb3d214cbb867f45de0084e6b844445e076dce (patch)
tree13e8c1e8d5c06d20bf1b0ee7383e79855d8b0331 /t
parent4a2284b9997400d46b439a9cd272ba16cbf4f377 (diff)
downloadgit-00fb3d214cbb867f45de0084e6b844445e076dce.tar.gz
git-00fb3d214cbb867f45de0084e6b844445e076dce.tar.xz
blame: fix indent of line numbers
Correct the calculation of the number of digits for line counts of the form 10^n-1 (9, 99, ...) in lineno_width(). This makes blame stop printing an extra space before the line numbers of files with that many total lines. Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-xt/t8003-blame.sh20
1 files changed, 19 insertions, 1 deletions
diff --git a/t/t8003-blame.sh b/t/t8003-blame.sh
index 3bbddd03c..230143cf3 100755
--- a/t/t8003-blame.sh
+++ b/t/t8003-blame.sh
@@ -11,7 +11,15 @@ test_expect_success setup '
echo B B B B B >two &&
echo C C C C C >tres &&
echo ABC >mouse &&
- git add one two tres mouse &&
+ for i in 1 2 3 4 5 6 7 8 9
+ do
+ echo $i
+ done >nine_lines &&
+ for i in 1 2 3 4 5 6 7 8 9 a
+ do
+ echo $i
+ done >ten_lines &&
+ git add one two tres mouse nine_lines ten_lines &&
test_tick &&
GIT_AUTHOR_NAME=Initial git commit -m Initial &&
@@ -167,4 +175,14 @@ test_expect_success 'blame -L with invalid end' '
grep "has only 2 lines" errors
'
+test_expect_success 'indent of line numbers, nine lines' '
+ git blame nine_lines >actual &&
+ test $(grep -c " " actual) = 0
+'
+
+test_expect_success 'indent of line numbers, ten lines' '
+ git blame ten_lines >actual &&
+ test $(grep -c " " actual) = 9
+'
+
test_done