Skip to content

Commit 4291605

Browse files
jrngitster
authored andcommitted
ieot: default to not writing IEOT section
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent d846550 commit 4291605

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

Documentation/config/index.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ index.recordEndOfIndexEntries::
55
reading the index using Git versions before 2.20. Defaults to
66
'false'.
77

8+
index.recordOffsetTable::
9+
Specifies whether the index file should include an "Index Entry
10+
Offset Table" section. This reduces index load time on
11+
multiprocessor machines but produces a message "ignoring IEOT
12+
extension" when reading the index using Git versions before 2.20.
13+
Defaults to 'false'.
14+
815
index.threads::
916
Specifies the number of threads to spawn when loading the index.
1017
This is meant to reduce index load time on multiprocessor machines.

read-cache.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2698,6 +2698,15 @@ static int record_eoie(void)
26982698
return 0;
26992699
}
27002700

2701+
static int record_ieot(void)
2702+
{
2703+
int val;
2704+
2705+
if (!git_config_get_bool("index.recordoffsettable", &val))
2706+
return val;
2707+
return 0;
2708+
}
2709+
27012710
/*
27022711
* On success, `tempfile` is closed. If it is the temporary file
27032712
* 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,
27612770
else
27622771
nr_threads = 1;
27632772

2764-
if (nr_threads != 1) {
2773+
if (nr_threads != 1 && record_ieot()) {
27652774
int ieot_blocks, cpus;
27662775

27672776
/*

0 commit comments

Comments
 (0)