gitatlassian-sourcetree

SourceTree can't show GIT diff for big text file (or treats it as binary)


I'm trying to use GIT for tracking changes to a pretty big XML file (about 3 Mb). The file is in UTF-8, and CRLF line ending (I'm working in Windows 10). But for some reason GIT keeps thinking it's binary file and does not show any diff. Or just can't detect changes.

Diff in Sourcetree shows the message "No changes in this file detected, or it is a binary file"

I tried to explicitly set attributes in .gitattributes, but it seems that it's not the reason:

 *.xml crlf diff
   git check-attr --all -- sorkin.xml
   sorkin.xml: diff: set
   sorkin.xml: crlf: set 

I found when I cut the big file into three smaller pieces (less than 1 Mb), GIT shows the changes for them correctly.

Is there some GIT's limitation on file size when calculating diff?


Solution

  • The problem was not GIT options, but SourceTree settings Tools/Options/Diff. By default it has setting for internal Diff View - Size Limit for text files of 1024Kb.

    I set it to a higher value and it resolved my problem.

    I mistakenly interpreted SourceTree error message "No changes in this file detected, or it is a binary file". But when I created a text files with length of 1048576 and 1048577 bytes and committed them, I found out, that git diff command line works, while Atlassian SourceTree ignores changes the the bigger file.

    It was important to use proper syntax for git diff: git diff commit_hash 1048577.txt instead of git diff 1048577.txt, since the last command shows diff between HEAD and current changes, and it was my second factor of misinterpreting the problem.