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 <pal...@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

Reply via email to