From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4783 invoked by alias); 24 May 2010 17:55:49 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 27970 Received: (qmail 20501 invoked from network); 24 May 2010 17:55:47 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS autolearn=ham version=3.3.1 Received-SPF: pass (ns1.primenet.com.au: SPF record at m.gmane.org designates 80.91.229.12 as permitted sender) X-Injected-Via-Gmane: http://gmane.org/ To: zsh-workers@zsh.org connect(): No such file or directory From: Seth House Subject: Re: PATCH: =?utf-8?b?dmNzX2luZm8=?= Mercurial backend branch name display Date: Mon, 24 May 2010 17:55:35 +0000 (UTC) Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: sea.gmane.org User-Agent: Loom/3.14 (http://gmane.org/) X-Loom-IP: 65.44.116.164 (Mozilla/5.0 (X11; U; Linux x86_64; en-US) AppleWebKit/533.5 (KHTML, like Gecko) Chrome/5.0.377.0 Safari/533.5) Greg Klanderman klanderman.net> writes: > Looks like you have a spurious 'if' there.. No, that is correct. It initially tries to obtain the branch name by invoking hg (line 54) -- only if the user has opted to allow invoking hg. If it still doesn't know the branch name and a file containing the name is readable, it will pull it from the file (line 59). Finally, if we still don't know the branch it defaults to "default" (line 64). It could be refactored to the following if you feel this is more readable: # If the user doesn't opt to invoke hg we can still get the current branch if [[ -z ${r_branch} ]] ; then if [[ -r ${branchfile} ]] ; then r_branch=$(< ${branchfile}) else # If we still don't know the branch it's safe to assume default r_branch="default" fi fi