Web lists-archives.com

Re: [PATCH] get_oid: handle NULL repo->index




Jeff King <peff@xxxxxxxx> writes:

> 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.