Uploaded image for project: 'Sourcetree for Windows'
  1. Sourcetree for Windows
  2. SRCTREEWIN-5485

SourceTree diff treats .sql files as binary

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Medium
    • None
    • 1.8.3
    • Git
    • 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:

      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

      Attachments

        1. FromTEXT.sql
          0.0 kB
        2. FromSQL.sql
          0.0 kB

        Activity

          People

            Unassigned Unassigned
            ae48a9181771 Kyle Mitofsky
            Votes:
            27 Vote for this issue
            Watchers:
            21 Start watching this issue

            Dates

              Created:
              Updated: