From 0ae59e8afe87b9fc921d998366175e8b6d71866b Mon Sep 17 00:00:00 2001 From: Sami Samhuri Date: Tue, 2 Jan 2024 10:47:07 -0800 Subject: [PATCH] Update zgitinit with more quoting --- zsh/functions/zgitinit | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/zsh/functions/zgitinit b/zsh/functions/zgitinit index b428cc3..79c33f7 100644 --- a/zsh/functions/zgitinit +++ b/zsh/functions/zgitinit @@ -66,23 +66,23 @@ zgit_head() { if [ -z "$zgit_info[head]" ]; then local name='' - name=$(git symbolic-ref -q HEAD) + name="$(git symbolic-ref -q HEAD)" if [ $? -eq 0 ]; then - if [[ $name == refs/(heads|tags)/* ]]; then - name=${name#refs/(heads|tags)/} + if [[ "$name" == refs/(heads|tags)/* ]]; then + name="${name#refs/(heads|tags)/}" fi 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 return 1 - elif [[ $name == remotes/* ]]; then - name=${name#remotes/} + elif [[ "$name" == remotes/* ]]; then + name="${name#remotes/}" fi fi - zgit_info[head]=$name + zgit_info[head]="$name" fi - echo $zgit_info[head] + echo "$zgit_info[head]" } zgit_branch() {