Skip to content

Commit 714edc6

Browse files
newrengitster
authored andcommitted
repo-settings: rename the traditional default fetch.negotiationAlgorithm
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent a9a136c commit 714edc6

File tree

5 files changed

+21
-17
lines changed

5 files changed

+21
-17
lines changed

Documentation/config/fetch.txt

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -56,18 +56,19 @@ fetch.output::
5656
OUTPUT in linkgit:git-fetch[1] for detail.
5757

5858
fetch.negotiationAlgorithm::
59-
Control how information about the commits in the local repository is
60-
sent when negotiating the contents of the packfile to be sent by the
61-
server. Set to "skipping" to use an algorithm that skips commits in an
62-
effort to converge faster, but may result in a larger-than-necessary
63-
packfile; or set to "noop" to not send any information at all, which
64-
will almost certainly result in a larger-than-necessary packfile, but
65-
will skip the negotiation step.
66-
The default is "default" which instructs Git to use the default algorithm
67-
that never skips commits (unless the server has acknowledged it or one
68-
of its descendants). If `feature.experimental` is enabled, then this
69-
setting defaults to "skipping".
70-
Unknown values will cause 'git fetch' to error out.
59+
Control how information about the commits in the local repository
60+
is sent when negotiating the contents of the packfile to be sent by
61+
the server. Set to "consecutive" to use an algorithm that walks
62+
over consecutive commits checking each one. Set to "skipping" to
63+
use an algorithm that skips commits in an effort to converge
64+
faster, but may result in a larger-than-necessary packfile; or set
65+
to "noop" to not send any information at all, which will almost
66+
certainly result in a larger-than-necessary packfile, but will skip
67+
the negotiation step. Set to "default" to override settings made
68+
previously and use the default behaviour. The default is normally
69+
"consecutive", but if `feature.experimental` is true, then the
70+
default is "skipping". Unknown values will cause 'git fetch' to
71+
error out.
7172
+
7273
See also the `--negotiate-only` and `--negotiation-tip` options to
7374
linkgit:git-fetch[1].

fetch-negotiator.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ void fetch_negotiator_init(struct repository *r,
1818
noop_negotiator_init(negotiator);
1919
return;
2020

21-
case FETCH_NEGOTIATION_DEFAULT:
21+
case FETCH_NEGOTIATION_CONSECUTIVE:
2222
default_negotiator_init(negotiator);
2323
return;
2424
}

repo-settings.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ void prepare_repo_settings(struct repository *r)
2323
/* Defaults */
2424
r->settings.index_version = -1;
2525
r->settings.core_untracked_cache = UNTRACKED_CACHE_KEEP;
26-
r->settings.fetch_negotiation_algorithm = FETCH_NEGOTIATION_DEFAULT;
26+
r->settings.fetch_negotiation_algorithm = FETCH_NEGOTIATION_CONSECUTIVE;
2727

2828
/* Booleans config or default, cascades to other settings */
2929
repo_cfg_bool(r, "feature.manyfiles", &manyfiles, 0);
@@ -78,12 +78,15 @@ void prepare_repo_settings(struct repository *r)
7878
}
7979

8080
if (!repo_config_get_string(r, "fetch.negotiationalgorithm", &strval)) {
81+
int fetch_default = r->settings.fetch_negotiation_algorithm;
8182
if (!strcasecmp(strval, "skipping"))
8283
r->settings.fetch_negotiation_algorithm = FETCH_NEGOTIATION_SKIPPING;
8384
else if (!strcasecmp(strval, "noop"))
8485
r->settings.fetch_negotiation_algorithm = FETCH_NEGOTIATION_NOOP;
86+
else if (!strcasecmp(strval, "consecutive"))
87+
r->settings.fetch_negotiation_algorithm = FETCH_NEGOTIATION_CONSECUTIVE;
8588
else if (!strcasecmp(strval, "default"))
86-
r->settings.fetch_negotiation_algorithm = FETCH_NEGOTIATION_DEFAULT;
89+
r->settings.fetch_negotiation_algorithm = fetch_default;
8790
else
8891
die("unknown fetch negotiation algorithm '%s'", strval);
8992
}

repository.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ enum untracked_cache_setting {
1919
};
2020

2121
enum fetch_negotiation_setting {
22-
FETCH_NEGOTIATION_DEFAULT,
22+
FETCH_NEGOTIATION_CONSECUTIVE,
2323
FETCH_NEGOTIATION_SKIPPING,
2424
FETCH_NEGOTIATION_NOOP,
2525
};

t/t5500-fetch-pack.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -968,7 +968,7 @@ test_expect_success 'use ref advertisement to prune "have" lines sent' '
968968
test_expect_success 'same as last but with config overrides' '
969969
test_negotiation_algorithm_default \
970970
-c feature.experimental=true \
971-
-c fetch.negotiationAlgorithm=default
971+
-c fetch.negotiationAlgorithm=consecutive
972972
'
973973

974974
test_expect_success 'ensure bogus fetch.negotiationAlgorithm yields error' '

0 commit comments

Comments
 (0)