Thread (49 messages) flat view 49 messages, 6 authors, 2016-07-04

Re: [PATCH v4 0/5] Better ref summary alignment in "git fetch"

From: Duy Nguyen <hidden>
Date: 2016-06-27 19:27:42

On Mon, Jun 27, 2016 at 02:43:54PM -0400, Jeff King wrote:
On Sun, Jun 26, 2016 at 07:58:05AM +0200, Nguyễn Thái Ngọc Duy wrote:
quoted
v4 is a cleaned up version of v3. Tests are added. Typos in
git-fetch.txt are corrected. The "{ -> origin/}master" format is
dropped.
Thanks for continuing to look into this.

I tried it on my most-horrible example case, and the results were...just
OK. Because the variable-length part of each line comes first, the
alignment code means that the "origin/$" bit of every line gets bumped
out. And if you have a single large branch name, then everybody gets
bumped out very far, even to the point of wrapping. E.g., I get
something like (with fetch.output=compact, obviously):

  From ...
   * [new branch]      branch1                      -> origin/$
   * [new branch]      branch2                      -> origin/$
   * [new branch]      some-really-long-branch-name -> origin/$
   + 1234abc..5678def  branch3                      -> origin/$ (forced
    update)
   * [new branch]      branch4                      -> origin/$
Yeah, '$' lowers the chances of wrapping but in corner cases, it'll be
just as bad.

Junio's suggestion is one way to go. Another is Marc's idea of
breaking lines, so we could in theory have something like this

   From ...
    * [new branch]      branch1    -> origin/$
    * [new branch]      branch2    -> origin/$
    * [new branch]      some-really-long-branch-name
                           -> origin/$
    + 1234abc..5678def  branch3    -> origin/$ (forced update)
    * [new branch]      branch4    -> origin/$

Or, for a very long branch name, we could put replace a big chunk of
it with an ellipsis. If it's long enough, I guess you can still figure
the branch name with a big gap in the middle (or left or right).

   From ...
    * [new branch]      branch1             -> origin/$
    * [new branch]      branch2             -> origin/$
    * [new branch]      some-re...anch-name -> origin/$
    + 1234abc..5678def  branch3             -> origin/$ (forced update)
    * [new branch]      branch4             -> origin/$

And with that we get dangerously close to full customization using
pretty placeholders :)
One of the nice things about Junio's "{ -> origin/}" suggestion is that
it puts the variable-length part at the end, so there's no extra
alignment required. And you'd get something like:

  From ...
   * [new branch]      { -> origin/}branch1
   * [new branch]      { -> origin/}branch2
   * [new branch]      { -> origin/}some-really-long-branch-name
   + 1234abc..5678def  { -> origin/}branch3 (forced update)
   * [new branch]      { -> origin/}branch4

-Peff
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help