Web lists-archives.com

Re: [PATCH 1/3] repo_read_index: don't discard the index




On Tue, Jul 11, 2017 at 3:04 PM, Brandon Williams <bmwill@xxxxxxxxxx> wrote:
> Have 'repo_read_index()' behave more like the other read_index family of
> functions and don't discard the index if it has already been populated.

instead rely on the quick return of read_index_from which has

    /* istate->initialized covers both .git/index and .git/sharedindex.xxx */
    if (istate->initialized)
        return istate->cache_nr;

such that we do not have memory leaks or other issues. Currently
we do not have a lot of callers, such that we can change the contract
of the 'repo_read_index' function easily. However going through all
the callers and then looking at the implementation, may hint at a
desire to have repo_read_index documented in repository.h
(There is a hint in struct repository, that its field index can be initialized
using repo_read_index, but what does repo_read_index actually do?)