SQL files should be viewable instead of being treated as binary

Issue #5150 invalid
Dominick DeStasio
created an issue

Right now, the content of SQL files is not displayed in diffs because they are treated as binary files. It would be extremely helpful to be able to view the content of these files.

In our case, these files are often used by bamboo to update the schema of the database after the pull request is accepted. Not being able to view the contents makes it very difficult to know if the request should be improved.

Comments (13)

  1. Karl Hoaglund

    I've got the same problem. I just downloaded the SourceTree for the first time a few days ago (so it's the latest version). All my .sql files, created by SQL Server's "Script as" function, are treated as binary. I only get the "Open before" and "open after" options for them and no diff functionality.

  2. VNek

    Same problem. I see my SQL files as binary. I found a reason - bitbucket does not understand UTF-16. In UTF-8 I see content of all SQL files, in UTF-16 files are interpreted as binary.

  3. Karl Hoaglund

    To expand on what VNek said, and provide a possible (very laborious workaround): SQL Server generates T-SQL files as Unicode, which Source Tree interprets as binary. You can get around it manually by storing the script to file, opening the file with Word, then doing a Save As. When you open the file in Word it will ask you whether you want to use Unicode encoding by default. Accept the default. When you do a Save As, it will ask you what kind of encoding to use. Select "Windows default". Now your file will be regular text and Source Tree will read it properly. I'm sure there is some sort of utility that could to that transformation automatically, e.g. with a command line command. (That's while we look for Source Tree to read Unicode as text!)

  4. Jay Baldwin

    Thanks, Karl! Yeah, I'm sure that will produce the desired functionality; but it's merely a workaround. This is still considered a "bug" in my mind, though, and probably will be until it's corrected by the native product. This is really a no-brainer for any type of text-processing or comparisons of multiple types of encoding. SourceTree is a great product - I ultimately wish there was a way, like some FTP programs have, that you could specify how each type of file or encoding is handled -- perhaps file extension or encoding type, or some combination of both.

  5. Log in to comment