Re: [PATCH v3 8/8] ci/style-check: add `RemoveBracesLLVM` to '.clang-format'
- From
Karthik Nayak <karthik.188@gmail.com>
- Date
- Jul 18, 2024, 08:18 UTC
- Message-ID
- <CAOLa=ZQkxOTSMih+-sKuHRdRFdrzxgiJdzXdyesM3523t65RJA@mail.gmail.com>
- In-Reply-To
- <xmqqcyne30eb.fsf@gitster.g>
Junio C Hamano <gitster@pobox.com> writes:
Show 24 quoted lines
> Karthik Nayak <karthik.188@gmail.com> 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.