git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] log --oneline: put decoration at the end of the line
@ 2012-09-19 11:52 Nguyễn Thái Ngọc Duy
  2012-09-19 18:20 ` Jeff King
  0 siblings, 1 reply; 21+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2012-09-19 11:52 UTC (permalink / raw)
  To: git; +Cc: Nguyễn Thái Ngọc Duy

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 <pclouds@gmail.com>
---
 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

^ permalink raw reply related	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2012-09-25  0:27 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-19 11:52 [PATCH] log --oneline: put decoration at the end of the line Nguyễn Thái Ngọc Duy
2012-09-19 18:20 ` Jeff King
2012-09-19 19:57   ` Junio C Hamano
2012-09-19 20:05     ` Jeff King
2012-09-19 23:34     ` Junio C Hamano
2012-09-19 23:42       ` Jeff King
2012-09-20  0:18         ` Junio C Hamano
2012-09-20 10:43         ` Nguyen Thai Ngoc Duy
2012-09-20 12:26           ` [PATCH 0/2] New pretty format color specifiers %C+ and %C- Nguyễn Thái Ngọc Duy
2012-09-20 12:26             ` [PATCH 1/2] pretty: share code between format_decoration and show_decorations Nguyễn Thái Ngọc Duy
2012-09-20 12:26             ` [PATCH 2/2] pretty: support placeholders %C+ and %C- Nguyễn Thái Ngọc Duy
2012-09-20 14:38               ` [PATCH 3/2] pretty: support right alignment Nguyen Thai Ngoc Duy
2012-09-20 16:40                 ` Junio C Hamano
2012-09-21  8:55                   ` Nguyen Thai Ngoc Duy
2012-09-21 17:46                     ` Junio C Hamano
2012-09-23  8:17                     ` Junio C Hamano
2012-09-25  0:27                       ` Jeff King
2012-09-21 13:03                   ` Nguyen Thai Ngoc Duy
2012-09-20 16:47               ` [PATCH 2/2] pretty: support placeholders %C+ and %C- Junio C Hamano
2012-09-20 17:47                 ` Junio C Hamano
2012-09-21  8:36                   ` Nguyen Thai Ngoc Duy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).