pgit.sh: push doesn't understand --login

--login is not understood by pgit.sh push. Solve that by allowing all
commands a --login option. This addresses our use case, but isn't
ideal of course. Will be finally fixed by moving pgit.sh's
functionality into Python code.

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2025-11-26 20:55:35 +01:00
commit e31e50036d

View file

@ -115,7 +115,7 @@ clone()
local refspec=()
long_opts="$long_opts,refspec:"
local login="$whoami"
long_opts="$long_opts,login:"
[ "$cmd_login" ] && login="$cmd_login"
local opts
opts=$(getopt -o C --long "$long_opts" -n clone -- "$@") || fatal "Failed to parse options $@"
@ -129,10 +129,6 @@ clone()
refspec=(${2//:/ })
shift
;;
--login)
login="$2"
shift
;;
*)
fatal "Unknown option $1"
;;
@ -223,13 +219,13 @@ diff()
echo "running $0 $@ GIT_SSH=$GIT_SSH" >&2
cur=0
SSH=ssh
[ "$GIT_SSH" ] && SSH=$GIT_SSH
global_remote_base="ssh://git.janware.com/srv/git"
while [ ${1:0:1} = - ]; do
case $1 in
while [ "${1:0:1}" = - ]; do
case "$1" in
'--remote-base')
global_remote_base="$2"
shift
@ -246,8 +242,20 @@ else
fi
cmd=$1
cur=0
shift
while [ "${1:0:1}" = - ]; do
case $1 in
'--login')
cmd_login="$2"
shift 2
;;
*)
break
;;
esac
done
case $cmd in
clone|diff|commit)
$cmd "$@"