From 65acfeacaa6e50c92a6ac18dc08356026a99b3f3 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Fri, 30 Sep 2016 17:19:35 -0700 Subject: abbrev: add FALLBACK_DEFAULT_ABBREV to prepare for auto sizing We'll be introducing a new way to decide the default abbreviation length by initialising DEFAULT_ABBREV to -1 to signal the first call to "find unique abbreviation" codepath to compute a reasonable value based on the number of objects we have to avoid collisions. We have long relied on DEFAULT_ABBREV being a positive concrete value that is used as the abbreviation length when no extra configuration or command line option has overridden it. Some codepaths wants to use such a positive concrete default value even before making their first request to actually trigger the computation for the auto sized default. Introduce FALLBACK_DEFAULT_ABBREV and use it to the code that attempts to align the report from "git fetch". For now, this macro is also used to initialize the default_abbrev variable, but the auto-sizing code will use -1 and then use the value of FALLBACK_DEFAULT_ABBREV as the starting point of auto-sizing. Signed-off-by: Junio C Hamano --- builtin/fetch.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'builtin/fetch.c') diff --git a/builtin/fetch.c b/builtin/fetch.c index 164623bb6f..a9f12cc5cf 100644 --- a/builtin/fetch.c +++ b/builtin/fetch.c @@ -17,6 +17,9 @@ #include "argv-array.h" #include "utf8.h" +#define TRANSPORT_SUMMARY(x) \ + (int)(TRANSPORT_SUMMARY_WIDTH + strlen(x) - gettext_width(x)), (x) + static const char * const builtin_fetch_usage[] = { N_("git fetch [] [ [...]]"), N_("git fetch [] "), -- cgit v1.2.1