]> git.ipfire.org Git - thirdparty/git.git/blobdiff - repo-settings.c
Merge branch 'en/fetch-negotiation-default-fix'
[thirdparty/git.git] / repo-settings.c
index b93e91a212eb98aae494acc544edcd71b77a4761..b4fbd16cdcc251386a1b77a6920fdbad923cc1ef 100644 (file)
@@ -17,13 +17,16 @@ void prepare_repo_settings(struct repository *r)
        char *strval;
        int manyfiles;
 
+       if (!r->gitdir)
+               BUG("Cannot add settings for uninitialized repository");
+
        if (r->settings.initialized++)
                return;
 
        /* Defaults */
        r->settings.index_version = -1;
        r->settings.core_untracked_cache = UNTRACKED_CACHE_KEEP;
-       r->settings.fetch_negotiation_algorithm = FETCH_NEGOTIATION_DEFAULT;
+       r->settings.fetch_negotiation_algorithm = FETCH_NEGOTIATION_CONSECUTIVE;
 
        /* Booleans config or default, cascades to other settings */
        repo_cfg_bool(r, "feature.manyfiles", &manyfiles, 0);
@@ -78,10 +81,17 @@ void prepare_repo_settings(struct repository *r)
        }
 
        if (!repo_config_get_string(r, "fetch.negotiationalgorithm", &strval)) {
+               int fetch_default = r->settings.fetch_negotiation_algorithm;
                if (!strcasecmp(strval, "skipping"))
                        r->settings.fetch_negotiation_algorithm = FETCH_NEGOTIATION_SKIPPING;
                else if (!strcasecmp(strval, "noop"))
                        r->settings.fetch_negotiation_algorithm = FETCH_NEGOTIATION_NOOP;
+               else if (!strcasecmp(strval, "consecutive"))
+                       r->settings.fetch_negotiation_algorithm = FETCH_NEGOTIATION_CONSECUTIVE;
+               else if (!strcasecmp(strval, "default"))
+                       r->settings.fetch_negotiation_algorithm = fetch_default;
+               else
+                       die("unknown fetch negotiation algorithm '%s'", strval);
        }
 
        /*