From 7cc13c717b52d3539e76f087d747f96d0d24a914 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Wed, 16 Mar 2016 09:15:53 -0700 Subject: pretty: expand tabs in indented logs to make things line up properly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A commit log message sometimes tries to line things up using tabs, assuming fixed-width font with the standard 8-place tab settings. Viewing such a commit however does not work well in "git log", as we indent the lines by prefixing 4 spaces in front of them. This should all line up: Column 1 Column 2 -------- -------- A B ABCD EFGH SPACES Instead of Tabs Even with multi-byte UTF8 characters: Column 1 Column 2 -------- -------- Ä B åäö 100 A Møøse once bit my sister.. Tab-expand the lines in "git log --expand-tabs" output before prefixing 4 spaces. This is based on the patch by Linus Torvalds, but at this step, we require an explicit command line option to enable the behaviour. Signed-off-by: Junio C Hamano --- revision.h | 1 + 1 file changed, 1 insertion(+) (limited to 'revision.h') diff --git a/revision.h b/revision.h index 23857c0ed1..40797535fa 100644 --- a/revision.h +++ b/revision.h @@ -133,6 +133,7 @@ struct rev_info { show_notes_given:1, show_signature:1, pretty_given:1, + expand_tabs_in_log:1, abbrev_commit:1, abbrev_commit_given:1, zero_commit:1, -- cgit v1.2.3 From 0893eec85fca0f76039a96cbbcd3592ff8571c24 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Tue, 29 Mar 2016 15:49:24 -0700 Subject: pretty: enable --expand-tabs by default for selected pretty formats "git log --pretty={medium,full,fuller}" and "git log" by default prepend 4 spaces to the log message, so it makes sense to enable the new "expand-tabs" facility by default for these formats. Add --no-expand-tabs option to override the new default. The change alone breaks a test in t4201 that runs "git shortlog" on the output from "git log", and expects that the output from "git log" does not do such a tab expansion. Adjust the test to explicitly disable expand-tabs with --no-expand-tabs. Signed-off-by: Junio C Hamano --- revision.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'revision.h') diff --git a/revision.h b/revision.h index 40797535fa..6cc36b49c5 100644 --- a/revision.h +++ b/revision.h @@ -133,7 +133,6 @@ struct rev_info { show_notes_given:1, show_signature:1, pretty_given:1, - expand_tabs_in_log:1, abbrev_commit:1, abbrev_commit_given:1, zero_commit:1, @@ -149,6 +148,8 @@ struct rev_info { linear:1; struct date_mode date_mode; + int expand_tabs_in_log; /* unset if negative */ + int expand_tabs_in_log_default; unsigned int abbrev; enum cmit_fmt commit_format; -- cgit v1.2.3