From 66d21bcc8d1249826255652c5afe408d423ecd79 Mon Sep 17 00:00:00 2001 From: Max Howell Date: Sun, 28 Jan 2024 07:09:22 -0500 Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20`--sync`=20for=20git=20aliases?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #4833 --- projects/git-scm.org/git-shim | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/projects/git-scm.org/git-shim b/projects/git-scm.org/git-shim index aec29ead..33951f8d 100755 --- a/projects/git-scm.org/git-shim +++ b/projects/git-scm.org/git-shim @@ -46,13 +46,17 @@ _provides() { fi } +_is_alias() { + git config --get-regexp '^alias\.' | awk '{ print $1 }' | sed 's/alias\.//' | grep -qx "$cmd" +} + if [ -z "$cmd" ]; then exec "$libexec/git" "$@" elif [ -x "$libexec/git-$cmd" ] && [ -f "$libexec/git-$cmd" ]; then exec "$libexec/git" "$@" elif type "git-$cmd" >/dev/null 2>&1; then 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" "$@" else exec "$libexec/git" "$@"