update-submodules: attempt to fix checkout issue, properly exit on errors

A recent run failed to update luacov, but did not fail the workflow run:

https://github.com/DFHack/dfhack/runs/3298049090?check_suite_focus=true

```
+ git checkout dfhack
error: pathspec 'dfhack' did not match any file(s) known to git
```
develop
lethosor 2021-08-11 21:36:01 -04:00
parent 46984c9d03
commit 9898d8c871
No known key found for this signature in database
GPG Key ID: 76A269552F4F58C1
2 changed files with 4 additions and 0 deletions

@ -28,4 +28,7 @@ jobs:
git config user.email "63161697+DFHack-Urist@users.noreply.github.com" git config user.email "63161697+DFHack-Urist@users.noreply.github.com"
if bash -x ci/update-submodules.bash; then if bash -x ci/update-submodules.bash; then
git push --recurse-submodules=check git push --recurse-submodules=check
elif ! git diff --exit-code HEAD; then
echo "update-submodules.bash failed to commit changes"
exit 1
fi fi

@ -21,6 +21,7 @@ write_msg ""
cat ci/update-submodules.manifest | while read path branch; do cat ci/update-submodules.manifest | while read path branch; do
cd "${git_root}/${path}" cd "${git_root}/${path}"
test "${git_root}" != "$(get_git_root)" test "${git_root}" != "$(get_git_root)"
git fetch origin "${branch}:${branch}"
git checkout "${branch}" git checkout "${branch}"
git pull --ff-only git pull --ff-only
cd "${git_root}" cd "${git_root}"