mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-pkg
synced 2026-01-15 03:53:32 +01:00
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 <remote-base>/$fromuser/$reponame.. Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
3ed25d5654
commit
1b21e33ded
1 changed files with 23 additions and 4 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue