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::
1550
1550
sent when negotiating the contents of the packfile to be sent by the
1551
1551
server. Set to "skipping" to use an algorithm that skips commits in an
1552
1552
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
1554
1554
that never skips commits (unless the server has acknowledged it or one
1555
1555
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].
1556
1559
1557
1560
format.attach::
1558
1561
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.
57
57
The argument to this option may be a glob on ref names, a ref, or the (possibly
58
58
abbreviated) SHA-1 of a commit. Specifying a glob is equivalent to specifying
59
59
this 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].
60
63
61
64
ifndef::git-pull[]
62
65
--dry-run::
Original file line number Diff line number Diff line change 6
6
void fetch_negotiator_init (struct fetch_negotiator * negotiator ,
7
7
const char * algorithm )
8
8
{
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
+ }
12
18
}
13
19
default_negotiator_init (negotiator );
14
20
}
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
47
47
have_not_sent c6 c4 c3
48
48
'
49
49
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
+
50
73
test_expect_success ' when two skips collide, favor the larger one' '
51
74
rm -rf server client trace &&
52
75
git init server &&
You can’t perform that action at this time.
0 commit comments