[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:
parent
daa4aab636
commit
a5eca28a97
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue