Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SVN Diff: Why are some files marked as binary

Directly related: svn diff: file marked as binary type (Per the comment on the answer)

Why would my SVN client mark some files as binary?

Specifically, .sql has prop svn:mime-type = application/octet-stream when using TortoiseSVN.

I checked Right-click > Tortoise context menu > Settings > General > Subversion configuration file, and nothing is uncommented in [miscellany] or [auto-props], so where is the decision coming from?

From what I can see in the related posts, I can "fix it" by either deleting the property on affected files, or globally change the behavior on new files via config/setting, but is there a "simple" way to do both for all affected files?

Somewhat related:

  • Persistently overriding svn's mime to binary mapping?
  • svn diff for binary file(excel file)
like image 245
drzaus Avatar asked Oct 21 '13 16:10

drzaus


People also ask

How does svn handle binary files?

If Subversion determines that the file is binary, the file receives an svn:mime-type property set to application/octet-stream. You can always override this by using the auto-props feature or by setting the property manually with svn propset . Subversion treats the following files as text: Files with no svn:mime-type.


1 Answers

Well, I found the issue in my particular case:

A developer had saved a template .sql file he was using for new scripts. This file, somehow, was saved with UCS-2 (or Unicode) encoding. Whenever he added files, TortoiseSVN determined that it was a binary file. By switching the encoding to UTF-8, the template and files derived from it are added correctly as text/plain.

Additional Info (Edit)

I found what might have been the culprit. When generating some scripts using the GUI, SQL Server Management Studio writes them as Unicode in the query window. If the file is saved, it will be saved as Unicode as well. Interestingly enough, files opened via the File>New don't save like this. An issue was raised with Microsoft about this back in 2007 (found here), that apparently hasn't been resolved.

like image 92
brazilianldsjaguar Avatar answered Sep 19 '22 12:09

brazilianldsjaguar