Don’t --sync for git aliases

Fixes #4833
This commit is contained in:
Max Howell 2024-01-28 07:09:22 -05:00
parent df7eaa54b7
commit 66d21bcc8d

View file

@ -46,13 +46,17 @@ _provides() {
fi fi
} }
_is_alias() {
git config --get-regexp '^alias\.' | awk '{ print $1 }' | sed 's/alias\.//' | grep -qx "$cmd"
}
if [ -z "$cmd" ]; then if [ -z "$cmd" ]; then
exec "$libexec/git" "$@" exec "$libexec/git" "$@"
elif [ -x "$libexec/git-$cmd" ] && [ -f "$libexec/git-$cmd" ]; then elif [ -x "$libexec/git-$cmd" ] && [ -f "$libexec/git-$cmd" ]; then
exec "$libexec/git" "$@" exec "$libexec/git" "$@"
elif type "git-$cmd" >/dev/null 2>&1; then elif type "git-$cmd" >/dev/null 2>&1; then
exec "$libexec/git" "$@" exec "$libexec/git" "$@"
elif command -v pkgx >/dev/null 2>&1 && pkg=$(_provides); then elif ! _is_alias && command -v pkgx >/dev/null 2>&1 && pkg=$(_provides); then
exec pkgx +"$pkg" "$libexec/git" "$@" exec pkgx +"$pkg" "$libexec/git" "$@"
else else
exec "$libexec/git" "$@" exec "$libexec/git" "$@"