From 1b21e33ded33ace2880a57515da726cc14cc0465 Mon Sep 17 00:00:00 2001 From: Jan Lindemann Date: Tue, 18 Nov 2025 15:25:46 +0100 Subject: [PATCH] pgit.sh: Support --remote-base pgit.sh has ssh://$login@git.janware.com/srv/git/$fromuser/proj/$reponame hard-coded as the remote Git URLs of every cloned project. This commit adds support for the global option --remote-base. Passing it changes the URL to /$fromuser/$reponame.. Signed-off-by: Jan Lindemann --- scripts/pgit.sh | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/scripts/pgit.sh b/scripts/pgit.sh index 5be8cf40..550f7e32 100644 --- a/scripts/pgit.sh +++ b/scripts/pgit.sh @@ -144,15 +144,15 @@ clone() continue fi cur=`expr $cur + 1` - local pullurl=ssh://$login@git.janware.com/srv/git/$fromuser/proj/$p - local pushurl=ssh://$login@git.janware.com/srv/git/$login/proj/$p + local pullurl=$remote_base/$fromuser$remote_subpath/$p + local pushurl=$remote_base/$login$remote_subpath/$p local curref="" fat_marker "Fetching project $p from user $fromuser" if [ "$fromuser" = "$login" ]; then if [ -d $p ]; then run_git -C $p pull --recurse-submodules=on-demand else - run_git clone ssh://$login@git.janware.com/srv/git/$fromuser/proj/$p + run_git clone $remote_base/$fromuser$remote_subpath/$p fi else local remotename="jw-$fromuser" @@ -172,7 +172,7 @@ clone() fi else # set -x - run_git clone ssh://$login@git.janware.com/srv/git/$fromuser/proj/$p + run_git clone $remote_base/$fromuser$remote_subpath/$p run_git -C $p remote rename origin $remotename || fatal failed to rename remote in $p run_git -C $p remote set-url --push $remotename no_push if [ $create_remote_user_repos = true ]; then @@ -205,6 +205,25 @@ echo "running $0 $@ GIT_SSH=$GIT_SSH" >&2 SSH=ssh [ "$GIT_SSH" ] && SSH=$GIT_SSH +remote_base="ssh://$login@git.janware.com/srv/git" + +while [ ${1:0:1} = - ]; do + case $1 in + '--remote-base') + remote_base="$2" + shift + ;; + esac + shift +done + +# Only janware.com ssh git supports subdirectories below users +if [[ "$remote_base" =~ git.janware.com ]]; then + remote_subpath="/proj" +else + remote_subpath="" +fi + cmd=$1 cur=0 shift