Skip to content

Commit

Permalink
update-index: warn in case of split-index incoherency
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
chriscool authored and gitster committed Mar 1, 2017
1 parent 4392531 commit 6cc1053
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion builtin/update-index.c
Original file line number Diff line number Diff line change
Expand Up @@ -1099,12 +1099,21 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
}

if (split_index > 0) {
if (git_config_get_split_index() == 0)
warning(_("core.splitIndex is set to false; "
"remove or change it, if you really want to "
"enable split index"));
if (the_index.split_index)
the_index.cache_changed |= SPLIT_INDEX_ORDERED;
else
add_split_index(&the_index);
} else if (!split_index)
} else if (!split_index) {
if (git_config_get_split_index() == 1)
warning(_("core.splitIndex is set to true; "
"remove or change it, if you really want to "
"disable split index"));
remove_split_index(&the_index);
}

switch (untracked_cache) {
case UC_UNSPECIFIED:
Expand Down

0 comments on commit 6cc1053

Please sign in to comment.