utils: use git diff instead of git diff-index for checking changes
On some machines, notably in a CI environment where containers pass build results between each other using shared volumes, we sometimes observe:
ERROR: Local changes detected in:
If we run git status
in , we can see that there are no
modified files, which is confusing.
git diff-index is a low level operation and states:
You can choose whether you want to trust the index file entirely (using the --cached flag) or ask the diff logic to show any files that don’t match the stat state as being "tentatively changed". Both of these operations are very useful indeed.
Since we don't want any false positives, use git diff
instead.
git diff
is a little slower, but it won't give us false positives.
Link: https://stackoverflow.com/a/50471368 Link: https://public-inbox.org/git/loom.20160331T143733-916@post.gmane.org/ Link: https://git-scm.com/docs/git-update-index#_using_assume_unchanged_bit Signed-off-by: Mattijs Korpershoek mkorpershoek@baylibre.com