Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-12665

DiffEditor: Error in diff

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • Qt Creator 3.2.0-rc1
    • Qt Creator 3.2.0-rc1
    • Editors
    • None
    • 4c7f1c5ea98fead57034826d8fe7064c55ce992f

    Description

      Commit the following code:

      void func()
      {
          // comment1
          // comment2
      }
      
      void OtherFunc()
      {
      
      }

      Now change comment2 to comment3, and add another function below OtherFunc():

      void func()
      {
          // comment1
          // comment3
      }
      
      void OtherFunc()
      {
      
      }
      
      void Another()
      {
      }

      Open a diff editor with 3-line context. The diff is missing the opening brace of OtherFunc. This leads to an error when trying to stage this chunk.

      If there are empty (committed) lines after OtherFunc, that move Another() to a different context, the brace in the first context shouldn't appear at all, and it doesn't, but an empty line is added, and stage fails again...

      See this screenshot. Line 8 shouldn't appear (it's the 4th line in the context), but it appears (and written to patch file) as an empty context line.

      Attachments

        1. diff1.png
          diff1.png
          22 kB
        2. diff2.png
          diff2.png
          23 kB
        3. difftest.patch
          0.3 kB
        4. QTCREATORBUG-12665.patch
          2 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            jkobus Jarek Kobus
            orgads Orgad Shaneh
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes