Skip to content

Commit ec8ea76

Browse files
committed
starship-sf64-git: fix dangling commit not fetched
1 parent 842dd28 commit ec8ea76

2 files changed

Lines changed: 54 additions & 5 deletions

File tree

starship-sf64-git/.SRCINFO

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
pkgbase = starship-sf64-git
22
pkgdesc = An unofficial native port of Star Fox 64 (git)
3-
pkgver = v2.0.0.r36.g3d63f60f
3+
pkgver = v2.0.0.r74.g3d882079
44
pkgrel = 1
55
url = https://github.com/HarbourMasters/Starship
66
install = starship-sf64.install

starship-sf64-git/PKGBUILD

Lines changed: 53 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
_reponame=Starship
44
pkgname=starship-sf64-git
5-
pkgver=v2.0.0.r36.g3d63f60f
5+
pkgver=v2.0.0.r74.g3d882079
66
pkgrel=1
77
pkgdesc="An unofficial native port of Star Fox 64 (git)"
88
license=("CC0-1.0" "MIT")
@@ -47,6 +47,57 @@ _init_submodule() {
4747
git -c protocol.file.allow=always submodule update "${dir}"
4848
}
4949

50+
# -- Print helpers
51+
_msg_info() {
52+
echo "${BOLD}>> ${GREEN}$@${ALL_OFF}"
53+
}
54+
55+
_msg_warn() {
56+
echo "${BOLD}>> ${YELLOW}$@${ALL_OFF}"
57+
}
58+
59+
_walk_submodules() {
60+
absdir="$(pwd | sed "s|^${srcdir}/||")"
61+
_msg_info "Entering directory <${absdir}>"
62+
63+
local submodules="$(git ls-tree -r HEAD | awk '$2 == "commit"')"
64+
65+
if [ -z "$submodules" ]; then
66+
return
67+
fi
68+
69+
local mode type hash dir
70+
while ifs=" " read -r mode type hash dir; do
71+
local basedir="$(basename "$dir")"
72+
local submodule_url="$(git config -f .gitmodules "submodule.${dir}.url")"
73+
74+
if [ ! -e "${srcdir}/${basedir}" ]; then
75+
_msg_warn "Local repository ${basedir} (${submodule_url}) is missing. ${dir} is ignored for init!"
76+
continue
77+
fi
78+
79+
_msg_info "Initializing submodule ${dir}"
80+
81+
# Check if this specific commit exists locally within the repo
82+
(
83+
cd "${srcdir}/${basedir}"
84+
if ! git branch -a --contains "$hash" > /dev/null; then
85+
_msg_warn "Commit ${hash} of repo ${basedir} didn't get pulled from remote (${submodule_url}). Fetching now..."
86+
git fetch "$submodule_url" "$hash"
87+
fi
88+
)
89+
90+
# Initialize and update submodule
91+
git submodule init "${dir}"
92+
git config "submodule.${dir}.url" "${srcdir}/${basedir}"
93+
git -c protocol.file.allow=always submodule update "${dir}"
94+
95+
( cd "$dir"; _walk_submodules; )
96+
done <<< "$submodules"
97+
98+
_msg_info "Leaving directory <${absdir}>"
99+
}
100+
50101
pkgver() {
51102
cd "${srcdir}/${_reponame}"
52103

@@ -56,9 +107,7 @@ pkgver() {
56107

57108
prepare() {
58109
cd "${srcdir}/${_reponame}"
59-
60-
_init_submodule libultraship
61-
_init_submodule tools/Torch Torch
110+
_walk_submodules
62111

63112
patch -Np1 -i "${srcdir}/starship-stack-underflow-guard.patch"
64113
}

0 commit comments

Comments
 (0)