[clang] Fix filename parsing in clang-format-diff.py for paths with spaces (PR #135779)

Owen Pan via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 17 22:17:11 PDT 2025


================
@@ -102,9 +102,9 @@ def main():
     filename = None
     lines_by_file = {}
     for line in sys.stdin:
-        match = re.search(r"^\+\+\+\ (.*?/){%s}(\S*)" % args.p, line)
+        match = re.search(r"^\+\+\+\s+(?:.*?/){%s}(.+)$" % args.p, line)
----------------
owenca wrote:

```suggestion
        match = re.search(r"^\+\+\+\ (.*?/){%s}(.+)" % args.p, line.rstrip())
```
and restore line 107 below to make the minimum change.

https://github.com/llvm/llvm-project/pull/135779


More information about the cfe-commits mailing list