Browse Source

fix(git-commit): fix compatibility of alias functions (#11883)

Haltarys 1 year ago
parent
commit
b07c8cfe69
1 changed files with 1 additions and 1 deletions
  1. 1 1
      plugins/git-commit/git-commit.plugin.zsh

+ 1 - 1
plugins/git-commit/git-commit.plugin.zsh

@@ -1,6 +1,6 @@
 function _git_commit_register {
   if ! git config --global --get-all alias.$1 >/dev/null 2>&1; then
-    git config --global alias.$1 '!a() { if [[ "$1" == "-s" || "$1" == "--scope" ]]; then git commit -m "'$1'(${2}): ${@:3}"; else git commit -m "'$1': ${@}"; fi }; a'
+    git config --global alias.$1 '!a() { if [ "$1" = "-s" ] || [ "$1" = "--scope" ]; then local scope="$2"; shift 2; git commit -m "'$1'(${scope}): ${@}"; else git commit -m "'$1': ${@}"; fi }; a'
   fi
 }