From: Duy Nguyen Date: Tue, 22 Jan 2013 01:55:01 GMT Subject: Re: [PATCH v2] unpack-trees: do not abort when overwriting an existing file with the same content Message-ID: In-Reply-To: <7vwqv6c7oe.fsf@alter.siamese.dyndns.org> On Tue, Jan 22, 2013 at 8:45 AM, Junio C Hamano wrote: > Duy Nguyen writes: > >> On Tue, Jan 22, 2013 at 6:15 AM, Jeff King wrote: >>> Can you elaborate on when this code is triggered? >>> >>> In the general case, shouldn't we already know the sha1 of what's on >>> disk in the index, and be able to just compare the hashes? And if we >>> don't, because the entry is start-dirty, should we be updating it >>> (possibly earlier, so we do not even get into the "need to write" code >>> path) instead of doing this ad-hoc byte comparison? > > If the index knows what is in the working tree, I think I agree. > >>> Confused... >> >> git reset HEAD~10 >> # blah that was a mistake, undo it >> git checkout HEAD@{1} >> >> I hit it a few times, probably not with the exact recipe above though. > > I've seen myself doing "git reset HEAD~10" by mistake (I wanted "--hard"), > but the recovery is to do "git reset --hard @{1}" and then come back > with "git reset --hard HEAD~10", so it hasn't been a real problem > for me. Except when you already make some changes elsewhere and you don't want --hard. -- Duy