./mach clang-format Requires -p option. Using -c <changeset> -s doesn't print diffs
Categories
(Developer Infrastructure :: Lint and Formatting, defect, P3)
Tracking
(Not tracked)
People
(Reporter: haik, Unassigned)
References
Details
./mach clang-format -s
doesn't print any formatting fixes for the changed files in the working dir parent changeset. Using the -c <changeset>
option also doesn't seem to work. Using the -p
option to specify the changed file does work. See example below where the working dir parent changeset changed dom/ipc/ContentParent.cpp. In Mercurial this is the '.' changeset which can be referred to with -c .
.
$ hg parent -v|grep files
files: dom/ipc/ContentChild.cpp dom/ipc/ContentParent.cpp xpcom/base/nsMacUtilsImpl.cpp xpcom/base/nsMacUtilsImpl.h
$ ./mach clang-format -c . -s
Wed Apr 17 14:25:28 PDT 2019
$ ./mach clang-format -s -p dom/ipc/ContentParent.cpp
Processing 1 file(s)...
--- /Users/haftandilian/r/mc/dom/ipc/ContentParent.cpp 2019-04-17 13:40:01.000000000 -0700
+++ /Users/haftandilian/r/mc/dom/ipc/ContentParent.cpp 2019-04-17 14:25:41.000000000 -0700
@@ -5718,7 +5718,7 @@
}
Unused << entry->GetKey()->SendAttachBrowsingContext(
- child->GetIPCInitializer());
+ child->GetIPCInitializer());
}
return IPC_OK();
Wed Apr 17 14:25:41 PDT 2019
Reporter | ||
Comment 1•6 years ago
|
||
Workaround:
$ for f in `hg log -r . --template "{files % '{file}\n'}"` ; do echo clang-format -p ${f} ; ./mach clang-format -c . -p ${f} ; done
Comment 2•6 years ago
|
||
Emilio, as you implemented the -c option, is that something you could help with? Thanks
Comment 3•6 years ago
|
||
It's working for me on git. Unfortunately I don't have the time to dig why it's not working on mercurial right now :(
Updated•5 years ago
|
Comment 4•3 years ago
|
||
./mach clang-format
was formatting the files in the most recent mercurial changeset for me until recently (as if it defaulted to -c .
), but no longer.
Updated•2 years ago
|
Updated•2 years ago
|
Updated•1 years ago
|
Comment 5•1 years ago
|
||
./mach clang-format
, with or without --commit .
is not consistent about whether it formats files changed in the parent changeset and I don't know what the pattern is.
./mach lint --rev . --linter clang-format --warnings
at least notices files changed in the parent changeset in a case where ./mach clang-format
did not.
Or ./mach clang-format --show --path
hg log -r . --template "{files % '{file}\n'}"` also behaves as expected.
Updated•1 years ago
|
Description
•