b07c8cfe692bc6c7702f0aef5d493b12dfb43392
- Author
- Haltarys <45515869+Haltarys@users.noreply.github.com>
- Committer
- GitHub <noreply@github.com>
- Date
Message
fix(git-commit): fix compatibility of alias functions (#11883)
Diff
1diff --git a/plugins/git-commit/git-commit.plugin.zsh b/plugins/git-commit/git-commit.plugin.zsh
2index 2ac8aa5f4d48e11af6a6472779f646ded4c5e508..4ad4c01770a808336b6d3b7c9f90b21c0c4fa768 100644
3--- a/plugins/git-commit/git-commit.plugin.zsh
4+++ b/plugins/git-commit/git-commit.plugin.zsh
5@@ -1,6 +1,6 @@
6 function _git_commit_register {
7 if ! git config --global --get-all alias.$1 >/dev/null 2>&1; then
8- 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'
9+ 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'
10 fi
11 }
12