update-index: warn in case of split-index incoherency
When users are using `git update-index --(no-)split-index`, they may expect the split-index feature to be used or not according to the option they just used, but this might not be the case if the new "core.splitIndex" config variable has been set. In this case let's warn about what will happen and why. 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
6cc1053375d8e138b8f05dde4cd0d4ab8f92254a
1 file changed
+10
-1
builtin/update-index.c
+10
-1
@@ -1099,12 +1099,21 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
1099
}
1100
1101
if (split_index > 0) {
1102
+ if (git_config_get_split_index() == 0)
1103
+ warning(_("core.splitIndex is set to false; "
1104
+ "remove or change it, if you really want to "
1105
+ "enable split index"));
1106
if (the_index.split_index)
1107
the_index.cache_changed |= SPLIT_INDEX_ORDERED;
1108
else
1109
add_split_index(&the_index);
1106
- } else if (!split_index)
1110
+ } else if (!split_index) {
1111
+ if (git_config_get_split_index() == 1)
1112
+ warning(_("core.splitIndex is set to true; "
1113
+ "remove or change it, if you really want to "
1114
+ "disable split index"));
1115
remove_split_index(&the_index);
1116
+ }
1117
1118
switch (untracked_cache) {
1119
case UC_UNSPECIFIED: