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 [] "), diff --git a/cache.h b/cache.h index f346c01708..5a651b8435 100644 --- a/cache.h +++ b/cache.h @@ -1183,6 +1183,9 @@ static inline int hex2chr(const char *s) #define MINIMUM_ABBREV minimum_abbrev #define DEFAULT_ABBREV default_abbrev +/* used when the code does not know or care what the default abbrev is */ +#define FALLBACK_DEFAULT_ABBREV 7 + struct object_context { unsigned char tree[20]; char path[PATH_MAX]; diff --git a/environment.c b/environment.c index cd5aa57179..44fb107b8a 100644 --- a/environment.c +++ b/environment.c @@ -16,7 +16,7 @@ int trust_executable_bit = 1; int trust_ctime = 1; int check_stat = 1; int has_symlinks = 1; -int minimum_abbrev = 4, default_abbrev = 7; +int minimum_abbrev = 4, default_abbrev = FALLBACK_DEFAULT_ABBREV; int ignore_case; int assume_unchanged; int prefer_symlink_refs; diff --git a/transport.h b/transport.h index 6fe3485325..e783377e40 100644 --- a/transport.h +++ b/transport.h @@ -142,8 +142,7 @@ struct transport { #define TRANSPORT_PUSH_ATOMIC 8192 #define TRANSPORT_PUSH_OPTIONS 16384 -#define TRANSPORT_SUMMARY_WIDTH (2 * DEFAULT_ABBREV + 3) -#define TRANSPORT_SUMMARY(x) (int)(TRANSPORT_SUMMARY_WIDTH + strlen(x) - gettext_width(x)), (x) +#define TRANSPORT_SUMMARY_WIDTH (2 * FALLBACK_DEFAULT_ABBREV + 3) /* Returns a transport suitable for the url */ struct transport *transport_get(struct remote *, const char *);