Why "git status" displays the binary as modified when it is missing and the file modes are the same

I added some binaries to the git repository on Ubuntu 14.04 linux, dragged these files to a remote GitHub, and then pulled them into existing clones on OS X El Capitan and Windows 10. git status on OS X and Windows shows some of these files have been changed. even if they were not affected. He continues to show them as modified even after git reset --hard and git checkout .

Note. I am using git LFS (large file storage) with these files.

Here is the result from git diff on OS X, where only 1 file shows as modified:

 Marks-MacBook:KTX mark$ git diff other_lib/linux/Release-x64/libSDL2main.a diff --git a/other_lib/linux/Release-x64/libSDL2main.ab/other_lib/linux/Release-x64/libSDL2main.a index 4202f6f..2797199 100644 Binary files a/other_lib/linux/Release-x64/libSDL2main.a and b/other_lib/linux/Release-x64/libSDL2main.a differ 

and

 Marks-MacBook:KTX mark$ git diff --raw other_lib/linux/Release-x64/libSDL2main.a :100644 100644 4202f6f... 0000000... M other_lib/linux/Release-x64/libSDL2main.a 

Files are marked with -text in .gitattributes , so there should be no problems with EOL markers. What else can cause different sha1 and git diff results to report binary files?

I added diff=bin files to .gitattributes for *.a , where bin uses textconv = hexdump -v -C . After that, git diff reports the differences, but git status still shows the files as modified.

As an additional test, I copied the source .a file from linux to OS X and used diff to compare it with the copy in the git working tree. They are identical. git status in the linux repo clone thread the working tree file that I copied is not changed.

Any suggestions?

The following is no longer true; repo has been fixed as described in my answer.

You can try it yourself. The repo and branch are on GitHub at https://github.com/KhronosGroup/KTX/tree/incoming . The file displaying the problem on OS X is other_lib/linux/Release-x64/libSDL2main.a . There is no problem with any other .a files in the other_lib/linux section.

On Windows, several more files are displayed as modified, including some that are symbolic links on Linux. I want to focus on the OS X case as it is easier.

+5
source share
1 answer

I understood the problem. This was with the configuration on the Linux host. Thanks to Edward Thomson for inviting me to see git-lfs configurations.

Running git lfs init on a Linux host, deleting and re-adding binaries to the repos there, and clicking on the remote fixes the problem. To transfer the update to OS X and the Windows hosts, I had to run git reset --hard on them to reset back to the commit without intruder files.

I did not run git lfs init , believing that this step would be part of the scripts executed by apt-get install . This meant that the files were not actually stored in LFS because smudge and clean filters on the Linux host were non-ops, but the .gitattributes file forced the OS X and Windows hosts to run the LFS smudge filter on check.

+4
source

Source: https://habr.com/ru/post/1239385/


All Articles