pgit.sh: Prepare submodules, too

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2017-04-27 13:34:50 +00:00
commit 7116403214

View file

@ -18,7 +18,12 @@ fatal()
marker() marker()
{ {
log "# ============= $@" log "# ------------- $@"
}
fat_marker()
{
log "# ========================== $@"
} }
config() config()
@ -73,15 +78,15 @@ clone()
for p in $projects; do for p in $projects; do
local pullurl=ssh://$login@git.jannet.de/srv/git/$fromuser/proj/$p local pullurl=ssh://$login@git.jannet.de/srv/git/$fromuser/proj/$p
local pushurl=ssh://$login@git.jannet.de/srv/git/$login/proj/$p local pushurl=ssh://$login@git.jannet.de/srv/git/$login/proj/$p
#marker "pulling $p from user $fromuser" fat_marker "Fetching project $p from user $fromuser"
if [ "$fromuser" = "$login" ]; then if [ "$fromuser" = "$login" ]; then
if [ -d $p ]; then if [ -d $p ]; then
run_git -C $p pull run_git -C $p pull
else else
run_git clone ssh://$login@git.jannet.de/srv/git/$fromuser/proj/$p run_git clone ssh://$login@git.jannet.de/srv/git/$fromuser/proj/$p
run_git -C $p submodule init || fatal git submodule init failed in `pwd`
run_git -C $p submodule update || fatal git submodule update failed in `pwd`
fi fi
run_git -C $p submodule init || fatal git submodule init failed in $p
run_git -C $p submodule update || fatal git submodule update failed in $p
else else
local remotename="user-$fromuser" local remotename="user-$fromuser"
if [ -d $p ]; then if [ -d $p ]; then
@ -93,7 +98,7 @@ clone()
else else
set -x set -x
run_git clone ssh://$login@git.jannet.de/srv/git/$fromuser/proj/$p run_git clone ssh://$login@git.jannet.de/srv/git/$fromuser/proj/$p
run_git -C $p remote rename origin $remotename || fatal failed to rename remote in `pwd` 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 run_git -C $p remote set-url --push $remotename no_push
$git_srv_admin -u $login -j create-personal-project $p $git_srv_admin -u $login -j create-personal-project $p
run_git -C $p remote add origin $pushurl run_git -C $p remote add origin $pushurl
@ -101,8 +106,8 @@ clone()
run_git -C $p branch --set-upstream-to origin/master master run_git -C $p branch --set-upstream-to origin/master master
set +x set +x
fi fi
run_git -C $p submodule init || fatal git submodule init failed in `pwd` run_git -C $p submodule init || fatal git submodule init failed in $p
run_git -C $p submodule update || fatal git submodule update failed in `pwd` run_git -C $p submodule update || fatal git submodule update failed in $p
fi fi
done done
)} )}