<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - git-clang-format wrongly reports "no modified files""
   href="https://llvm.org/bugs/show_bug.cgi?id=28537">28537</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>git-clang-format wrongly reports "no modified files"
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Formatter
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>com-clang@gladbachcity.de
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>djasper@google.com, klimek@google.com, llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>git-clang-format incorrectly outputs 'no modified files to format' although
files have been changed.

I have 1 single file and I deleted a single line; no other changes were made to
the whole repository. Hence, my unified diff looks like this:

@@ -45 +44,0 @@ if (x) {
-  bar();

Now, the regex in the function "extract_lines" matches the "0" in the ranges
above and returns this as the number of changed lines.

This causes git-clang-format to always output 'no modified files to format' and
return.

I personally use a pre-commit hook that writes the output of git-clang-format
to a file and checks whether this file is empty; if so, it accepts the patch.

This bug hence makes it impossible to delete a single line since in this case,
some output is always generated.

I believe this issue could be resolved by checking for this special case or by
suppressing the error message if "-q" is given.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>