]> git.ipfire.org Git - thirdparty/git.git/blobdiff - submodule-config.c
object-name.h: move declarations for object-name.c functions from cache.h
[thirdparty/git.git] / submodule-config.c
index c2ac7e7bf39b2eb9c273a11fb457b0dbc7369aa6..252b90aa439c9014b1bbb3b0e641201d998def9c 100644 (file)
@@ -1,10 +1,15 @@
 #include "cache.h"
+#include "alloc.h"
 #include "dir.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
 #include "repository.h"
 #include "config.h"
 #include "submodule-config.h"
 #include "submodule.h"
 #include "strbuf.h"
+#include "object-name.h"
 #include "object-store.h"
 #include "parse-options.h"
 #include "tree-walk.h"
@@ -38,10 +43,10 @@ enum lookup_type {
        lookup_path
 };
 
-static int config_path_cmp(const void *unused_cmp_data,
+static int config_path_cmp(const void *cmp_data UNUSED,
                           const struct hashmap_entry *eptr,
                           const struct hashmap_entry *entry_or_key,
-                          const void *unused_keydata)
+                          const void *keydata UNUSED)
 {
        const struct submodule_entry *a, *b;
 
@@ -52,10 +57,10 @@ static int config_path_cmp(const void *unused_cmp_data,
               !oideq(&a->config->gitmodules_oid, &b->config->gitmodules_oid);
 }
 
-static int config_name_cmp(const void *unused_cmp_data,
+static int config_name_cmp(const void *cmp_data UNUSED,
                           const struct hashmap_entry *eptr,
                           const struct hashmap_entry *entry_or_key,
-                          const void *unused_keydata)
+                          const void *keydata UNUSED)
 {
        const struct submodule_entry *a, *b;
 
@@ -303,6 +308,8 @@ int parse_submodule_fetchjobs(const char *var, const char *value)
        int fetchjobs = git_config_int(var, value);
        if (fetchjobs < 0)
                die(_("negative values not allowed for submodule.fetchJobs"));
+       if (!fetchjobs)
+               fetchjobs = online_cpus();
        return fetchjobs;
 }
 
@@ -533,7 +540,7 @@ static int gitmodule_oid_from_commit(const struct object_id *treeish_name,
        }
 
        strbuf_addf(rev, "%s:.gitmodules", oid_to_hex(treeish_name));
-       if (get_oid(rev->buf, gitmodules_oid) >= 0)
+       if (repo_get_oid(the_repository, rev->buf, gitmodules_oid) >= 0)
                ret = 1;
 
        return ret;
@@ -586,7 +593,8 @@ static const struct submodule *config_from(struct submodule_cache *cache,
        if (submodule)
                goto out;
 
-       config = read_object_file(&oid, &type, &config_size);
+       config = repo_read_object_file(the_repository, &oid, &type,
+                                      &config_size);
        if (!config || type != OBJ_BLOB)
                goto out;