diff options
author | Ben Peart <benpeart@microsoft.com> | 2017-11-09 09:17:35 -0500 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-11-11 03:53:11 +0900 |
commit | 65613ebdc09ba03acd94cc9622ec85e89aee5396 (patch) | |
tree | e6ca37569a62bc85a114ed805110621b3eeaea50 | |
parent | 8ac68eb00944068e0eba456cb3cab97707606100 (diff) | |
download | git-65613ebdc09ba03acd94cc9622ec85e89aee5396.tar.gz |
update-index: add fastindex support to update-index
Add support in update-index to manually add/remove the fastindex
extension via --[no-]fastindex flags.
Signed-off-by: Ben Peart <benpeart@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r-- | builtin/update-index.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/builtin/update-index.c b/builtin/update-index.c index fefbe60167..63b7f18807 100644 --- a/builtin/update-index.c +++ b/builtin/update-index.c @@ -917,6 +917,7 @@ int cmd_update_index(int argc, const char **argv, const char *prefix) struct refresh_params refresh_args = {0, &has_errors}; int lock_error = 0; int split_index = -1; + int fast_index = -1; struct lock_file lock_file = LOCK_INIT; struct parse_opt_ctx_t ctx; strbuf_getline_fn getline_fn; @@ -1008,6 +1009,8 @@ int cmd_update_index(int argc, const char **argv, const char *prefix) N_("test if the filesystem supports untracked cache"), UC_TEST), OPT_SET_INT(0, "force-untracked-cache", &untracked_cache, N_("enable untracked cache without testing the filesystem"), UC_FORCE), + OPT_BOOL(0, "fastindex", &fast_index, + N_("enable or disable fast index parsing")), OPT_END() }; @@ -1146,6 +1149,25 @@ int cmd_update_index(int argc, const char **argv, const char *prefix) die("BUG: bad untracked_cache value: %d", untracked_cache); } + if (fast_index > 0) { + if (git_config_get_fast_index() == 0) + warning(_("core.fastindex is unset; " + "set it if you really want to " + "enable fastindex")); + core_fast_index = 1; + active_cache_changed |= SOMETHING_CHANGED; + report(_("fastindex enabled")); + } + else if (!fast_index) { + if (git_config_get_fast_index() == 1) + warning(_("core.fastindex is set; " + "remove it if you really want to " + "disable fastindex")); + core_fast_index = 0; + active_cache_changed |= SOMETHING_CHANGED; + report(_("fastindex disabled")); + } + if (active_cache_changed) { if (newfd < 0) { if (refresh_args.flags & REFRESH_QUIET) |