diff options
author | Leah Rowe <leah@libreboot.org> | 2024-06-20 00:57:10 +0100 |
---|---|---|
committer | Leah Rowe <leah@libreboot.org> | 2024-06-20 00:57:10 +0100 |
commit | 4ab99d546e4b67e0394a2bb34c004c46d16ff893 (patch) | |
tree | 9d3fe3a2718802b8562e6f4f543101a109e5ba75 /include/git.sh | |
parent | cd1d847898078add88fd17542703806f1c30b522 (diff) |
git.sh: general code cleanup in fetch_submodule()
Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'include/git.sh')
-rwxr-xr-x | include/git.sh | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/include/git.sh b/include/git.sh index a4543e99..2f9359c9 100755 --- a/include/git.sh +++ b/include/git.sh @@ -115,22 +115,19 @@ prep_submodules() fetch_submodule() { mcfgdir="$mdir/${1##*/}" - eval "$(setvars "" subhash subrepo subrepo_bkup subfile subfile_bkup)" + eval $(setvars "" subhash subrepo subrepo_bkup subfile subfile_bkup st) [ ! -f "$mcfgdir/module.cfg" ] || . "$mcfgdir/module.cfg" || \ $err "! . $mcfgdir/module.cfg" - st="" - for _st in repo file; do - eval "[ -n \"\$sub$_st\$sub${_st}_bkup\" ] && st=\"\$st \$_st\"" + for xt in repo file; do + eval "[ -n \"\$sub$xt\$sub${xt}_bkup\" ] && st=\"\$st \$xt\"" done - st="${st# }" - [ "$st" = "repo file" ] && $err "$mdir: repo/file both defined" + st="${st# }" && [ "$st" = "repo file" ] && $err "$mdir: repo+file" [ -z "$st" ] && return 0 # subrepo/subfile not defined - chkvars "sub${st}" "sub${st}_bkup" "subhash" - [ "$st" != "repo" ] && download "$subfile" "$subfile_bkup" \ + [ "$st" = "file" ] && download "$subfile" "$subfile_bkup" \ "$tmpgit/$1" "$subhash" && return 0 rm -Rf "$tmpgit/$1" || $err "!rm '$mdir' '$1'" tmpclone "$subrepo" "$subrepo_bkup" "$tmpgit/$1" "$subhash" \ |