summaryrefslogtreecommitdiff
path: root/include/git.sh
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2024-06-14 13:36:31 +0100
committerLeah Rowe <leah@libreboot.org>2024-06-14 13:37:03 +0100
commit167e1a0fbe6765aaa5f5d3dc682709aa3c31260b (patch)
tree8dde0d22155b438140e3d2e22be8fb4197abe351 /include/git.sh
parent98724d701b10a037e8ffa7ce2864a08993268517 (diff)
unified checks for variable initialisation
new function chkvars() does the job Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'include/git.sh')
-rwxr-xr-xinclude/git.sh9
1 files changed, 3 insertions, 6 deletions
diff --git a/include/git.sh b/include/git.sh
index 46b63014..c1e7b4ba 100755
--- a/include/git.sh
+++ b/include/git.sh
@@ -52,8 +52,7 @@ fetch_project_repo()
eval "$(setvars "" xtree tree_depend)"
scan_config "$project" "config/git"
- [ -z "${loc+x}" ] && $err "fetch_project_repo $project: loc not set"
- [ -z "${url+x}" ] && $err "fetch_project_repo $project: url not set"
+ chkvars loc url
[ -n "$xtree" ] && [ ! -d "src/coreboot/$xtree" ] && \
x_ ./update trees -f coreboot "$xtree"
@@ -87,7 +86,7 @@ git_prep()
_patchdir="$3" # $1 and $2 are gitrepo and gitrepo_backup
_loc="$4"
- [ -z "${rev+x}" ] && $err "git_prep $_loc: rev not set"
+ chkvars rev
tmpclone "$1" "$2" "$tmpgit" "$rev" "$_patchdir"
if singletree "$project" || [ $# -gt 4 ]; then
@@ -130,9 +129,7 @@ fetch_submodule()
[ -z "$st" ] && return 0 # subrepo/subfile not defined
- for mvar in "sub${st}" "sub${st}_bkup" "subhash"; do
- eval "[ -n \"\$$mvar\" ] || $err \"$1, $mdir: $mvar unset\""
- done
+ chkvars "sub${st}" "sub${st}_bkup" "subhash"
if [ "$st" = "repo" ]; then
rm -Rf "$tmpgit/$1" || $err "!rm '$mdir' '$1'"