| Issue |
178344
|
| Summary |
[clang-format] .clang-format-ignore is hardly usable with negative patterns
|
| Labels |
clang-format
|
| Assignees |
|
| Reporter |
mikedld
|
Current implementation (clang-format 21.1.8) stops patterns processing too early. Arguably, to make this function in the least surprising way, one may expect that the last pattern matching the path (regardless of `!`) should take precedence, and then the file be ignored or not based on `!` being present or not. See examples below.
```
$ cat .clang-format-ignore
!foo.c
$ clang-format --verbose -i foo.c
Formatting [1/1] foo.c
```
```
$ cat .clang-format-ignore
!foo.h
!foo.c
$ clang-format --verbose -i foo.c
(no output, stops patterns processing on mismatch against `!foo.h`)
(expected: Formatting [1/1] foo.c)
```
```
$ cat .clang-format-ignore
**/*
!foo.*
$ clang-format --verbose -i foo.c
(no output, stops patterns processing on match against `**/*`)
(expected: Formatting [1/1] foo.c)
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs