]> git.ipfire.org Git - thirdparty/git.git/commitdiff
repo-settings: rename the traditional default fetch.negotiationAlgorithm
authorElijah Newren <newren@gmail.com>
Wed, 2 Feb 2022 03:42:40 +0000 (03:42 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 2 Feb 2022 17:36:17 +0000 (09:36 -0800)
Give the traditional default fetch.negotiationAlgorithm the name
'consecutive'.  Also allow a choice of 'default' to have Git decide
between the choices (currently, picking 'skipping' if
feature.experimental is true and 'consecutive' otherwise).  Update the
documentation accordingly.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/config/fetch.txt
fetch-negotiator.c
repo-settings.c
repository.h
t/t5500-fetch-pack.sh

index 63748c02b72afe5211a710e963c2be502888545e..cd65d236b43ffc3a7c08fa9df480fcbe6c82e68c 100644 (file)
@@ -56,18 +56,19 @@ fetch.output::
        OUTPUT in linkgit:git-fetch[1] for detail.
 
 fetch.negotiationAlgorithm::
-       Control how information about the commits in the local repository is
-       sent when negotiating the contents of the packfile to be sent by the
-       server. Set to "skipping" to use an algorithm that skips commits in an
-       effort to converge faster, but may result in a larger-than-necessary
-       packfile; or set to "noop" to not send any information at all, which
-       will almost certainly result in a larger-than-necessary packfile, but
-       will skip the negotiation step.
-       The default is "default" which instructs Git to use the default algorithm
-       that never skips commits (unless the server has acknowledged it or one
-       of its descendants). If `feature.experimental` is enabled, then this
-       setting defaults to "skipping".
-       Unknown values will cause 'git fetch' to error out.
+       Control how information about the commits in the local repository
+       is sent when negotiating the contents of the packfile to be sent by
+       the server.  Set to "consecutive" to use an algorithm that walks
+       over consecutive commits checking each one.  Set to "skipping" to
+       use an algorithm that skips commits in an effort to converge
+       faster, but may result in a larger-than-necessary packfile; or set
+       to "noop" to not send any information at all, which will almost
+       certainly result in a larger-than-necessary packfile, but will skip
+       the negotiation step.  Set to "default" to override settings made
+       previously and use the default behaviour.  The default is normally
+       "consecutive", but if `feature.experimental` is true, then the
+       default is "skipping".  Unknown values will cause 'git fetch' to
+       error out.
 +
 See also the `--negotiate-only` and `--negotiation-tip` options to
 linkgit:git-fetch[1].
index 273390229fe4c442915e911b421339e2391fc37c..874797d767bb1abd8144be9412e7e258f3d8ad9d 100644 (file)
@@ -18,7 +18,7 @@ void fetch_negotiator_init(struct repository *r,
                noop_negotiator_init(negotiator);
                return;
 
-       case FETCH_NEGOTIATION_DEFAULT:
+       case FETCH_NEGOTIATION_CONSECUTIVE:
                default_negotiator_init(negotiator);
                return;
        }
index ab896fa84b085751a0e39413b8130c30dca88524..c9ca1fd4276439d3bc4d095fe1f1e5b7e52b7e4f 100644 (file)
@@ -23,7 +23,7 @@ void prepare_repo_settings(struct repository *r)
        /* 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,12 +78,15 @@ 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_NEGOTIATION_DEFAULT;
+                       r->settings.fetch_negotiation_algorithm = fetch_default;
                else
                        die("unknown fetch negotiation algorithm '%s'", strval);
        }
index a057653981c7e8021a81ce1e5c59a872aaa9d51e..464e8ffe699c20989c2bad258e37f5ef51b718da 100644 (file)
@@ -19,7 +19,7 @@ enum untracked_cache_setting {
 };
 
 enum fetch_negotiation_setting {
-       FETCH_NEGOTIATION_DEFAULT,
+       FETCH_NEGOTIATION_CONSECUTIVE,
        FETCH_NEGOTIATION_SKIPPING,
        FETCH_NEGOTIATION_NOOP,
 };
index 403d4e40a296bf24a33fc32ef1181f5d172d8b6a..fb94033a489afbe907a49b89d70cb5ea4a05b954 100755 (executable)
@@ -968,7 +968,7 @@ test_expect_success 'use ref advertisement to prune "have" lines sent' '
 test_expect_success 'same as last but with config overrides' '
        test_negotiation_algorithm_default \
                -c feature.experimental=true \
-               -c fetch.negotiationAlgorithm=default
+               -c fetch.negotiationAlgorithm=consecutive
 '
 
 test_expect_success 'ensure bogus fetch.negotiationAlgorithm yields error' '