ieot: default to not writing IEOT section
authorJonathan Nieder <jrnieder@gmail.com>
Tue, 20 Nov 2018 06:12:22 +0000 (22:12 -0800)
committerJunio C Hamano <gitster@pobox.com>
Wed, 21 Nov 2018 04:43:06 +0000 (13:43 +0900)
As with EOIE, popular versions of Git do not support the new IEOT
extension yet. When accessing a Git repository written by a more
modern version of Git, they correctly ignore the unrecognized section,
but in the process they loudly warn

ignoring IEOT extension

resulting in confusion for users. Introduce the index extension more
gently by not writing it yet in this first version with support for
it. Soon, once sufficiently many users are running a modern version
of Git, we can flip the default so users benefit from this index
extension by default.

Introduce a '[index] recordOffsetTable' configuration variable to
control whether the new index extension is written.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/config/index.txt
read-cache.c
index 8e138aba7a460f1d5a628b43f684e28da9c3adce..de4418323583f0b6f662cb02b0c100766b20613b 100644 (file)
@@ -5,6 +5,13 @@ index.recordEndOfIndexEntries::
        reading the index using Git versions before 2.20. Defaults to
        'false'.
 
+index.recordOffsetTable::
+       Specifies whether the index file should include an "Index Entry
+       Offset Table" section. This reduces index load time on
+       multiprocessor machines but produces a message "ignoring IEOT
+       extension" when reading the index using Git versions before 2.20.
+       Defaults to 'false'.
+
 index.threads::
        Specifies the number of threads to spawn when loading the index.
        This is meant to reduce index load time on multiprocessor machines.
index 1e9c772603070722899ee88f559c51283961e3d3..f3d5638d9ed40fd5f35d5a525d159ddf3eb155b6 100644 (file)
@@ -2698,6 +2698,15 @@ static int record_eoie(void)
        return 0;
 }
 
+static int record_ieot(void)
+{
+       int val;
+
+       if (!git_config_get_bool("index.recordoffsettable", &val))
+               return val;
+       return 0;
+}
+
 /*
  * On success, `tempfile` is closed. If it is the temporary file
  * of a `struct lock_file`, we will therefore effectively perform
@@ -2761,7 +2770,7 @@ static int do_write_index(struct index_state *istate, struct tempfile *tempfile,
        else
                nr_threads = 1;
 
-       if (nr_threads != 1) {
+       if (nr_threads != 1 && record_ieot()) {
                int ieot_blocks, cpus;
 
                /*