From: Jeff King Date: Thu, 26 May 2016 05:18:21 GMT Subject: Re: [PATCH 1/2] fetch: better alignment in ref summary Message-ID: <20160526051820.GE6756@sigill.intra.peff.net> In-Reply-To: <20160522112019.26516-2-pclouds@gmail.com> On Sun, May 22, 2016 at 06:20:18PM +0700, Nguyễn Thái Ngọc Duy wrote: > To make all "->" aligned, we may need to go through the ref list > twice, or buffer the output and let column.c align it. Either way > needs a lot more work than this. I don't think a two-pass approach is _too_ bad. The trickiest thing is that we handle the "prune" refs separately, even though they go in the same status table. However, I tried it, and the results looked much worse for my example repo than yours. The problem is that I had one gigantic refname, and that shoved the "->" and everything after far to the right, where they wrapped to the next line. Though the stair-stepping in your patch is funny, the output is easier to read. I do agree with Junio that we could probably improve the output quite a bit by not showing each refname twice in the common case. I don't quite find the "{ -> origin/}whatever" particularly pretty, but something like that which keeps the variable bits at the end would make this problem just go away. > -#define REFCOL_WIDTH 10 > +static int REFCOL_WIDTH = 10; This should probably go lower-case if it's not a preprocessor macro anymore. I know it makes the diff a lot noisier, but I think it's worth it. -Peff