I use git in some automated tests as an easy way to have a "diff" command available with same syntax on both Linux and Windows. It's working ok, but since the files I'm comparing are on a shared drive I've been stumbling about differences in filemode being (unwantedly) reported as changes. I looked around and found the core.filemode
setting being recommended in this case - but in my experiments, the setting does not seem to be used when outside of a working directory.
This is my diff command for the test:
git diff --ignore-space-at-eol --no-index createdFile expectedFile
Output:
diff --git a/createdFile b/expectedFile
old mode 100644
new mode 100755
(and I want to ignore differences in just the file mode).
What I've tried:
git -c core.filemode=false diff --ignore-space-at-eol --no-index createdFile expectedFile
As suggested e.g. in this answer. The output is however still the same as above (git version: 2.25.1 - maybe this filemode actually doesn't work there as somehow hinted in here?)
Setting core.filemode
globally also doesn't work.
My current workaround is to copy the "expected" files to a location within the linux filesystem with default permissions. Would be great if this could be avoided though...