Eitot created this revision. Eitot added a project: clang-format. Herald added a project: All. Eitot requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits.
`git-clang-format` does not format files with spaces in their path. % git diff -p -U0 diff --git a/Test/Application/AppDelegate.m b/Test/Application/AppDelegate.m index 8bdd8b4..3effa19 100644 --- a/Test/Application/AppDelegate.m +++ b/Test/Application/AppDelegate.m @@ -17 +17,2 @@ @implementation AppDelegate -- (void)applicationDidFinishLaunching:(NSNotification *)aNotification { +- (void)applicationDidFinishLaunching:(NSNotification *)aNotification +{ diff --git a/Test/Main Window/MainWindowController.m b/Test/Main Window/MainWindowController.m index df56059..49e1a9f 100644 --- a/Test/Main Window/MainWindowController.m +++ b/Test/Main Window/MainWindowController.m @@ -16 +16,2 @@ @implementation MainWindowController -- (void)windowDidLoad { +- (void)windowDidLoad +{ % git-clang-format -v Ignoring changes in the following files (wrong extension or symlink): Test/Main Window/MainWindowController.m Running clang-format on the following files: Test/Application/AppDelegate.m old tree: 9cbacaf7a33dd4184bdc46ae93c6295cfef56030 new tree: 2a60aca2e1252612dd07032151c32536fcda6758 changed files: Test/Application/AppDelegate.m The issue is not the space itself, but the tab character appended to the path (`Test/Main Window/MainWindowController.m\t`) by `git-diff`. This has been reported before at https://bugs.llvm.org/show_bug.cgi?id=28654. Resolves https://github.com/llvm/llvm-project/issues/29028#issue-1076357057 Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D126365 Files: clang/tools/clang-format/git-clang-format Index: clang/tools/clang-format/git-clang-format =================================================================== --- clang/tools/clang-format/git-clang-format +++ clang/tools/clang-format/git-clang-format @@ -345,7 +345,7 @@ line = convert_string(line) match = re.search(r'^\+\+\+\ [^/]+/(.*)', line) if match: - filename = match.group(1).rstrip('\r\n') + filename = match.group(1).rstrip('\r\n\t') match = re.search(r'^@@ -[0-9,]+ \+(\d+)(,(\d+))?', line) if match: start_line = int(match.group(1))
Index: clang/tools/clang-format/git-clang-format =================================================================== --- clang/tools/clang-format/git-clang-format +++ clang/tools/clang-format/git-clang-format @@ -345,7 +345,7 @@ line = convert_string(line) match = re.search(r'^\+\+\+\ [^/]+/(.*)', line) if match: - filename = match.group(1).rstrip('\r\n') + filename = match.group(1).rstrip('\r\n\t') match = re.search(r'^@@ -[0-9,]+ \+(\d+)(,(\d+))?', line) if match: start_line = int(match.group(1))
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits