Skip to content

Commit 0c0b5ab

Browse files
authored
[clang-format] Handle spaces in filename paths in clang-format-diff.py (llvm#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 llvm#135619.
1 parent f336c90 commit 0c0b5ab

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def main():
102102
filename = None
103103
lines_by_file = {}
104104
for line in sys.stdin:
105-
match = re.search(r"^\+\+\+\ (.*?/){%s}(\S*)" % args.p, line)
105+
match = re.search(r"^\+\+\+\ (.*?/){%s}(.+)" % args.p, line.rstrip())
106106
if match:
107107
filename = match.group(2)
108108
if filename is None:

0 commit comments

Comments
 (0)