Skip to content

Commit

Permalink
log-tree: use custom line terminator in line termination mode
Browse files Browse the repository at this point in the history
When using a custom format in line termination mode (as opposed to line
separation mode), the configured line terminator is not used, so things
like "git log --pretty=tformat:%H -z" do not work properly.

Make it use the line terminator the user ordered.

Signed-off-by: Jan Krüger <jk@jk.gs>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Jan Krüger authored and Junio C Hamano committed May 1, 2012
1 parent f174a25 commit 3e06530
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion log-tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ void show_log(struct rev_info *opt)
if (opt->use_terminator) {
if (!opt->missing_newline)
graph_show_padding(opt->graph);
putchar('\n');
putchar(opt->diffopt.line_termination);
}

strbuf_release(&msgbuf);
Expand Down
12 changes: 12 additions & 0 deletions t/t4205-log-pretty-formats.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,16 @@ test_expect_success 'alias loop' '
test_must_fail git log --pretty=test-foo
'

test_expect_success 'NUL separation' '
printf "add bar\0initial" >expected &&
git log -z --pretty="format:%s" >actual &&
test_cmp expected actual
'

test_expect_success 'NUL termination' '
printf "add bar\0initial\0" >expected &&
git log -z --pretty="tformat:%s" >actual &&
test_cmp expected actual
'

test_done

0 comments on commit 3e06530

Please sign in to comment.