Subject: Re: [PATCH v2 1/2] CI: limit GitHub Actions to designated branches

From: Junio C Hamano <[email-masked]>
Date: Wed, 06 May 2020 09:31:25 -0700

Đoàn Trần Công Danh  <[email-masked]> writes:

> On 2020-05-05 20:56:58-0700, Junio C Hamano <[email-masked]> wrote:
>> Đoàn Trần Công Danh  <[email-masked]> writes:
>> > +--------------
>> > +$ git checkout --orphan ci-config
>> > +$ cp contrib/ci-config-allow-ref allow-ref
>> > +$ $EDITOR allow-ref
>> > +$ git rm -rf .
>> 
>> This sounds horrible.  You just nuked the entire files in the
>> working tree you use for your everyday Git hacking to edit a
>> single file.
>
> It isn't that horrible as it sounds. It only removes the files that are
> currently added in index, which is the same with tracked files in old
> branch, and we can get it back by switching back to old branch.
>
> I decided to make an orphanage branch because I would like to save
> time and network bandwidth for the "check-ci" jobs.

I didn't say it is wrong to record a tree with a single file
(allow-ref) in a commit that is pointed by the ci-config ref.

I would have expected you to create such a commit in an otherwise
empty repository, and push into your fork of Git at GitHub.  That
way, you won't have to checkout and/or refresh the index all of the
3800+ files.

> I wonder whether the "git rm -rf ." makes that block sounds horrible?
> If that is the case, we can use the experimental git-switch(1)
> instead, it's doing more-or-less the same (or is it the same?) with
> "git checkout --orphan" and "git rm -rf ."

That does not change anything, as abuse of your primary repository
is what offends me.