Junio C Hamano <gitster@xxxxxxxxx> writes: > Karthik Nayak <karthik.188@xxxxxxxxx> writes: > >>> If we know we can write into /tmp/clang-format-rules file, then the >>> CI script can do something like >>> >>> { >>> cat .clang-format >>> echo echo "RemoveBracesLLVM: true" >>> } >/tmp/clang-format-rules >>> git clang-format --style=file:/tmp/clang-format-rules \ >>> --diff --extensions c,h "$baseCommit" >>> >>> right? Then "git status" would even say "there is no untracked >>> cruft" (although I do not know we *need* to keep the working tree >>> that clean, without untracked cruft). >> >> Yes this is the best solution. > > FWIW, I think an in-tree throw-away file is a better option, simply > because we _know_ that the working tree can be written (by the fact > that we can do "make" and have compilers write *.o and other cruft), > but we do not know if the CI environment allows us to write to /tmp > or /var/tmp or /usr/local/tmp and you do not want to run around and > see if there is a suitable temporary directory you can use. Sorry I got a bit busy with work. But I did end up testing out writing to a temp file and it works on both GitHub and GitLab CIs. Also I found some of the rules are too new for the clang-format in GitHub, so I removed some of them. Overall, I've sent a new version with these changes.
Attachment:
signature.asc
Description: PGP signature