File tree Expand file tree Collapse file tree 4 files changed +39
-4
lines changed
Expand file tree Collapse file tree 4 files changed +39
-4
lines changed Original file line number Diff line number Diff line change @@ -1550,9 +1550,12 @@ fetch.negotiationAlgorithm::
15501550 sent when negotiating the contents of the packfile to be sent by the
15511551 server. Set to "skipping" to use an algorithm that skips commits in an
15521552 effort to converge faster, but may result in a larger-than-necessary
1553- packfile; any other value instructs Git to use the default algorithm
1553+ packfile; The default is "default" which instructs Git to use the default algorithm
15541554 that never skips commits (unless the server has acknowledged it or one
15551555 of its descendants).
1556+ Unknown values will cause 'git fetch' to error out.
1557+ +
1558+ See also the `--negotiation-tip` option for linkgit:git-fetch[1].
15561559
15571560format.attach::
15581561 Enable multipart/mixed attachments as the default for
Original file line number Diff line number Diff line change @@ -57,6 +57,9 @@ commits reachable from any of the given commits.
5757The argument to this option may be a glob on ref names, a ref, or the (possibly
5858abbreviated) SHA-1 of a commit. Specifying a glob is equivalent to specifying
5959this option multiple times, one for each matching ref name.
60+ +
61+ See also the `fetch.negotiationAlgorithm` configuration variable
62+ documented in linkgit:git-config[1].
6063
6164ifndef::git-pull[]
6265--dry-run::
Original file line number Diff line number Diff line change 66void fetch_negotiator_init (struct fetch_negotiator * negotiator ,
77 const char * algorithm )
88{
9- if (algorithm && !strcmp (algorithm , "skipping" )) {
10- skipping_negotiator_init (negotiator );
11- return ;
9+ if (algorithm ) {
10+ if (!strcmp (algorithm , "skipping" )) {
11+ skipping_negotiator_init (negotiator );
12+ return ;
13+ } else if (!strcmp (algorithm , "default" )) {
14+ /* Fall through to default initialization */
15+ } else {
16+ die ("unknown fetch negotiation algorithm '%s'" , algorithm );
17+ }
1218 }
1319 default_negotiator_init (negotiator );
1420}
Original file line number Diff line number Diff line change @@ -47,6 +47,29 @@ test_expect_success 'commits with no parents are sent regardless of skip distanc
4747 have_not_sent c6 c4 c3
4848'
4949
50+ test_expect_success ' unknown fetch.negotiationAlgorithm values error out' '
51+ rm -rf server client trace &&
52+ git init server &&
53+ test_commit -C server to_fetch &&
54+
55+ git init client &&
56+ test_commit -C client on_client &&
57+ git -C client checkout on_client &&
58+
59+ test_config -C client fetch.negotiationAlgorithm invalid &&
60+ test_must_fail git -C client fetch "$(pwd)/server" 2>err &&
61+ test_i18ngrep "unknown fetch negotiation algorithm" err &&
62+
63+ # Explicit "default" value
64+ test_config -C client fetch.negotiationAlgorithm default &&
65+ git -C client -c fetch.negotiationAlgorithm=default fetch "$(pwd)/server" &&
66+
67+ # Implementation detail: If there is nothing to fetch, we will not error out
68+ test_config -C client fetch.negotiationAlgorithm invalid &&
69+ git -C client fetch "$(pwd)/server" 2>err &&
70+ test_i18ngrep ! "unknown fetch negotiation algorithm" err
71+ '
72+
5073test_expect_success ' when two skips collide, favor the larger one' '
5174 rm -rf server client trace &&
5275 git init server &&
You can’t perform that action at this time.
0 commit comments