[git] cherry-move: use plumbing to list branches

Use git for-each-ref instead of git branch to check the existence of a
branch.
This commit is contained in:
Matteo Cypriani 2011-07-01 15:52:05 +02:00
parent daa4aab636
commit a5eca28a97
1 changed files with 1 additions and 2 deletions

View File

@ -16,8 +16,7 @@ set -e
assert_branch_exists() assert_branch_exists()
{ {
RET=$(git branch | sed --quiet "s/^\*\? \+${1}$/${1}/p") if ! git for-each-ref refs/heads | grep "/${1}$" >/dev/null ; then
if [ "$RET" != $1 ] ; then
echo "The branch $1 does not exist!" echo "The branch $1 does not exist!"
exit 2 exit 2
fi fi