summaryrefslogtreecommitdiff
path: root/builtin/update-index.c
diff options
context:
space:
mode:
authorChristian Couder <christian.couder@gmail.com>2017-02-27 18:00:01 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-03-01 21:24:21 (GMT)
commitcef4fc7ebe869e910d0fd5643cd60328ed76356a (patch)
tree1e2208e78fed34a57a6ddb43cfd301aafe24cda8 /builtin/update-index.c
parent1f44b09b5891aa0dc30cc7b7fff0d29b985a5af6 (diff)
downloadgit-cef4fc7ebe869e910d0fd5643cd60328ed76356a.zip
git-cef4fc7ebe869e910d0fd5643cd60328ed76356a.tar.gz
git-cef4fc7ebe869e910d0fd5643cd60328ed76356a.tar.bz2
split-index: add {add,remove}_split_index() functions
Also use the functions in cmd_update_index() in builtin/update-index.c. These functions will be used in a following commit to tweak our use of the split-index feature depending on the setting of a configuration variable. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/update-index.c')
-rw-r--r--builtin/update-index.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/builtin/update-index.c b/builtin/update-index.c
index d530e89..24fdadf 100644
--- a/builtin/update-index.c
+++ b/builtin/update-index.c
@@ -1099,18 +1099,12 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
}
if (split_index > 0) {
- init_split_index(&the_index);
- the_index.cache_changed |= SPLIT_INDEX_ORDERED;
- } else if (!split_index && the_index.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.
- */
- the_index.split_index = NULL;
- the_index.cache_changed |= SOMETHING_CHANGED;
- }
+ if (the_index.split_index)
+ the_index.cache_changed |= SPLIT_INDEX_ORDERED;
+ else
+ add_split_index(&the_index);
+ } else if (!split_index)
+ remove_split_index(&the_index);
switch (untracked_cache) {
case UC_UNSPECIFIED: