Merge branch 'cc/split-index-config'

The experimental "split index" feature has gained a few
configuration variables to make it easier to use.

* cc/split-index-config: (22 commits)
  Documentation/git-update-index: explain splitIndex.*
  Documentation/config: add splitIndex.sharedIndexExpire
  read-cache: use freshen_shared_index() in read_index_from()
  read-cache: refactor read_index_from()
  t1700: test shared index file expiration
  read-cache: unlink old sharedindex files
  config: add git_config_get_expiry() from gc.c
  read-cache: touch shared index files when used
  sha1_file: make check_and_freshen_file() non static
  Documentation/config: add splitIndex.maxPercentChange
  t1700: add tests for splitIndex.maxPercentChange
  read-cache: regenerate shared index if necessary
  config: add git_config_get_max_percent_split_change()
  Documentation/git-update-index: talk about core.splitIndex config var
  Documentation/config: add information for core.splitIndex
  t1700: add tests for core.splitIndex
  update-index: warn in case of split-index incoherency
  read-cache: add and then use tweak_split_index()
  split-index: add {add,remove}_split_index() functions
  config: add git_config_get_split_index()
  ...
This commit is contained in:
Junio C Hamano
2017-03-17 13:50:23 -07:00
11 changed files with 540 additions and 131 deletions

View File

@ -1803,6 +1803,19 @@ int git_config_get_pathname(const char *key, const char **dest)
return ret;
}
int git_config_get_expiry(const char *key, const char **output)
{
int ret = git_config_get_string_const(key, output);
if (ret)
return ret;
if (strcmp(*output, "now")) {
unsigned long now = approxidate("now");
if (approxidate(*output) >= now)
git_die_config(key, _("Invalid %s: '%s'"), key, *output);
}
return ret;
}
int git_config_get_untracked_cache(void)
{
int val = -1;
@ -1819,14 +1832,39 @@ int git_config_get_untracked_cache(void)
if (!strcasecmp(v, "keep"))
return -1;
error("unknown core.untrackedCache value '%s'; "
"using 'keep' default value", v);
error(_("unknown core.untrackedCache value '%s'; "
"using 'keep' default value"), v);
return -1;
}
return -1; /* default value */
}
int git_config_get_split_index(void)
{
int val;
if (!git_config_get_maybe_bool("core.splitindex", &val))
return val;
return -1; /* default value */
}
int git_config_get_max_percent_split_change(void)
{
int val = -1;
if (!git_config_get_int("splitindex.maxpercentchange", &val)) {
if (0 <= val && val <= 100)
return val;
return error(_("splitIndex.maxPercentChange value '%d' "
"should be between 0 and 100"), val);
}
return -1; /* default value */
}
NORETURN
void git_die_config_linenr(const char *key, const char *filename, int linenr)
{