diff options
author | Leah Rowe <leah@libreboot.org> | 2024-06-07 14:40:59 +0100 |
---|---|---|
committer | Leah Rowe <leah@libreboot.org> | 2024-06-07 14:40:59 +0100 |
commit | 3eef7f37f293e804560e1a7f3a76a46e707f4775 (patch) | |
tree | 812fe98108d5de24a06ef45158b13f03a2067874 /include | |
parent | 4b1b1f5098d9be3b14a2e1e4c01315ee756ce40b (diff) |
git.sh: simplify submodule handling
there were stragglers remaining, from when we used to
actually run "git submodule update", but this was removed.
clean up the submodule functions and merge them together.
Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'include')
-rwxr-xr-x | include/git.sh | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/include/git.sh b/include/git.sh index 4d2e9c07..c723fec0 100755 --- a/include/git.sh +++ b/include/git.sh @@ -117,7 +117,6 @@ prep_submodules() while read -r msrcdir; do fetch_submodule "$msrcdir" - patch_submodule "$msrcdir" done < "$tmpdir/modules" } @@ -129,22 +128,16 @@ fetch_submodule() [ ! -f "$mcfgdir/module.cfg" ] || . "$mcfgdir/module.cfg" || \ $err "! . $mcfgdir/module.cfg" - [ -n "$subrepo" ] || [ -n "$subrepo_bkup" ] || return 0 - [ -n "$subrev" ] || $err "$1, $mdir: subrev not defined" + [ -z "$subrepo" ] && [ -z "$subrepo_bkup" ] && return 0 - rm -Rf "$tmpgit/$1" || $err "!rm '$mdir' '$1'" - for mod in "$subrepo" "$subrepo_bkup"; do - [ -z "$mod" ] && continue - git clone "$mod" "$tmpgit/$1" || rm -Rf "$tmpgit/$1" \ - || $err "!rm $mod $project $cfgdir $1" - [ -d "$tmpgit/$1" ] && break + for mvar in subrepo subrepo_bkup subrev; do + eval "[ -n \"\$$mvar\" ] || $err \"$1, $mdir: $mvar unset\"" done - [ -d "$tmpgit/$1" ] || $err "!clone $mod $project $mcfgdir $1" -} -patch_submodule() -{ - [ -z "$subrev" ] || git -C "$tmpgit/$1" reset --hard "$subrev" || \ + rm -Rf "$tmpgit/$1" || $err "!rm '$mdir' '$1'" + git clone $subrepo "$tmpgit/$1" || git clone $subrepo_bkup \ + "$tmpgit/$1" || $err "clone_project: could not download $project" + git -C "$tmpgit/$1" reset --hard "$subrev" || \ $err "$mdir $1: cannot reset git revision" git_am_patches "$tmpgit/$1" "$mdir/${1##*/}/patches" |