mirror of
https://github.com/git/git.git
synced 2026-01-09 01:34:00 +00:00
config: pass repo to git_config_get_index_threads()
Refactor `git_config_get_index_threads()` to accept a `struct repository` such that we can get rid of the implicit dependency on `the_repository`. Rename the function accordingly. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
2ea8536468
commit
1870cc30d4
@@ -2267,7 +2267,7 @@ int do_read_index(struct index_state *istate, const char *path, int must_exist)
|
||||
|
||||
src_offset = sizeof(*hdr);
|
||||
|
||||
if (git_config_get_index_threads(&nr_threads))
|
||||
if (repo_config_get_index_threads(the_repository, &nr_threads))
|
||||
nr_threads = 1;
|
||||
|
||||
/* TODO: does creating more threads than cores help? */
|
||||
@@ -2787,7 +2787,7 @@ static int record_eoie(void)
|
||||
* used for threading is written by default if the user
|
||||
* explicitly requested threaded index reads.
|
||||
*/
|
||||
return !git_config_get_index_threads(&val) && val != 1;
|
||||
return !repo_config_get_index_threads(the_repository, &val) && val != 1;
|
||||
}
|
||||
|
||||
static int record_ieot(void)
|
||||
@@ -2802,7 +2802,7 @@ static int record_ieot(void)
|
||||
* written by default if the user explicitly requested
|
||||
* threaded index reads.
|
||||
*/
|
||||
return !git_config_get_index_threads(&val) && val != 1;
|
||||
return !repo_config_get_index_threads(the_repository, &val) && val != 1;
|
||||
}
|
||||
|
||||
enum write_extensions {
|
||||
@@ -2875,7 +2875,7 @@ static int do_write_index(struct index_state *istate, struct tempfile *tempfile,
|
||||
|
||||
hashwrite(f, &hdr, sizeof(hdr));
|
||||
|
||||
if (!HAVE_THREADS || git_config_get_index_threads(&nr_threads))
|
||||
if (!HAVE_THREADS || repo_config_get_index_threads(the_repository, &nr_threads))
|
||||
nr_threads = 1;
|
||||
|
||||
if (nr_threads != 1 && record_ieot()) {
|
||||
|
||||
Reference in New Issue
Block a user