Re: [RFC] Define "precious" attribute and support it in `git clean`
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Oct 14, 2023, 16:10 UTC
- Message-ID
- <xmqq5y39xjzx.fsf@gitster.g>
- In-Reply-To
- <0deee2bc-1775-4459-906d-1d44b3103499@gmail.com>
Phillip Wood <phillip.wood123@gmail.com> writes:
Show 16 quoted lines
> One thought I had was that we could abuse the comment syntax to > annotate paths something like > > #(keep) > /my-precious-file > > would prevent /my-precious-file from being deleted by git clean (and > hopefully unpack-trees()[1]). It means that older versions of git > would treat the file as ignored. If we ever want more than one > annotation per path we could separate them with commas > > #(keep,something-else) > /my-file > > Strictly speaking it is a backward incompatible change but I doubt > there are many people using comments like that.
;-)
If "#(" feels a bit too generic, that part can be bikeshed.I might find some example use cases why we shouldn't later, but offhand, the idea of (ab)using the comment is a very good idea.