Re: Is git-checkout's restoring d/f conflict really sane?
- From
Junio C Hamano <gitster@pobox.com>
- Date
- May 15, 2019, 01:56 UTC
- Message-ID
- <xmqq1s108opt.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <CACsJy8DoxHoi0H3R91ovqDPjk0tN3Rr8fQOjaLt_2P9O3n9b_g@mail.gmail.com>
Duy Nguyen <pclouds@gmail.com> writes:
> Technically 'one' is still tracked (even if it's a directory) so what > we're doing is right. I'm just not sure if there's some big surprise > factor here. And whether it's better to pause and double check with > the user before deleting everything.
I agree to all of the above, including the part "technically it is correct", but more importantly "stop and double check".
As changing between a directory and a non-directory is a rare event anyway, I do not mind making it a bit more cumbersome and say "you asked me to check out a regular file 'one', but you have a directory 'one', that has an unignored untracked file in it, so I'd refuse to do so. Come back after you removed them manually, or use the '--force' option".
We should not refuse if 'one' is an empty directory or all files in it are ignored, though.
Thanks.