utils: always run git status before git diff
When using utils.sh in a distributed build environment, it's possible that the build output and sources are passed over between containers. Especially, between the build and the commit steps.
In that case, we have observed the following error:
selected worker: concourse-worker-85cc8c47d6-b5xkx fatal: mmap failed: Cannot allocate memory ERROR: Local changes detected in: common
This happens because git diff --quiet does not check the file's mtime change as described in 1.
Calling git status to refresh the index should fix this:
root@10789b38-c293-4a0b-5de0-8378cdea2847:/tmp/build/1456dd24/baylibre-ti-kernel-repo/common# git diff --quiet HEAD fatal: mmap failed: Cannot allocate memory root@10789b38-c293-4a0b-5de0-8378cdea2847:/tmp/build/1456dd24/baylibre-ti-kernel-repo/common# git status Refresh index: 100% (71573/71573), done. Not currently on any branch. nothing to commit, working tree clean