Re: [RFC] Define "precious" attribute and support it in `git clean`
From: Sebastian Thiel <hidden>
Date: 2023-10-16 06:11:53
Thanks a lot, that makes perfect sense! Thanks to Elijah we may also have discovered why the idea of precious files didn't get implemented last time it came up: it's too much work to make all portions of the code aware. I don't know if this time will be different as I can only offer to implement the syntax adjustment, whatever that might be (possibly after validating the candidate against a corpus of repositories), along with the update to `git clean` so it leaves precious files alone by default and a new flag to also remove precious files. Maybe that already is something worth having, but I can also imagine that ideally there is a plan for retrofitting other portions of git as well along with the resources to actually do it. On 15 Oct 2023, at 18:31, Junio C Hamano wrote:
Sebastian Thiel [off-list ref] writes:quoted
A particularly interesting question brought up here also was the question of what's more important: untracked files, or precious files? Are they effectively treated the same, or is there a difference?Think of it this way. There are two orthogonal axes. (1) Are you a candidate to be tracked, even though you are not tracked right now? (2) Should you be kept and make an operation fail that wants to remove you to make room? For untracked files, both are "Yes". As we already saw in the long discussion, precious files are "not to be added and not to be clobbered", so you'd answer "No" and "Yes" [*]. In other words, both are equally protected from getting cloberred. Side note: for completeness, for ignored files, the answers are "No", and "No". The introduction of "precious" class makes a combination "No-Yes" that hasn't been possible so far. Elijah, thanks for doing a very good job of creating a catalog of kludges we accumulated over the years for the lack of proper support for the precious paths. I think they should be kept for backward compatibility, but for new users they should not have to learn any of them once we have the support for precious paths.