Subject: Re: What's cooking in git.git (Apr 2019, #01; Thu, 4)

From: Ævar Arnfjörð Bjarmason <[email-masked]>
Date: Sat, 06 Apr 2019 22:28:48 +0200

On Thu, Apr 04 2019, Junio C Hamano wrote:

> Duy Nguyen <[email-masked]> writes:
>
>> On Thu, Apr 4, 2019 at 5:29 PM Junio C Hamano <[email-masked]> wrote:
>>> * nd/precious (2019-04-01) 1 commit
>>>  - Introduce "precious" file concept
>>>
>>>  "git clean" learned to pay attention to the 'precious' attributes
>>>  and keep untracked paths with the attribute instead of removing.
>>>
>>>  Will merge to 'next'.
>>
>> There was no conclusion from the last thread if I remember correctly
>> and I kind of gave up on it. If you want to include anyway, should we
>> go for a more specific attribute (e.g. "clean") and leave "precious"
>> for later whenever it's better defined?
>
> I'd rather pick between (1) using the final name for the concept we
> want to eventually achieve, i.e. "precious", and starting small,
> i.e. "initially, only git-clean knows about it", or (2) doing
> nothing.  Per-command 'precious-this', 'precious-that' that would be
> left as interface wart for years is not a pretty sight I want to
> see.

I think we shouldn't squat "precious" in general without seeing where we
want to go with it, which I tried to sum up in
https://public-inbox.org/git/[email-masked]/

But aside from that larger discussion, I see no problem with having some
"+clean" or "-clean" attribute with basically Duy's current patch in
nd/precious with the equivalent of "s/precious/clean/". Duy suggested
this in
https://public-inbox.org/git/[email-masked]/

I see the desire to keep some untracked stuff you know about as
different from what amounts to a workaround for merge/checkout
inadvertently stomping on your checkout and shredding your data, without
(as noted in my upthread summary) us having the full picture of whether
that's even needed as a permanent configurable workaround, or we could
"just" fix that "bug".

But on the subject on the implementation of nd/precious (assuming
s/precious/clean/) I'm concerned that this "I want to keep *.o on
'git-clean'" use-case leaves us with no way to do what you can now do
with:

    git clean -dxff

Now the git-clean documentation promises:

    "Cleans [...] files that are not under version control"

And, for -x:

    "Don’t use the [repository's] ignore rules[...]This allows removing
    all untracked files, including build products"

Except now we have a feature that's ostensibly exactly for this "build
products" use-case, but doesn't yield to the -x option, which we've
documented as being the escape hatch for exactly that sort of thing.

In my mind "clean" has two fundamentally different use-cases. a) I made
this repo and trust its .gitignore file b) I didn't make it/don't trust
it and/or I just want to be guaranteed to get the exact same checkout a
"git clone" would give me.

Now you can do "git clean -dxff" (and if submodules init && ...) for
"b", but the "precious" patch in the current form completely breaks "b"
to satisfy a use-case of "a".

I think we should at the very least have a "-xx" like "-ff" now as an
escape hatch, but more conservatively shouldn't be breaking the
reasonable assumption a user of "-x" could make so far, which is "ignore
repo config, just wipe it all".