pgit.sh: Don't fetch with target refspec

"git fetch $remote $fromref:$toref" fails if the $fromref is behind
$toref.

Unrolling the syntax into "git fetch" followed by
"git merge --ff-only $remote/$fromref $toref" is accepted, though, and saves
some otherwise necessary case distinction code around it.

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2025-11-29 15:35:25 +01:00
commit 016c1f4220

View file

@ -180,12 +180,7 @@ clone()
}
run_git -C $p fetch --prune --recurse-submodules=on-demand $remotename $fromref
if [ "$toref" ]; then
curref=`git -C $p branch --show-current`
if [ "$curref" = "$toref" ]; then
run_git -C $p pull --recurse-submodules=on-demand $remotename $fromref
else
run_git -C $p fetch --recurse-submodules=on-demand $remotename $fromref:$toref
fi
run_git -C $p merge --ff-only $remotename/$fromref $toref
fi
else
# set -x