Details
-
Bug
-
Resolution: Unresolved
-
Medium
-
None
-
1.8.3
-
OS: Windows 7
-
Severity 2 - Major
Description
Source Tree does not allow you to view the diff between a .SQL file, even though the file contents are just plain text. This problem is extended online to stash as well.
Under the hood, this is likely an issue with git / sql server management studio, but it's manifested in Source Tree and could be handled much better.
According to the following questions:
- Can SourceTree handle mixed UTF-16/Ansi file formats?
- File comparison displays the message "This file cannot be rendered in your browser" but source view works fine
This occurs because:
SQL files contain a Byte Order Mark (BOM), this is the 0xFEFF sequence you're seeing at the start of the file. Unfortunately these bytes means git treats the file as binary, not text, and so any operations that depend on git, such as generating a diff, aren't going to return what you expect.
But this is something that SourceTree is minimally doing a bad job at representing this error. Also almost any other external diff tool has no problem comparing the two files, so it's within reason that Source Tree could handle it. Also, on BitBucket Server, there's the option to Transcode Diffs.
Even a guide on how to setup diffs between sql files would certainly help a non-trivial amount of people
I attached two very simple SQL files, one created by SSMS and another from Notepad. SSMS encodes UCS-2 LE BOM, while Notepad encodes as ANSI.
Another strategy might be to setup a commit trigger or filter to remove the BOM