From: Andrew Sayers Date: Sun, 06 Jun 2010 22:19:11 GMT Subject: Re: [PATCH] bash completion: Support "unpushed commits" warnings in __git_ps1 Message-ID: <4C0C1EDF.6050404@pileofstuff.org> In-Reply-To: On 06/06/10 22:07, Jakub Narebski wrote: > > What disallowed ${} constructs? My mistake, I misread that part of CodingGuidelines. The following bash-specific implementation takes about 0.013 seconds: BRANCH=( $( git log --first-parent -1 \ --grep="^git-svn-id: $remote_branch" ) ) BRANCH=${BRANCH[ ${#BRANCH[@]} - 2 ]} BRANCH=${BRANCH%@*} BRANCH=${BRANCH#*$remote_branch/} Using an array here saves about 0.001 of a second. - Andrew