hooks_clang_format fails on multiple files
Categories
(Developer Infrastructure :: Lint and Formatting, defect)
Tracking
(firefox68 fixed)
Tracking | Status | |
---|---|---|
firefox68 | --- | fixed |
People
(Reporter: janerik, Assigned: Sylvestre)
References
(Regression)
Details
(Keywords: regression)
Attachments
(1 file)
(deleted),
text/x-phabricator-request
|
Details |
I recently added hooks_clang_format.py to run as the pre-commit hook on my git checkout of m-c.
However, it seems to have problems when multiple files are stages for the commit:
I get this output:
fatal: pathspec 'browser/base/content/test/about/browser_aboutCertError_telemetry.js browser/base/content/test/siteIdentity/browser_identityPopup_clearSiteData.js [...many more files]' did not match any files
I suspect it is because the files are concatenated into a single space-separated string and then passed to git as one argument.
git expects each file as its own argument though. Guess we should change add_remove_files
to take a list instead?
Assignee | ||
Comment 1•6 years ago
|
||
Interesting. Thanks for reporting that.
Btw, I should probably filter out js files in the hook itself.
Reporter | ||
Comment 2•6 years ago
|
||
ah yes, guess clang-format wouldn't need to touch these ever, so making it do less work is a sensible thing to do.
Assignee | ||
Comment 4•6 years ago
|
||
For now, I am fixing the core issue. I will create a follow up to only format supported files.
To test my change:
sed -i -e "s|#include |#include |g" dom/presentation/AvailabilityCollection.cpp
sed -i -e "s|#include |#include |g" dom/presentation/Presentation.cpp
git add dom/presentation/AvailabilityCollection.cpp dom/presentation/Presentation.cpp
git commit -m "foo"
Assignee | ||
Comment 5•6 years ago
|
||
Assignee | ||
Updated•6 years ago
|
Updated•6 years ago
|
Comment 8•6 years ago
|
||
bugherder |
Updated•6 years ago
|
Updated•5 years ago
|
Updated•3 years ago
|
Updated•2 years ago
|
Description
•