read-cache: add and then use tweak_split_index()

This will make us use the split-index feature or not depending on the value of the "core.splitIndex" config variable. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Christian Couder committed Feb 27, 2017 at 19:00 UTC 4392531211e48ead6bf2d27c58b208cd1e221eda
1 file changed +17
read-cache.c
+17
@@ -1566,10 +1566,27 @@ static void tweak_untracked_cache(struct index_state *istate)
1566 }
1567 }
1568
1569 +static void tweak_split_index(struct index_state *istate)
1570 +{
1571 + switch (git_config_get_split_index()) {
1572 + case -1: /* unset: do nothing */
1573 + break;
1574 + case 0: /* false */
1575 + remove_split_index(istate);
1576 + break;
1577 + case 1: /* true */
1578 + add_split_index(istate);
1579 + break;
1580 + default: /* unknown value: do nothing */
1581 + break;
1582 + }
1583 +}
1584 +
1585 static void post_read_index_from(struct index_state *istate)
1586 {
1587 check_ce_order(istate);
1588 tweak_untracked_cache(istate);
1589 + tweak_split_index(istate);
1590 }
1591
1592 /* remember to discard_cache() before reading a different cache! */