From mboxrd@z Thu Jan 1 00:00:00 1970 From: Junio C Hamano Subject: Re: [PATCH] builtin-branch: improve output when displaying remote branches Date: Wed, 11 Feb 2009 21:42:13 -0800 Message-ID: <7vhc30qki2.fsf@gitster.siamese.dyndns.org> References: <1234263701-95463-1-git-send-email-jaysoffian@gmail.com> <7vskmkqpp4.fsf@gitster.siamese.dyndns.org> <76718490902112030x46bddd84r561705a6b4f9d4b4@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: git@vger.kernel.org To: Jay Soffian X-From: git-owner@vger.kernel.org Thu Feb 12 06:43:53 2009 Return-path: Envelope-to: gcvg-git-2@gmane.org Received: from vger.kernel.org ([209.132.176.167]) by lo.gmane.org with esmtp (Exim 4.50) id 1LXUMa-0006PP-UD for gcvg-git-2@gmane.org; Thu, 12 Feb 2009 06:43:53 +0100 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750848AbZBLFmX (ORCPT ); Thu, 12 Feb 2009 00:42:23 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1750817AbZBLFmW (ORCPT ); Thu, 12 Feb 2009 00:42:22 -0500 Received: from a-sasl-fastnet.sasl.smtp.pobox.com ([207.106.133.19]:56327 "EHLO sasl.smtp.pobox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750800AbZBLFmV (ORCPT ); Thu, 12 Feb 2009 00:42:21 -0500 Received: from localhost.localdomain (unknown [127.0.0.1]) by a-sasl-fastnet.sasl.smtp.pobox.com (Postfix) with ESMTP id 4C25398AB8; Thu, 12 Feb 2009 00:42:19 -0500 (EST) Received: from pobox.com (unknown [68.225.240.211]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by a-sasl-fastnet.sasl.smtp.pobox.com (Postfix) with ESMTPSA id D61B098AB6; Thu, 12 Feb 2009 00:42:15 -0500 (EST) In-Reply-To: <76718490902112030x46bddd84r561705a6b4f9d4b4@mail.gmail.com> (Jay Soffian's message of "Wed, 11 Feb 2009 23:30:52 -0500") User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux) X-Pobox-Relay-ID: E9A23FDA-F8C7-11DD-8FA6-8B21C92D7133-77302942!a-sasl-fastnet.pobox.com Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: Jay Soffian writes: > On Wed, Feb 11, 2009 at 10:49 PM, Junio C Hamano wrote: >> Jay Soffian writes: >> >>> $ git branch -rv >>> origin/HEAD -> master >>> origin/html 6116912 Autogenerated HTML docs for v1.6.2-rc0-10-gf6b9 >> >> Doesn't the misalignment between the above two bother you? > > This comment makes me sad. In fact, a previous iteration looked like this: > > $ git branch -rv > origin/HEAD -> master > origin/html 6116912 Autogenerated HTML docs for v1.6.2-rc0-10-gf6b9 > origin/maint 7e1100e gitweb: add $prevent_xss option to prevent XSS > by repository content > origin/man 67cb1a7 Autogenerated manpages for v1.6.2-rc0-10-gf6b9 > origin/master f6b98e4 git-web--browse: Fix check for /bin/start > origin/next 417ce12 Merge branch 'master' into next > origin/pu 9d798e7 Merge branch 'db/foreign-scm' into pu > origin/todo 5ed7079 What's in update > > IOW, align based on the width of the branch name, completely ignoring > the width of " -> ...". But I found that ugly. It was actually more > work to get it the way it is. Wouldn't something like this easier to read? > origin/HEAD ------> master > origin/html 6116912 Autogenerated HTML docs for v1.6.2-rc0-10-gf6b9 > origin/maint 7e1100e gitweb: add $prevent_xss option to prevent XSS I am not sure about the long arrow. It may be easier to use "->" aligned th the right end, but that now falls into bikeshedding, so I'll leve that to the list. >> It can become something like: >> >> if (newitem->kind == REF_REMOTE_BRANCH) >> newitem->dest = resolve_remote_symref(refname - 13); >> else >> newitem->dest = NULL; >> if (newitem->dest) >> ... >> >> no? > > Yes indeed. Another thing you may want to consider is to introduce another variable "name" that is supposed to be the human readable part (i.e. refname-13 etc.) and leave the refname the full name starting from "refs/". The code to add and then subtract to go back and forth made my head spin when I read it.