summaryrefslogtreecommitdiff
path: root/include/git.sh
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2024-05-22 17:59:42 +0100
committerLeah Rowe <leah@libreboot.org>2024-05-22 17:59:42 +0100
commita41633306a66aa7f718561c0c178409a6e7be029 (patch)
treeb5ae74926e752d95495f2f77e5c06a7bc47ee4b7 /include/git.sh
parentaa4faf0815b9f3ea839982540599305dd93873af (diff)
git.sh: split submodule handling to new function
Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'include/git.sh')
-rwxr-xr-xinclude/git.sh33
1 files changed, 19 insertions, 14 deletions
diff --git a/include/git.sh b/include/git.sh
index a77314d6..9809f377 100755
--- a/include/git.sh
+++ b/include/git.sh
@@ -91,20 +91,17 @@ git_prep()
git_am_patches "$tmpgit" "$_patchdir" || $err "!am $_loc $_patchdir"
if [ "$project" != "coreboot" ] || [ $# -gt 2 ]; then
- [ ! -f "$tmpgit/.gitmodules" ] || git -C "$tmpgit" submodule \
- update --init --checkout || $err "git_prep $_loc: !submod"
-
- patch_submodules
-
- if [ "$project" = "coreboot" ] && [ -n "$xtree" ] && \
- [ "$xtree" != "$tree" ]; then
- (
- cd "$tmpgit/util" || $err "prep $_loc: !cd $tmpgit/util"
- rm -Rf crossgcc || $err "prep $_loc: !rm xgcc"
- ln -s "../../$xtree/util/crossgcc" crossgcc || \
- $err "prep $_loc: can't create xgcc symlink"
- ) || $err "prep $_loc: can't create xgcc symlink"
- fi
+ prep_submodules "$_loc"
+ fi
+
+ if [ "$project" = "coreboot" ] && [ -n "$xtree" ] && \
+ [ "$xtree" != "$tree" ] && [ $# -gt 2 ]; then
+ (
+ cd "$tmpgit/util" || $err "prep $1: !cd $tmpgit/util"
+ rm -Rf crossgcc || $err "prep $1: !rm xgcc"
+ ln -s "../../$xtree/util/crossgcc" crossgcc || \
+ $err "prep $1: can't create xgcc symlink"
+ ) || $err "prep $1: can't create xgcc symlink"
fi
[ "$xbmk_release" = "y" ] && [ "$_loc" != "src/$project/$project" ] \
@@ -116,6 +113,14 @@ git_prep()
x_ ./update trees -f coreboot "$xtree"; return 0
}
+prep_submodules()
+{
+ [ ! -f "$tmpgit/.gitmodules" ] || git -C "$tmpgit" submodule \
+ update --init --checkout || $err "git_prep $1: !submod"
+
+ patch_submodules
+}
+
patch_submodules()
{
mdir="${PWD}/config/submodule/$project"