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 --- commit.h | 1 + 1 file changed, 1 insertion(+) (limited to 'commit.h') diff --git a/commit.h b/commit.h index 5d58be001..a7ef682b5 100644 --- a/commit.h +++ b/commit.h @@ -147,6 +147,7 @@ struct pretty_print_context { int preserve_subject; struct date_mode date_mode; unsigned date_mode_explicit:1; + unsigned expand_tabs_in_log:1; int need_8bit_cte; char *notes_message; struct reflog_walk_info *reflog_info; -- cgit v1.2.1 From fe37a9c586a65943e1bca327a1bbe1ca4a3d3023 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Tue, 29 Mar 2016 16:05:39 -0700 Subject: pretty: allow tweaking tabwidth in --expand-tabs When the local convention of the project is to use tab width that is not 8, it may make sense to allow "git log --expand-tabs=" to tweak the output to match it. Signed-off-by: Junio C Hamano --- commit.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'commit.h') diff --git a/commit.h b/commit.h index a7ef682b5..b06db4d5d 100644 --- a/commit.h +++ b/commit.h @@ -147,7 +147,7 @@ struct pretty_print_context { int preserve_subject; struct date_mode date_mode; unsigned date_mode_explicit:1; - unsigned expand_tabs_in_log:1; + int expand_tabs_in_log; int need_8bit_cte; char *notes_message; struct reflog_walk_info *reflog_info; -- cgit v1.2.1