Re: [PATCH 1/3] repo_read_index: don't discard the index
From: Brandon Williams <hidden>
Date: 2017-07-12 17:24:01
On 07/11, Stefan Beller wrote:
On Tue, Jul 11, 2017 at 3:04 PM, Brandon Williams [off-list ref] wrote:quoted
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;
I can include this in the commit msg.
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?)
And I can document the function better in repository.h :) -- Brandon Williams