Skip to content

Commit f7e063f

Browse files
pks-tgitster
authored andcommitted
fetch: use fetch_config to store "submodule.fetchJobs" value
Move the parsed "submodule.fetchJobs" config value into the `fetch_config` structure. This reduces our reliance on global variables and further unifies the way we parse the configuration in git-fetch(1). Signed-off-by: Patrick Steinhardt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent ac197cc commit f7e063f

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

builtin/fetch.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ static int write_fetch_head = 1;
8686
static int verbosity, deepen_relative, set_upstream, refetch;
8787
static int progress = -1;
8888
static int tags = TAGS_DEFAULT, update_shallow, deepen;
89-
static int submodule_fetch_jobs_config = -1;
9089
static int atomic_fetch;
9190
static enum transport_family family;
9291
static const char *depth;
@@ -108,6 +107,7 @@ struct fetch_config {
108107
int show_forced_updates;
109108
int recurse_submodules;
110109
int parallel;
110+
int submodule_fetch_jobs;
111111
};
112112

113113
static int git_fetch_config(const char *k, const char *v, void *cb)
@@ -136,7 +136,7 @@ static int git_fetch_config(const char *k, const char *v, void *cb)
136136
}
137137

138138
if (!strcmp(k, "submodule.fetchjobs")) {
139-
submodule_fetch_jobs_config = parse_submodule_fetchjobs(k, v);
139+
fetch_config->submodule_fetch_jobs = parse_submodule_fetchjobs(k, v);
140140
return 0;
141141
} else if (!strcmp(k, "fetch.recursesubmodules")) {
142142
fetch_config->recurse_submodules = parse_fetch_recurse_submodules_arg(k, v);
@@ -2119,6 +2119,7 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
21192119
.show_forced_updates = 1,
21202120
.recurse_submodules = RECURSE_SUBMODULES_DEFAULT,
21212121
.parallel = 1,
2122+
.submodule_fetch_jobs = -1,
21222123
};
21232124
const char *submodule_prefix = "";
21242125
const char *bundle_uri;
@@ -2268,8 +2269,8 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
22682269
}
22692270

22702271
if (config.recurse_submodules != RECURSE_SUBMODULES_OFF) {
2271-
int *sfjc = submodule_fetch_jobs_config == -1
2272-
? &submodule_fetch_jobs_config : NULL;
2272+
int *sfjc = config.submodule_fetch_jobs == -1
2273+
? &config.submodule_fetch_jobs : NULL;
22732274
int *rs = config.recurse_submodules == RECURSE_SUBMODULES_DEFAULT
22742275
? &config.recurse_submodules : NULL;
22752276

@@ -2432,7 +2433,7 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
24322433
int max_children = max_jobs;
24332434

24342435
if (max_children < 0)
2435-
max_children = submodule_fetch_jobs_config;
2436+
max_children = config.submodule_fetch_jobs;
24362437
if (max_children < 0)
24372438
max_children = config.parallel;
24382439

0 commit comments

Comments
 (0)