diff options
author | Jan H. Schönherr <schnhrr@cs.tu-berlin.de> | 2012-10-18 16:43:28 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-10-18 14:20:49 -0700 |
commit | 14e1a4e1ff70aff36db3f5d2a8b806efd0134d50 (patch) | |
tree | 508e8594804778c6698a1acb5b1daf3fe1f96782 /t/t4202-log.sh | |
parent | bafc478f1618534fcb85bedc0fa224bd2d462441 (diff) | |
download | git-14e1a4e1ff70aff36db3f5d2a8b806efd0134d50.tar.gz git-14e1a4e1ff70aff36db3f5d2a8b806efd0134d50.tar.xz |
utf8: fix off-by-one wrapping of text
The wrapping logic in strbuf_add_wrapped_text() does currently not allow
lines that entirely fill the allowed width, instead it wraps the line one
character too early.
For example, the text "This is the sixth commit." formatted via
"%w(11,1,2)" (wrap at 11 characters, 1 char indent of first line, 2 char
indent of following lines) results in four lines: " This is", " the",
" sixth", " commit." This is wrong, because " the sixth" is exactly
11 characters long, and thus allowed.
Fix this by allowing the (width+1) character of a line to be a valid
wrapping point if it is a whitespace character.
Signed-off-by: Jan H. Schönherr <schnhrr@cs.tu-berlin.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4202-log.sh')
-rwxr-xr-x | t/t4202-log.sh | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/t/t4202-log.sh b/t/t4202-log.sh index 45058cc8c..37023e30e 100755 --- a/t/t4202-log.sh +++ b/t/t4202-log.sh @@ -72,9 +72,9 @@ cat > expect << EOF commit. EOF -test_expect_success 'format %w(12,1,2)' ' +test_expect_success 'format %w(11,1,2)' ' - git log -2 --format="%w(12,1,2)This is the %s commit." > actual && + git log -2 --format="%w(11,1,2)This is the %s commit." > actual && test_cmp expect actual ' |