path: root/log-tree.c
diff options
authorJosef Kufner <>2016-06-16 13:18:37 (GMT)
committerJunio C Hamano <>2016-06-16 18:43:36 (GMT)
commit3ad87c807c2b6cbfbdfb2c78412781ecc7db593d (patch)
treee7b1ea6c6d9fa662be89d963317532a5e9663c63 /log-tree.c
parent05219a1276341e72d8082d76b7f5ed394b7437a4 (diff)
pretty: pass graph width to pretty formatting for use in '%>|(N)'
Pass graph width to pretty formatting, to make N in '%>|(N)' include columns consumed by graph rendered when --graph option is in use. For example, in the output of git log --all --graph --pretty='format: [%>|(20)%h] %ar%d' this change will make all commit hashes align at 20th column from the edge of the terminal, not from the edge of the graph. Signed-off-by: Josef Kufner <> Signed-off-by: Junio C Hamano <> Signed-off-by: Nguyễn Thái Ngọc Duy <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'log-tree.c')
1 files changed, 2 insertions, 0 deletions
diff --git a/log-tree.c b/log-tree.c
index 78a5381..8d39315 100644
--- a/log-tree.c
+++ b/log-tree.c
@@ -687,6 +687,8 @@ void show_log(struct rev_info *opt)
ctx.output_encoding = get_log_output_encoding();
if (opt->from_ident.mail_begin && opt->from_ident.name_begin)
ctx.from_ident = &opt->from_ident;
+ if (opt->graph)
+ ctx.graph_width = graph_width(opt->graph);
pretty_print_commit(&ctx, commit, &msgbuf);
if (opt->add_signoff)