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 <josef@kufner.cz>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Josef Kufner
2016-06-16 20:18:37 +07:00
committed by Junio C Hamano
parent 05219a1276
commit 3ad87c807c
6 changed files with 40 additions and 0 deletions

View File

@ -161,6 +161,7 @@ struct pretty_print_context {
* should not be counted on by callers.
*/
struct string_list in_body_headers;
int graph_width;
};
struct userformat_want {