git.sh: move repo copying to a new function

Signed-off-by: Leah Rowe <leah@libreboot.org>
audit2-merge1
Leah Rowe 2024-05-22 23:11:12 +01:00 committed by Leah Rowe
parent d71c4d326e
commit 2b0e71412e
1 changed files with 9 additions and 4 deletions

View File

@ -105,10 +105,7 @@ git_prep()
[ "$xbmk_release" = "y" ] && [ "$_loc" != "src/$project/$project" ] \
&& rmgit "$tmpgit"
[ "$_loc" = "${_loc%/*}" ] || x_ mkdir -p "${_loc%/*}"
mv "$tmpgit" "$_loc" || $err "git_prep: !mv $tmpgit $_loc"
[ -n "$xtree" ] && [ ! -d "src/coreboot/$xtree" ] && \
x_ ./update trees -f coreboot "$xtree"; return 0
move_repo "$_loc"
}
prep_submodules()
@ -147,3 +144,11 @@ link_crossgcc()
ln -s "../../$xtree/util/crossgcc" crossgcc || $err "$1: !xgcc link"
) || $err "$1: !xgcc link"
}
move_repo()
{
[ "$1" = "${1%/*}" ] || x_ mkdir -p "${1%/*}"
mv "$tmpgit" "$1" || $err "git_prep: !mv $tmpgit $1"
[ -n "$xtree" ] && [ ! -d "src/coreboot/$xtree" ] && \
x_ ./update trees -f coreboot "$xtree"; return 0
}