18
votes

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:

2
Jeez, and removing the mime-type property (assuming it's defaulting to text/plain) shows a bunch of NUL character garbage every other character. Is my scenario just not applicable? The TortoiseMerge viewer compares it fine...drzaus
I've got the same exact problem ... .sql files keep getting uploaded as application/octet-stream when they're clearly text/plain, with no auto-props set. Too bad no one has supplied an answer :(brazilianldsjaguar

2 Answers

18
votes

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.

7
votes

Here's a quick way to fix this problem:

notepad %APPDATA%\Subversion\config

Scroll down to and uncomment this line:

enable-auto-props = yes

Under [auto-props] add this line:

*.sql = svn:mime-type=text/plain

Now when you add .SQL files to SVN, they will automatically be marked as text (not octet-stream).

EDIT: Removed unnecessary line ending file alteration.