[PATCH v2 3/5] fetch: Add the fetch.jobs config key
To
git@vger.kernel.org
Cc
peff@peff.net
e@80x24.org
chriscool@tuxfamily.org
gitster@pobox.com
jonathantanmy@google.com
tboegi@web.de
bwilliams.eng@gmail.com
jeffhost@microsoft.com
Palmer Dabbelt
From
Palmer Dabbelt
See Also
Prev
Date
2019-08-12 21:34:46 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 --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);
 }
 
-- 
2.21.0