pgit.sh clone: Fetch submodule tags only from origin

To avoid network errors while fetching tags, run

  git submodule foreach --recursive 'git fetch --tags -f origin

i.e. only fetch tags from origin, which by convention points to
git.janware.com.

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2026-01-06 19:05:26 +01:00
commit 93052882de

View file

@ -1,4 +1,4 @@
###!/bin/sh #!/bin/sh
log() log()
{ {
@ -168,7 +168,7 @@ clone()
if [ "$fromuser" = "$login" ]; then if [ "$fromuser" = "$login" ]; then
if [ -d $p ]; then if [ -d $p ]; then
run_git -C $p pull --recurse-submodules=on-demand run_git -C $p pull --recurse-submodules=on-demand
run_git -C $p submodule foreach --recursive 'git fetch --tags -f' run_git -C $p submodule foreach --recursive 'git fetch --tags -f origin'
else else
run_clone $remote_base/$fromuser$remote_subpath/$p $p run_clone $remote_base/$fromuser$remote_subpath/$p $p
fi fi
@ -180,7 +180,7 @@ clone()
run_git -C $p remote set-url --push $remotename no_push run_git -C $p remote set-url --push $remotename no_push
} }
run_git -C $p fetch --prune --recurse-submodules=on-demand $remotename $fromref run_git -C $p fetch --prune --recurse-submodules=on-demand $remotename $fromref
run_git -C $p submodule foreach --recursive 'git fetch --tags -f' run_git -C $p submodule foreach --recursive 'git fetch --tags -f origin'
if [ "$toref" ]; then if [ "$toref" ]; then
run_git -C $p merge --ff-only $remotename/$fromref $toref run_git -C $p merge --ff-only $remotename/$fromref $toref
fi fi