[ fix #891 ] Cast branch output if HEAD not exists

This commit is contained in:
equt 2020-11-11 22:38:19 +08:00
parent ad8c77bfa3
commit f66f7e484f
No known key found for this signature in database
GPG key ID: C5A974C726D0D6AE

View file

@ -2,7 +2,7 @@
if [[ $1 == "" ]]
then
branch=$(git rev-parse --abbrev-ref HEAD)
branch=$(git rev-parse --abbrev-ref HEAD 2&> /dev/null)
remote=$(git config branch."${branch}".remote || echo "origin")
else
remote=$1