Subject: [PATCH] log --oneline: put decoration at the end of the line

From: Nguyễn Thái Ngọc Duy <[email-masked]>
Date: Wed, 19 Sep 2012 18:52:20 +0700

I find it easier to read "git log --oneline" when the subject lines
align, which they don't when the log is decorated because the
decoration stands before the subject line.

I'm on colored output so moving decoration to the end of line does not
make it harder to recognize refs. What about black-and-white people?
We could right align the decoration if it makes it easier for
the black-and-whites to read (but not to the right edge when the screen
is too wide)

Signed-off-by: Nguyễn Thái Ngọc Duy <[email-masked]>
---
 log-tree.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/log-tree.c b/log-tree.c
index c894930..c51c942 100644
--- a/log-tree.c
+++ b/log-tree.c
@@ -616,11 +616,12 @@ void show_log(struct rev_info *opt)
 			printf(" (from %s)",
 			       find_unique_abbrev(parent->object.sha1,
 						  abbrev_commit));
-		show_decorations(opt, commit);
-		printf("%s", diff_get_color_opt(&opt->diffopt, DIFF_RESET));
 		if (opt->commit_format == CMIT_FMT_ONELINE) {
+			printf("%s", diff_get_color_opt(&opt->diffopt, DIFF_RESET));
 			putchar(' ');
 		} else {
+			show_decorations(opt, commit);
+			printf("%s", diff_get_color_opt(&opt->diffopt, DIFF_RESET));
 			putchar('\n');
 			graph_show_oneline(opt->graph);
 		}
@@ -682,6 +683,10 @@ void show_log(struct rev_info *opt)
 		graph_show_commit_msg(opt->graph, &msgbuf);
 	else
 		fwrite(msgbuf.buf, sizeof(char), msgbuf.len, stdout);
+	if (opt->commit_format == CMIT_FMT_ONELINE) {
+		show_decorations(opt, commit);
+		printf("%s", diff_get_color_opt(&opt->diffopt, DIFF_RESET));
+	}
 	if (opt->use_terminator) {
 		if (!opt->missing_newline)
 			graph_show_padding(opt->graph);
-- 
1.7.12.403.gce5cf6f.dirty