Re: [PATCH 1/3] repo_read_index: don't discard the index
- From
Stefan Beller <sbeller@google.com>
- Date
- Jul 11, 2017, 23:58 UTC
- Message-ID
- <CAGZ79kbsjBMW0TBha=+uyZ4JN-vFaXVa1DeFkJ21w2Zrqfhi4g@mail.gmail.com>
- In-Reply-To
- <20170711220408.173269-2-bmwill@google.com>
On Tue, Jul 11, 2017 at 3:04 PM, Brandon Williams <bmwill@google.com> 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?)