fix(cli): match 'push' anywhere in git args, not just $1

The script calls `git -C /path push ...` so the first arg is `-C`,
not `push`. Use glob match on full args instead.
This commit is contained in:
Cheney 2026-05-13 09:27:44 +08:00
parent dad06b465d
commit 48174c9ad2

View file

@ -258,7 +258,7 @@ init_repo "$REPO8" "0.6.0"
mkdir -p "$REPO8/bin-git"
cat >"$REPO8/bin-git/git" <<'WRAPPER'
#!/usr/bin/env bash
if [[ "${1:-}" == "push" ]]; then
if [[ "$*" == *"push"* ]]; then
echo "fatal: could not read from remote repository." >&2
exit 128
fi
@ -317,7 +317,7 @@ init_repo "$REPO10" "0.8.0"
mkdir -p "$REPO10/bin-git"
cat >"$REPO10/bin-git/git" <<'WRAPPER'
#!/usr/bin/env bash
if [[ "${1:-}" == "push" ]]; then
if [[ "$*" == *"push"* ]]; then
echo "GIT_PUSH_ARGS: $*" >> "$REPO_ROOT/git-push-log.txt"
fi
exec /usr/bin/git "$@"