Re: [PATCH 1/2] reset: handle submodule with trailing slash
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Sep 11, 2013, 17:08 UTC
- Message-ID
- <xmqqwqmnthfh.fsf@gitster.dls.corp.google.com>
- In-Reply-To
- <CACsJy8BgEM3eEDo8wOgkqYTL1fkh9azZNqbogxBubp9g5KRNbQ@mail.gmail.com>
Duy Nguyen <pclouds@gmail.com> writes:
> reset --soft does not go through these code paths (i.e. it does not > need index at all). If we fail to load index index in "reset --soft" I > think it's ok to die(). Corrupt index is fatal anyway.
Do I smell a breakage here? Isn't "reset --soft HEAD" (or some known good commit) a way to recover from a corrupt index?
If that is the case, I do not think it is OK at all. What do we suggest as an alternative? "rm .git/index && read-tree"?
Show 8 quoted lines
> But "reset > --soft" now has to pay the cost to load index, which could be slow > when the index is big. Assuming nobody does "reset --soft" that often > I think this is OK. > > Alternatively we could load index lazily in _CHEAP code only when we > see trailing slashes, then replace these read_cache() with > read_cache_unless_its_already_loaded_earlier() or something.