diff --git a/scripts/pgit.sh b/scripts/pgit.sh index 5168930f..75c95685 100644 --- a/scripts/pgit.sh +++ b/scripts/pgit.sh @@ -100,6 +100,8 @@ clone() fi } + local remote_base="$global_remote_base" + local remote_subpath="$global_remote_subpath" local p local whoami="$(id -un)" config @@ -151,6 +153,11 @@ clone() [ "$?" != 0 ] && exit 1 fi + if [ "$login" ]; then + [ "${remote_base/@/}" = "${remote_base}" ] || fatal "Specified both --login $login and user in URL $remote_base" + remote_base=$(echo $remote_base | sed "s|://|://$login@|") + fi + n_projects=`echo $projects | wc -w` if [ "$PGIT_KEEP_GOING" != y ]; then set -e; fi for p in $projects; do @@ -219,12 +226,12 @@ echo "running $0 $@ GIT_SSH=$GIT_SSH" >&2 SSH=ssh [ "$GIT_SSH" ] && SSH=$GIT_SSH -remote_base="ssh://$login@git.janware.com/srv/git" +global_remote_base="ssh://git.janware.com/srv/git" while [ ${1:0:1} = - ]; do case $1 in '--remote-base') - remote_base="$2" + global_remote_base="$2" shift ;; esac @@ -232,10 +239,10 @@ while [ ${1:0:1} = - ]; do done # Only janware.com ssh git supports subdirectories below users -if [[ "$remote_base" =~ git.janware.com ]]; then - remote_subpath="/proj" +if [[ "$global_remote_base" =~ git.janware.com ]]; then + global_remote_subpath="/proj" else - remote_subpath="" + global_remote_subpath="" fi cmd=$1