[v2,3/5] fetch: Add the fetch.jobs config key
diff mbox series

Message ID 20190812213448.2649-4-palmer@sifive.com
State New
Headers show
  • fetch: Extend --jobs to multiple remotes
Related show

Commit Message

Palmer Dabbelt Aug. 12, 2019, 9:34 p.m. UTC
This allows users to default to parallel fetches, so they don't have to
pass --fetch-jobs=N on the command line every time.  The implementation
matches submodule.fetchjobs by die()ing on invalid job counts.

I couldn't find any documentation for submodule.fetchjobs, so I didn't
write any for this one.  I've tested this in my config and in
conjunction with the command-line argument.

Signed-off-by: Palmer Dabbelt <palmer@sifive.com>
 builtin/fetch.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff mbox series

diff --git a/builtin/fetch.c b/builtin/fetch.c
index fa12ad44e7d9..4c5f2ea3a931 100644
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
@@ -104,6 +104,13 @@  static int git_fetch_config(const char *k, const char *v, void *cb)
 		return 0;
+	if (!strcmp(k, "fetch.jobs")) {
+		max_children_for_fetch = git_config_int(k, v);
+		if (max_children_for_fetch < 0)
+			die(_("negative values not allowed for fetch.jobs"));
+		return 0;
+	}
 	return git_default_config(k, v, cb);