Thread (30 messages) 30 messages, 8 authors, 2018-12-06

Re: [RFC PATCH] Introduce "precious" file concept

flat view

From: Matthieu Moy <hidden>
Date: 2018-11-12 09:55:05

"Per Lundberg" [off-list ref] wrote:
On 11/11/18 5:41 PM, Duy Nguyen wrote:
quoted
On Sun, Nov 11, 2018 at 1:33 PM Ævar Arnfjörð Bjarmason
[off-list ref] wrote:
quoted
quoted
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.
I may have missed some cases, but to me the cases when checkout may try
to overwrite an ignored file are essentially:

* Someone "git add"ed a file meant to be ignored by mistake (e.g.
  "git add -f *.o").

* A file that was meant to be kept private (e.g. config.mak.dev) ends
  up being tracked. This may happen when we find a way to make per-developer
  settings the same for everyone.

I both cases I'd want at least to be notified that something is going on,
and in the second I'd probably want to keep my local file around.
If we feel thrashable is stretching it too far (which I don't think it
is), we could add a "core.ignore_files_are_trashable" setting that
brings back the old semantics, for those who have a strong feeling about it.
May I remind an idea I sugested in an old thread: add an intermediate level
where ignored files to be overwritten are renamed (eg. foo -> foo~ like Emacs'
backup files):

https://public-inbox.org/git/vpqd3t9656k.fsf@bauges.imag.fr/

One advantage of the "rename" behavior is that it's safer that the current,
but still not very disturbing for people who like the current behavior. This
makes it a good candidate for a default behavior.

This could come in complement with this thread's "precious" concept:

* If you know what you're doing and know that such or such file is precious,
  mark it as such and Git will never overwrite it.

* If you don't know about precious files, just keep the default setting and
  the worse that can happen is to get your file overwritten with a bakup
  of the old version kept around.

This would probably play better with a notion of "precious" files than with
a notion of "trashable" files.

-- 
Matthieu Moy
https://matthieu-moy.fr/
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help