Re: [RFC PATCH] Introduce "precious" file concept
flat view
From: Duy Nguyen <hidden>
Date: 2018-11-11 15:41:49
On Sun, Nov 11, 2018 at 1:33 PM Ævar Arnfjörð Bjarmason [off-list ref] wrote:
The users who need protection against git deleting their files the most
are exactly the sort of users who aren't expert-level enough to
understand the nuances of how the semantics of .gitignore and "precious"
are going to interact before git eats their data.
This is pretty apparent from the bug reports we're getting about
this. None of them are:
"Hey, I 100% understood .gitignore semantics including this one part
of the docs where you say you'll do this, but just forgot one day
and deleted my work. Can we get some more safety?"
But rather (with some hyperbole for effect):
"ZOMG git deleted my file! Is this a bug??"
So I think we should have the inverse of this "precious"
attribute". Just a change to the docs to say that .gitignore doesn't
imply these eager deletion semantics on tree unpacking anymore, and if
users want it back they can define a "garbage" attribute
(s/precious/garbage/).
That will lose no data, and in the very rare cases where a checkout of
tracked files would overwrite an ignored pattern, we can just error out
(as we do with the "Ok to overwrite" branch removed) and tell the user
to delete the files to proceed.There's also the other side of the coin. If this refuse to overwrite triggers too often, it can become an annoyance. So far I've seen two reports of accident overwriting which make me think turning precious to trashable may be too extreme. Plus ignored files are trashable by default (or at least by design so far), adding trashable attribute changes how we handle ignored files quite significantly. -- Duy