Re: [PATCH] bash completion: Support "unpushed commits" warnings in __git_ps1
- From
- Andrew Sayers <andrew-git@pileofstuff.org>
- Date
- Jun 6, 2010, 22:19 UTC
- Message-ID
- <4C0C1EDF.6050404@pileofstuff.org>
- In-Reply-To
- <m3r5kjq3ac.fsf@localhost.localdomain>
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