Subject: Re: [PATCH 1/2] fetch: better alignment in ref summary

From: Junio C Hamano <[email-masked]>
Date: Sun, 22 May 2016 17:58:12 -0700

Nguyễn Thái Ngọc Duy  <[email-masked]> writes:

> Currently fetch hard-codes the "remote" column to be 10. For repos
> with long branch names, the output could look ugly like this
>
> From github.com:pclouds/git
>  * [new branch]      2nd-index  -> pclouds/2nd-index
>  * [new branch]      3nd-index  -> pclouds/3nd-index
>  * [new branch]      file-watcher -> pclouds/file-watcher
>  ...

So, we have to show "an object taken from their name is copied to
our name", and somebody designed the format to report it to use
"their-name -> our-name", and decided that a certain number of
columns is sufficient for "their-name" part and that attempting to
align "->" sign is a good idea..

That was long before a few best practices were established.  We
encourage people to use longer and more descriptive branch names, so
"their-name" is a lot longer than 10 columns, which contradicts the
first one of two old assumptions.  And we want to keep the second
old assumption alive.

Progressively pushing "->" to the right like you did might be a
cheap way to do so, but shouldn't we be also taking advantage of
another best practice that has been established since we started
reporting this "their-name came to our-name", namely, very often,
our-name is a short and fixed prefix plus their-name?

That is, I wonder if the above can become something like:

> From github.com:pclouds/git
>  * [new branch]      { -> pclouds/}2nd-index
>  * [new branch]      { -> pclouds/}3nd-index
>  * [new branch]      { -> pclouds/}file-watcher
>  ...

The above example borrows the idea used in diffstat label for
renaming patch and I think you can design a better notataion, but a
big point is that you can shorten the whole thing by not repeating
the common part twice.  The arrow aligns merely as a side effect of
the shortening, taking advantage of the fact that most people fetch
with "$their_prefix/*:$our_prefix/*" renaming refspec.