@@ -2176,7 +2176,8 @@ int do_read_index(struct index_state *istate, const char *path, int must_exist)
21762176
21772177 src_offset = sizeof (* hdr );
21782178
2179- nr_threads = git_config_get_index_threads ();
2179+ if (git_config_get_index_threads (& nr_threads ))
2180+ nr_threads = 1 ;
21802181
21812182 /* TODO: does creating more threads than cores help? */
21822183 if (!nr_threads ) {
@@ -2689,6 +2690,36 @@ void update_index_if_able(struct index_state *istate, struct lock_file *lockfile
26892690 rollback_lock_file (lockfile );
26902691}
26912692
2693+ static int record_eoie (void )
2694+ {
2695+ int val ;
2696+
2697+ if (!git_config_get_bool ("index.recordendofindexentries" , & val ))
2698+ return val ;
2699+
2700+ /*
2701+ * As a convenience, the end of index entries extension
2702+ * used for threading is written by default if the user
2703+ * explicitly requested threaded index reads.
2704+ */
2705+ return !git_config_get_index_threads (& val ) && val != 1 ;
2706+ }
2707+
2708+ static int record_ieot (void )
2709+ {
2710+ int val ;
2711+
2712+ if (!git_config_get_bool ("index.recordoffsettable" , & val ))
2713+ return val ;
2714+
2715+ /*
2716+ * As a convenience, the offset table used for threading is
2717+ * written by default if the user explicitly requested
2718+ * threaded index reads.
2719+ */
2720+ return !git_config_get_index_threads (& val ) && val != 1 ;
2721+ }
2722+
26922723/*
26932724 * On success, `tempfile` is closed. If it is the temporary file
26942725 * of a `struct lock_file`, we will therefore effectively perform
@@ -2747,12 +2778,10 @@ static int do_write_index(struct index_state *istate, struct tempfile *tempfile,
27472778 if (ce_write (& c , newfd , & hdr , sizeof (hdr )) < 0 )
27482779 return -1 ;
27492780
2750- if (HAVE_THREADS )
2751- nr_threads = git_config_get_index_threads ();
2752- else
2781+ if (!HAVE_THREADS || git_config_get_index_threads (& nr_threads ))
27532782 nr_threads = 1 ;
27542783
2755- if (nr_threads != 1 ) {
2784+ if (nr_threads != 1 && record_ieot () ) {
27562785 int ieot_blocks , cpus ;
27572786
27582787 /*
@@ -2936,7 +2965,7 @@ static int do_write_index(struct index_state *istate, struct tempfile *tempfile,
29362965 * read. Write it out regardless of the strip_extensions parameter as we need it
29372966 * when loading the shared index.
29382967 */
2939- if (offset ) {
2968+ if (offset && record_eoie () ) {
29402969 struct strbuf sb = STRBUF_INIT ;
29412970
29422971 write_eoie_extension (& sb , & eoie_c , offset );
0 commit comments