Author: Selim Keles
Date: 2025-04-18T19:42:22-07:00
New Revision: 0c0b5abff7ebedde53ccb84a04dadb00b9b91f2b

URL: 
https://github.com/llvm/llvm-project/commit/0c0b5abff7ebedde53ccb84a04dadb00b9b91f2b
DIFF: 
https://github.com/llvm/llvm-project/commit/0c0b5abff7ebedde53ccb84a04dadb00b9b91f2b.diff

LOG: [clang-format] Handle spaces in filename paths in clang-format-diff.py 
(#135779)

This PR resolves an issue in clang-format-diff.py where
filenames containing spaces were not correctly extracted from Git diffs.
Due to the previous regex implementation, filenames were being
truncated, causing the script to fail when processing diffs with such
filenames.

Fixes #135619.

Added: 
    

Modified: 
    clang/tools/clang-format/clang-format-diff.py

Removed: 
    


################################################################################
diff  --git a/clang/tools/clang-format/clang-format-
diff .py b/clang/tools/clang-format/clang-format-
diff .py
index c82b41e8bd031..3059982ba231f 100755
--- a/clang/tools/clang-format/clang-format-
diff .py
+++ b/clang/tools/clang-format/clang-format-
diff .py
@@ -102,7 +102,7 @@ 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}(.+)" % args.p, line.rstrip())
         if match:
             filename = match.group(2)
         if filename is None:


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to