Update zgitinit with more quoting

This commit is contained in:
Sami Samhuri 2024-01-02 10:47:07 -08:00
parent 17fbfec253
commit 0ae59e8afe
No known key found for this signature in database
GPG key ID: 4B4195422742FC16

View file

@ -66,23 +66,23 @@ zgit_head() {
if [ -z "$zgit_info[head]" ]; then if [ -z "$zgit_info[head]" ]; then
local name='' local name=''
name=$(git symbolic-ref -q HEAD) name="$(git symbolic-ref -q HEAD)"
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
if [[ $name == refs/(heads|tags)/* ]]; then if [[ "$name" == refs/(heads|tags)/* ]]; then
name=${name#refs/(heads|tags)/} name="${name#refs/(heads|tags)/}"
fi fi
else else
name=$(git name-rev --name-only --no-undefined --always HEAD) name="$(git name-rev --name-only --no-undefined --always HEAD)"
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
return 1 return 1
elif [[ $name == remotes/* ]]; then elif [[ "$name" == remotes/* ]]; then
name=${name#remotes/} name="${name#remotes/}"
fi fi
fi fi
zgit_info[head]=$name zgit_info[head]="$name"
fi fi
echo $zgit_info[head] echo "$zgit_info[head]"
} }
zgit_branch() { zgit_branch() {