[llvm-bugs] [Bug 28537] New: git-clang-format wrongly reports "no modified files"

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jul 13 05:50:18 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=28537

            Bug ID: 28537
           Summary: git-clang-format wrongly reports "no modified files"
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: com-clang at gladbachcity.de
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org
    Classification: Unclassified

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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160713/40f1da89/attachment.html>


More information about the llvm-bugs mailing list