libmakepkg: make sure git cloned repo's remote is named origin

makepkg assumes that the remote git repo is named "origin" at several
places in its handling of git sources. It is possible to set the remote
repo name since git v2.30.0 (with bug fix for bare checkouts in v2.30.2).

Add "--origin=origin" to all git clone commands.

Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
Matthias Kurz 2022-11-04 01:56:15 +01:00 committed by Allan McRae
parent e83e53f3f9
commit 366b527757

View file

@ -48,7 +48,7 @@ download_git() {
if [[ ! -d "$dir" ]] || dir_is_empty "$dir" ; then
msg2 "$(gettext "Cloning %s %s repo...")" "${repo}" "git"
if ! git clone ${GITFLAGS:---mirror} "$url" "$dir"; then
if ! git clone --origin=origin ${GITFLAGS:---mirror} "$url" "$dir"; then
error "$(gettext "Failure while downloading %s %s repo")" "${repo}" "git"
plainerr "$(gettext "Aborting...")"
exit 1
@ -91,7 +91,7 @@ extract_git() {
exit 1
fi
cd_safe "$srcdir"
elif ! git clone -s "$dir" "${dir##*/}"; then
elif ! git clone --origin=origin -s "$dir" "${dir##*/}"; then
error "$(gettext "Failure while creating working copy of %s %s repo")" "${repo}" "git"
plainerr "$(gettext "Aborting...")"
exit 1