diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2013-04-19 03:08:51 +0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-04-19 03:28:29 +0400 |
commit | a7f01c6b4ddf9f2f6bdcb23fc7afb56695807cba (patch) | |
tree | bbd2ecfc44a0e3349d2e419f379e653a008dc00f /t | |
parent | a57523428b4c08795e793356e12afc3de812f84a (diff) |
pretty: support truncating in %>, %< and %><
%>(N,trunc) truncates the right part after N columns and replace the
last two letters with "..". ltrunc does the same on the left. mtrunc
cuts the middle out.
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')
-rwxr-xr-x | t/t4205-log-pretty-formats.sh | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh index 88f2427985..b8685b97f9 100755 --- a/t/t4205-log-pretty-formats.sh +++ b/t/t4205-log-pretty-formats.sh @@ -143,6 +143,45 @@ EOF test_cmp expected actual ' +test_expect_success 'left alignment formatting with trunc' ' + git log --pretty="format:%<(10,trunc)%s" >actual && + # complete the incomplete line at the end + echo >>actual && + qz_to_tab_space <<\EOF >expected && +message .. +message .. +add bar Z +initial Z +EOF + test_cmp expected actual +' + +test_expect_success 'left alignment formatting with ltrunc' ' + git log --pretty="format:%<(10,ltrunc)%s" >actual && + # complete the incomplete line at the end + echo >>actual && + qz_to_tab_space <<\EOF >expected && +..sage two +..sage one +add bar Z +initial Z +EOF + test_cmp expected actual +' + +test_expect_success 'left alignment formatting with mtrunc' ' + git log --pretty="format:%<(10,mtrunc)%s" >actual && + # complete the incomplete line at the end + echo >>actual && + qz_to_tab_space <<\EOF >expected && +mess.. two +mess.. one +add bar Z +initial Z +EOF + test_cmp expected actual +' + test_expect_success 'right alignment formatting' ' git log --pretty="format:%>(40)%s" >actual && # complete the incomplete line at the end |