Re: [PATCH] get_oid: handle NULL repo->index
- From
Junio C Hamano <gitster@pobox.com>
- Date
- May 15, 2019, 05:16 UTC
- Message-ID
- <xmqqh89w70w8.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <20190515014622.GB13255@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 7 quoted lines
> Also from my earlier message, if you missed it: > > I also wondered if we should simply allocate an empty index whenever > we have a non-toplevel "struct repository", which might be less > surprising to other callers. I don't have a strong opinion either way. > I did grep around for other callers which might have similar problems, > but couldn't find any.
That is an approach to make it harder to make mistakes by accepting possibly a small wasted resource; but at that point, I think calling repo_read_index() unconditionally from here and similar places would be a simpler fix in the same spirit.