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

Windows Linebreaks are replaced with Unix breaks on "Discard Hunk" click

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Medium Medium
    • 3.4.20
    • 1.6.5, 3.4.19
    • Mercurial
    • Windows 7 x64
      Mercurial Distributed SCM (version 3.0+317-1ab30e9ba0fc)

    • Severity 2 - Major

      Steps to reproduce:
      1. Open mercurial repository which has file with Windows line breaks ('\r\n'). For example repository https://bitbucket.org/pypy/pypy has such file rpython\translator\c\src\stacklet\switch_x64_msvc.asm
      2. Make some change in file with Windows line breaks
      3. Open Source Tree and press "Discard Hunk"

      Actual result: Hunk is discarded but all line breaks are replaced with Unix breaks ('\n')

      Expected result: file switch_x64_msvc.asm is restored to it's original state.

        1. changed_file_1.png
          changed_file_1.png
          119 kB
        2. changed_file_2.png
          changed_file_2.png
          112 kB

            [SRCTREEWIN-2377] Windows Linebreaks are replaced with Unix breaks on "Discard Hunk" click

            This issue is fixed in the Release '3.4.20'

            Sourcetree-bot added a comment - This issue is fixed in the Release '3.4.20'

            Hi

            We are working on this issue.

            Mukesh Kumar (Inactive) added a comment - Hi We are working on this issue.

            Still there, Sourcetree 2.6.10.0, git 2.8.4, Windows 10

            Petr Sereda added a comment - Still there, Sourcetree 2.6.10.0, git 2.8.4, Windows 10

            I see this with Sourcetree 2.3.5.0 running on Windows 10. Please fix!

            Michael Ansolis added a comment - I see this with Sourcetree 2.3.5.0 running on Windows 10. Please fix!

            I most often trigger this by discarding a hunk in an unstaged, but modified file. SourceTree refreshes and this is the result. Git, Windows, global autocrlf=true.

            Andrew Sund added a comment - I most often trigger this by discarding a hunk in an unstaged, but modified file. SourceTree refreshes and this is the result. Git, Windows, global autocrlf=true.

            This doesn't happen every time for me. I just discarded two hunks. The first didn't change the line endings but the second one did. Source Tree version 2.1.2.5 on Windows 10.

            Daniel Klein added a comment - This doesn't happen every time for me. I just discarded two hunks. The first didn't change the line endings but the second one did. Source Tree version 2.1.2.5 on Windows 10.

            I have the same, git version 2.5.1, windows 7. When the hank is rejected all line endings are changed.
            It's the most important feature for me, please fix it.

            Daria Malkova added a comment - I have the same, git version 2.5.1, windows 7. When the hank is rejected all line endings are changed. It's the most important feature for me, please fix it.

            Also seeing the same thing in SourceTree with git

            After much playing around I have discovered I can discard hunks without destroying line-endings using the following on the command line

            git -c apply.ignoreWhitespace=change -c apply.whitespace=fix checkout -p

            {path-to-file}

            (hopefully that might also give a clue about how it can be resolved in SourceTree)

            Keith Deane added a comment - Also seeing the same thing in SourceTree with git After much playing around I have discovered I can discard hunks without destroying line-endings using the following on the command line git -c apply.ignoreWhitespace=change -c apply.whitespace=fix checkout -p {path-to-file} (hopefully that might also give a clue about how it can be resolved in SourceTree)

            i believe i'm seeing the same thing in git source tree.

            Shaunt Kojabashian added a comment - i believe i'm seeing the same thing in git source tree.

            similar (maybe duplicate) ticket
            https://jira.atlassian.com/browse/SRCTREEWIN-2294

            mojmir svoboda added a comment - similar (maybe duplicate) ticket https://jira.atlassian.com/browse/SRCTREEWIN-2294

              698877135425 Mukesh Kumar (Inactive)
              47868b3d11ed Sergey Kozyr
              Affected customers:
              42 This affects my team
              Watchers:
              28 Start watching this issue

                Created:
                Updated:
                Resolved: