mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-pkg
synced 2026-01-15 03:53:32 +01:00
pgit.sh: clone --login configures broken remote
pgit.sh clone --login <username> fails to insert said username into a remotes url while adding it: Of ssh://<username>@git.janware.com/srv/git, only ssh://@git.janware.com/srv/git makes it into the config. Fix that. Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
7152a811e9
commit
0d95ccc5a0
1 changed files with 12 additions and 5 deletions
|
|
@ -100,6 +100,8 @@ clone()
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
local remote_base="$global_remote_base"
|
||||||
|
local remote_subpath="$global_remote_subpath"
|
||||||
local p
|
local p
|
||||||
local whoami="$(id -un)"
|
local whoami="$(id -un)"
|
||||||
config
|
config
|
||||||
|
|
@ -151,6 +153,11 @@ clone()
|
||||||
[ "$?" != 0 ] && exit 1
|
[ "$?" != 0 ] && exit 1
|
||||||
fi
|
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`
|
n_projects=`echo $projects | wc -w`
|
||||||
if [ "$PGIT_KEEP_GOING" != y ]; then set -e; fi
|
if [ "$PGIT_KEEP_GOING" != y ]; then set -e; fi
|
||||||
for p in $projects; do
|
for p in $projects; do
|
||||||
|
|
@ -219,12 +226,12 @@ echo "running $0 $@ GIT_SSH=$GIT_SSH" >&2
|
||||||
SSH=ssh
|
SSH=ssh
|
||||||
[ "$GIT_SSH" ] && SSH=$GIT_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
|
while [ ${1:0:1} = - ]; do
|
||||||
case $1 in
|
case $1 in
|
||||||
'--remote-base')
|
'--remote-base')
|
||||||
remote_base="$2"
|
global_remote_base="$2"
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
@ -232,10 +239,10 @@ while [ ${1:0:1} = - ]; do
|
||||||
done
|
done
|
||||||
|
|
||||||
# Only janware.com ssh git supports subdirectories below users
|
# Only janware.com ssh git supports subdirectories below users
|
||||||
if [[ "$remote_base" =~ git.janware.com ]]; then
|
if [[ "$global_remote_base" =~ git.janware.com ]]; then
|
||||||
remote_subpath="/proj"
|
global_remote_subpath="/proj"
|
||||||
else
|
else
|
||||||
remote_subpath=""
|
global_remote_subpath=""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cmd=$1
|
cmd=$1
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue