MCPcopy Index your code
hub / github.com/git/git / get_index_format_default

Function get_index_format_default

read-cache.c:1630–1657  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1628#define INDEX_FORMAT_DEFAULT 3
1629
1630static unsigned int get_index_format_default(struct repository *r)
1631{
1632 char *envversion = getenv("GIT_INDEX_VERSION");
1633 char *endp;
1634 unsigned int version = INDEX_FORMAT_DEFAULT;
1635
1636 if (!envversion) {
1637 prepare_repo_settings(r);
1638
1639 if (r->settings.index_version >= 0)
1640 version = r->settings.index_version;
1641 if (version < INDEX_FORMAT_LB || INDEX_FORMAT_UB < version) {
1642 warning(_("index.version set, but the value is invalid.\n"
1643 "Using version %i"), INDEX_FORMAT_DEFAULT);
1644 return INDEX_FORMAT_DEFAULT;
1645 }
1646 return version;
1647 }
1648
1649 version = strtoul(envversion, &endp, 10);
1650 if (*endp ||
1651 version < INDEX_FORMAT_LB || INDEX_FORMAT_UB < version) {
1652 warning(_("GIT_INDEX_VERSION set, but the value is invalid.\n"
1653 "Using version %i"), INDEX_FORMAT_DEFAULT);
1654 version = INDEX_FORMAT_DEFAULT;
1655 }
1656 return version;
1657}
1658
1659/*
1660 * dev/ino/uid/gid/size are also just tracked to the low 32 bits

Callers 1

do_write_indexFunction · 0.85

Calls 2

prepare_repo_settingsFunction · 0.85
warningFunction · 0.85

Tested by

no test coverage detected