1
0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2024-11-22 06:50:49 +08:00

fix(git-commit): avoid conflict with aliases var

Closes #11876
This commit is contained in:
Carlo Sala 2023-09-06 10:54:11 +02:00
parent bae577d6b2
commit 8e8ec1348b
No known key found for this signature in database
GPG Key ID: DA6FB450C1A4FE9A

View File

@ -1,10 +1,11 @@
_register() {
if ! git config --global --get-all alias.$1 &>/dev/null; then
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'
fi
}
aliases=(
local -a _git_commit_aliases
_git_commit_aliases=(
'build'
'chore'
'ci'
@ -18,6 +19,9 @@ aliases=(
'test'
)
for alias in "${aliases[@]}"; do
_register $alias
done
for _alias in "${_git_commit_aliases[@]}"; do
_git_commit_register $_alias
done
unfunction _git_commit_register
unset _alias