diff options
author | Junio C Hamano <gitster@pobox.com> | 2016-10-21 15:28:07 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-10-21 15:28:07 -0700 |
commit | 11fd66de9bceac5ffb70ad3ad225203b95d19aa2 (patch) | |
tree | c63314bc1bd51798bddde160e4ce52f95d698092 /transport.c | |
parent | 901f3d403ef2416fb287399f8ed9c5dc5fb632f9 (diff) | |
download | git-11fd66de9bceac5ffb70ad3ad225203b95d19aa2.tar.gz |
transport: allow summary-width to be computed dynamically
Now we have identified three callchains that have a set of refs that
they want to show their <old, new> object names in an aligned output,
we can replace their reference to the constant TRANSPORT_SUMMARY_WIDTH
with a helper function call to transport_summary_width() that takes
the set of ref as a parameter. This step does not yet iterate over
the refs and compute, which is left as an exercise to the readers.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'transport.c')
-rw-r--r-- | transport.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/transport.c b/transport.c index ec02b78924..d4b8bf5f25 100644 --- a/transport.c +++ b/transport.c @@ -429,6 +429,11 @@ static int print_one_push_status(struct ref *ref, const char *dest, int count, return 1; } +int transport_summary_width(const struct ref *refs) +{ + return (2 * FALLBACK_DEFAULT_ABBREV + 3); +} + void transport_print_push_status(const char *dest, struct ref *refs, int verbose, int porcelain, unsigned int *reject_reasons) { @@ -436,7 +441,7 @@ void transport_print_push_status(const char *dest, struct ref *refs, int n = 0; unsigned char head_sha1[20]; char *head; - int summary_width = TRANSPORT_SUMMARY_WIDTH; + int summary_width = transport_summary_width(refs); head = resolve_refdup("HEAD", RESOLVE_REF_READING, head_sha1, NULL); |