support old Git versions, like the one from Ubuntu-18.04

This commit is contained in:
Ștefan Talpalaru 2021-05-25 19:51:12 +02:00
parent b6ceb0fc65
commit 77747657f6
No known key found for this signature in database
GPG Key ID: CBF7934204F1B6F9
1 changed files with 2 additions and 1 deletions

View File

@ -59,7 +59,8 @@ nim_needs_rebuilding() {
fi
pushd "${NIM_DIR}" >/dev/null
git restore .
# support old Git versions, like the one from Ubuntu-18.04
git restore . 2>/dev/null || git reset --hard
if ! git checkout -q ${NIM_COMMIT}; then
# Pay the price for a non-default NIM_COMMIT here, by fetching everything.
# (This includes upstream branches and tags that might be missing from our fork.)