diff options
author | Junio C Hamano <gitster@pobox.com> | 2017-03-17 13:50:23 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-03-17 13:50:23 -0700 |
commit | 94c9b5af703eb70adba349cfbfaaa3029849744c (patch) | |
tree | cfb8557c71f0f2f8b586c63b9d51ae3a4745b48b /split-index.c | |
parent | 32c43f595f93cdd4ed5305aef97a3f6aaa74ed72 (diff) | |
parent | b46013950aff31b6626af96ccbf2c48469e36c66 (diff) | |
download | git-94c9b5af703eb70adba349cfbfaaa3029849744c.tar.gz |
Merge branch 'cc/split-index-config'
The experimental "split index" feature has gained a few
configuration variables to make it easier to use.
* cc/split-index-config: (22 commits)
Documentation/git-update-index: explain splitIndex.*
Documentation/config: add splitIndex.sharedIndexExpire
read-cache: use freshen_shared_index() in read_index_from()
read-cache: refactor read_index_from()
t1700: test shared index file expiration
read-cache: unlink old sharedindex files
config: add git_config_get_expiry() from gc.c
read-cache: touch shared index files when used
sha1_file: make check_and_freshen_file() non static
Documentation/config: add splitIndex.maxPercentChange
t1700: add tests for splitIndex.maxPercentChange
read-cache: regenerate shared index if necessary
config: add git_config_get_max_percent_split_change()
Documentation/git-update-index: talk about core.splitIndex config var
Documentation/config: add information for core.splitIndex
t1700: add tests for core.splitIndex
update-index: warn in case of split-index incoherency
read-cache: add and then use tweak_split_index()
split-index: add {add,remove}_split_index() functions
config: add git_config_get_split_index()
...
Diffstat (limited to 'split-index.c')
-rw-r--r-- | split-index.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/split-index.c b/split-index.c index 615f4cac05..f519e60f87 100644 --- a/split-index.c +++ b/split-index.c @@ -317,3 +317,25 @@ void replace_index_entry_in_base(struct index_state *istate, istate->split_index->base->cache[new->index - 1] = new; } } + +void add_split_index(struct index_state *istate) +{ + if (!istate->split_index) { + init_split_index(istate); + istate->cache_changed |= SPLIT_INDEX_ORDERED; + } +} + +void remove_split_index(struct index_state *istate) +{ + if (istate->split_index) { + /* + * can't discard_split_index(&the_index); because that + * will destroy split_index->base->cache[], which may + * be shared with the_index.cache[]. So yeah we're + * leaking a bit here. + */ + istate->split_index = NULL; + istate->cache_changed |= SOMETHING_CHANGED; + } +} |