/tmp> sudo lsblk -o NAME,FSTYPE,MOUNTPOINT /dev/sda1 /dev/sdb1
NAME FSTYPE MOUNTPOINT
sda1 ext4 /
sdb1 exfat /mnt/sdb1
/tmp> ### I have ext4 on / and and exfat fs on /mnt/sdb1
/tmp> ### Try to clone on ext4
/tmp> cd differentFileModes/
/tmp/differentFileModes> git config --get core.filemode
true
/tmp/differentFileModes> ### git trusts this fs!
/tmp/differentFileModes> ls -l
total 12
-rw-rw-r-- 1 user user 38 Sep 22 15:07 README.md
-rwxrwxr-x 1 user user 61 Sep 22 15:07 script.sh
-rw-rw-r-- 1 user user 47 Sep 22 15:07 text.txt
/tmp/differentFileModes> echo newContent >>text.txt
/tmp/differentFileModes> git add text.txt
/tmp/differentFileModes> echo moreNewContent >>text.txt
/tmp/differentFileModes> git diff
diff --git a/text.txt b/text.txt
index 1575c9b..a33ec19 100644
--- a/text.txt
+++ b/text.txt
@@ -1,2 +1,3 @@
text file originally created on linux with 664
newContent
+moreNewContent
/tmp/differentFileModes> ### See the difference: a "git diff" is not comparing HEAD vs. worktree but HEAD vs. index.
/tmp/differentFileModes> ### Compared to HEAD we have added two lines but this diff is showing only one line
/tmp/differentFileModes> ### Now try the same on exFAT
/tmp/differentFileModes> cd /mnt/sdb1/
/mnt/sdb1> cd differentFileModes/
/mnt/sdb1/differentFileModes> git config --get core.filemode
false
/mnt/sdb1/differentFileModes> ### Native git automatically found out we cannot trust this fs and set
/mnt/sdb1/differentFileModes> ### core.filemode different than on a ext4 fs.
/mnt/sdb1/differentFileModes> ls -l
total 96
-rwxr-xr-x 1 root root 38 Sep 22 15:08 README.md
-rwxr-xr-x 1 root root 61 Sep 22 15:08 script.sh
-rwxr-xr-x 1 root root 47 Sep 22 15:08 text.txt
/mnt/sdb1/differentFileModes> ### And here you see the reason. The filemodes after a clone differ from the
/mnt/sdb1/differentFileModes> ### situation on ext4. exFAT doesn't supports filemodes fully
/mnt/sdb1/differentFileModes> echo newContent >>text.txt
/mnt/sdb1/differentFileModes> git add text.txt
/mnt/sdb1/differentFileModes> echo moreNewContent >>text.txt
/mnt/sdb1/differentFileModes> git diff
diff --git a/text.txt b/text.txt
index 1575c9b..a33ec19 100644
--- a/text.txt
+++ b/text.txt
@@ -1,2 +1,3 @@
text file originally created on linux with 664
newContent
+moreNewContent
/mnt/sdb1/differentFileModes> ### Native git doesn't complain about a change in filemode!
/mnt/sdb1/differentFileModes> ### try the same with jgit
/mnt/sdb1/differentFileModes> chmod +x /tmp/jgit.sh
/mnt/sdb1/differentFileModes> /tmp/jgit.sh diff
diff --git a/text.txt b/text.txt
old mode 100644
new mode 100755
index 1575c9b..a33ec19
--- a/text.txt
+++ b/text.txt
@@ -1,2 +1,3 @@
text file originally created on linux with 664
newContent
+moreNewContent
/mnt/sdb1/differentFileModes> ### JGit computes the right content diff (also compares index vs. worktree) but also complains
/mnt/sdb1/differentFileModes> ### about a filemode change. This should not happen if core.filemode is set to false.
/mnt/sdb1/differentFileModes> ### How does native git behaves if we tell to explicitly trust the fs
/mnt/sdb1/differentFileModes> git config core.filemode true
/mnt/sdb1/differentFileModes> git diff
diff --git a/README.md b/README.md
old mode 100644
new mode 100755
diff --git a/text.txt b/text.txt
old mode 100644
new mode 100755
index 1575c9b..a33ec19
--- a/text.txt
+++ b/text.txt
@@ -1,2 +1,3 @@
text file originally created on linux with 664
newContent
+moreNewContent
/mnt/sdb1/differentFileModes> ### Now native git also complains about mode changes ... but for some more files. That's correct.
/mnt/sdb1/differentFileModes> ### JGit behaves the same with core.filemode=true. Good.