summaryrefslogtreecommitdiff
path: root/config.c
diff options
context:
space:
mode:
authorJonathan Nieder <jrnieder@gmail.com>2018-11-20 06:14:26 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-11-21 07:46:54 (GMT)
commit2a9dedef2ef76916be4a314a7e739f253eaf05db (patch)
treea97b4357fc7e93aff9b5b1695757d5cee1446eba /config.c
parent429160544db9cc0cf748cdc98b21bd3533ec85a3 (diff)
downloadgit-2a9dedef2ef76916be4a314a7e739f253eaf05db.zip
git-2a9dedef2ef76916be4a314a7e739f253eaf05db.tar.gz
git-2a9dedef2ef76916be4a314a7e739f253eaf05db.tar.bz2
index: make index.threads=true enable ieot and eoie
If a user explicitly sets [index] threads = true to read the index using multiple threads, ensure that index writes include the offset table by default to make that possible. This ensures that the user's intent of turning on threading is respected. In other words, permit the following configurations: - index.threads and index.recordOffsetTable unspecified: do not write the offset table yet (to avoid alarming the user with "ignoring IEOT extension" messages when an older version of Git accesses the repository) but do make use of multiple threads to read the index if the supporting offset table is present. This can also be requested explicitly by setting index.threads=true, 0, or >1 and index.recordOffsetTable=false. - index.threads=false or 1: do not write the offset table, and do not make use of the offset table. One can set index.recordOffsetTable=false as well, to be more explicit. - index.threads=true, 0, or >1 and index.recordOffsetTable unspecified: write the offset table and make use of threads at read time. This can also be requested by setting index.threads=true, 0, >1, or unspecified and index.recordOffsetTable=true. Fortunately the complication is temporary: once most Git installations have upgraded to a version with support for the IEOT and EOIE extensions, we can flip the defaults for index.recordEndOfIndexEntries and index.recordOffsetTable to true and eliminate the settings. Helped-by: Ben Peart <benpeart@microsoft.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'config.c')
-rw-r--r--config.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/config.c b/config.c
index 04286f7..ff521eb 100644
--- a/config.c
+++ b/config.c
@@ -2294,22 +2294,25 @@ int git_config_get_fsmonitor(void)
return 0;
}
-int git_config_get_index_threads(void)
+int git_config_get_index_threads(int *dest)
{
- int is_bool, val = 0;
+ int is_bool, val;
val = git_env_ulong("GIT_TEST_INDEX_THREADS", 0);
- if (val)
- return val;
+ if (val) {
+ *dest = val;
+ return 0;
+ }
if (!git_config_get_bool_or_int("index.threads", &is_bool, &val)) {
if (is_bool)
- return val ? 0 : 1;
+ *dest = val ? 0 : 1;
else
- return val;
+ *dest = val;
+ return 0;
}
- return 0; /* auto */
+ return 1;
}
NORETURN