From 3ad87c807c2b6cbfbdfb2c78412781ecc7db593d Mon Sep 17 00:00:00 2001 From: Josef Kufner Date: Thu, 16 Jun 2016 20:18:37 +0700 Subject: pretty: pass graph width to pretty formatting for use in '%>|(N)' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- graph.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'graph.c') diff --git a/graph.c b/graph.c index 1350bdde3b..ad766facad 100644 --- a/graph.c +++ b/graph.c @@ -669,6 +669,13 @@ static void graph_output_padding_line(struct git_graph *graph, graph_pad_horizontally(graph, sb, graph->num_new_columns * 2); } + +int graph_width(struct git_graph *graph) +{ + return graph->width; +} + + static void graph_output_skip_line(struct git_graph *graph, struct strbuf *sb) { /* -- cgit 1.2.3-korg