aboutsummaryrefslogtreecommitdiff
path: root/t/t4205-log-pretty-formats.sh
diff options
context:
space:
mode:
authorJosef Kufner <josef@kufner.cz>2016-06-16 20:18:37 +0700
committerJunio C Hamano <gitster@pobox.com>2016-06-16 11:43:36 -0700
commit3ad87c807c2b6cbfbdfb2c78412781ecc7db593d (patch)
treee7b1ea6c6d9fa662be89d963317532a5e9663c63 /t/t4205-log-pretty-formats.sh
parent05219a1276341e72d8082d76b7f5ed394b7437a4 (diff)
downloadgit-3ad87c807c2b6cbfbdfb2c78412781ecc7db593d.tar.gz
git-3ad87c807c2b6cbfbdfb2c78412781ecc7db593d.tar.xz
pretty: pass graph width to pretty formatting for use in '%>|(N)'
Pass graph width to pretty formatting, to make N in '%>|(N)' include columns consumed by graph rendered when --graph option is in use. For example, in the output of git log --all --graph --pretty='format: [%>|(20)%h] %ar%d' this change will make all commit hashes align at 20th column from the edge of the terminal, not from the edge of the graph. Signed-off-by: Josef Kufner <josef@kufner.cz> Signed-off-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4205-log-pretty-formats.sh')
-rwxr-xr-xt/t4205-log-pretty-formats.sh24
1 files changed, 24 insertions, 0 deletions
diff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh
index 7398605e7..d75cdbbf9 100755
--- a/t/t4205-log-pretty-formats.sh
+++ b/t/t4205-log-pretty-formats.sh
@@ -319,6 +319,19 @@ EOF
test_cmp expected actual
'
+# Note: Space between 'message' and 'two' should be in the same column
+# as in previous test.
+test_expect_success 'right alignment formatting at the nth column with --graph. i18n.logOutputEncoding' '
+ git -c i18n.logOutputEncoding=$test_encoding log --graph --pretty="tformat:%h %>|(40)%s" >actual &&
+ iconv -f utf-8 -t $test_encoding >expected <<EOF&&
+* $head1 message two
+* $head2 message one
+* $head3 add bar
+* $head4 $(commit_msg)
+EOF
+ test_cmp expected actual
+'
+
test_expect_success 'right alignment formatting with no padding' '
git log --pretty="tformat:%>(1)%s" >actual &&
cat <<EOF >expected &&
@@ -330,6 +343,17 @@ EOF
test_cmp expected actual
'
+test_expect_success 'right alignment formatting with no padding and with --graph' '
+ git log --graph --pretty="tformat:%>(1)%s" >actual &&
+ cat <<EOF >expected &&
+* message two
+* message one
+* add bar
+* $(commit_msg)
+EOF
+ test_cmp expected actual
+'
+
test_expect_success 'right alignment formatting with no padding. i18n.logOutputEncoding' '
git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%>(1)%s" >actual &&
cat <<EOF | iconv -f utf-8 -t $test_encoding >expected &&