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

Difftool : options to ignore all whitespace (and secondary case)

    XMLWordPrintable

    Details

    • Platform/s:
      All

      Description

      Compared to some other diff tools, Qt Creator lacks the ability to ignore all whitespace and case.

      About whitespace, it is already able to detect indentation, but not line break :
       

          int a 
                = 0;    
      //Will be considered different than
      int a = 0;
      

      This could be improved (but not completely fixed) by changing this file, line 367 to:

          if (ignoreWhitespace()) {
              realArgs << "--ignore-space-change"
                       << "--ignore-space-at-eol"
                       << "-b"
                       << "-w"
                       << "--ignore-blank-lines"
                       << "--word-diff-regex=[^[:space:]]";
          }
      

      A way to fix it completely would be to apply clang format to both files before comparing them. This way, all the formatting changes would completely disappear.

      Another way, only using Git, might be to use this command, allowing to commit while ignoring whitespace (explanation here)

      git diff -w --no-color | git apply --cached --ignore-whitespace && git checkout -- . && git reset && git add -p
      

        

      Furthermore, it also lacks the ability to ignore case. This is secondary and way less helpful than ignoring whitespace, but still useful in some very particular situations.

          
      int A = 0;
      //Will be considered different than
      int a = 0;
      

       

      In my opinion, Qt Creator diff is already great, and these options would make it even better.

        Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            orgads Orgad Shaneh
            Reporter:
            g_ka Tom Dupont
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes