git.sh: simplify submodule handling

do not use a subshell. use git -C instead.

Signed-off-by: Leah Rowe <leah@libreboot.org>
9020vga
Leah Rowe 2023-12-19 03:53:47 +00:00
parent 124b5bebd6
commit 7f98ab8e62
1 changed files with 3 additions and 8 deletions

View File

@ -65,14 +65,9 @@ prepare_new_tree()
cp -R "src/${project}/${project}" "${tmp_git_dir}" || \
err "prepare_new_tree ${project}/${tree}: can't make tmpclone"
git_reset_rev "${tmp_git_dir}" "${rev}"
(
cd "${tmp_git_dir}" || \
err "prepare_new_tree ${project}/${tree}: can't cd tmpclone"
if [ -f ".gitmodules" ]; then
git submodule update --init --checkout || \
err "prepare_new_tree ${project}/${tree}: !submodules"
fi
) || err "git submodule update failure"
[ ! -f "${tmp_git_dir}/.gitmodules" ] || \
git -C "${tmp_git_dir}" submodule update --init --checkout \
|| err "prepare_new_tree ${project}/${tree}: !submodules"
git_am_patches "${tmp_git_dir}" "$PWD/$cfgsdir/$tree/patches" || \
err "prepare_new_tree ${project}/${tree}: patch fail"
[ "${patchfail}" = "y" ] && err "PATCH FAIL"