git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v3 3/3] repo-settings: name the default fetch.negotiationAlgorithm 'consecutive'

From
Elijah Newren via GitGitGadget <gitgitgadget@gmail.com>
Date
Feb 1, 2022, 17:00 UTC
Message-ID
<7b28c527a907c81c3d3d8a6a54d5c713cef4f2a0.1643734828.git.gitgitgadget@gmail.com>
In-Reply-To
<pull.1131.v3.git.1643734828.gitgitgadget@gmail.com>
From: Elijah Newren <newren@gmail.com>

Give the default fetch.negotiationAlgorithm the name 'consecutive' and update the documentation accordingly. Since there may be some users using the name 'default' for this behavior, retain that name for now. We do not want to use that name indefinitely, though, because if 'skipping' becomes the default, then the "default" behavior will not be the default behavior, which would be confusing.

Signed-off-by: Elijah Newren <newren@gmail.com>
---
 Documentation/config/fetch.txt | 21 ++++++++++-----------
 fetch-negotiator.c             |  2 +-
 repo-settings.c                |  7 ++++---
 repository.h                   |  2 +-
 t/t5500-fetch-pack.sh          |  2 +-
 5 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/Documentation/config/fetch.txt b/Documentation/config/fetch.txt
index 63748c02b72..926bcfd8b48 100644
--- a/Documentation/config/fetch.txt
+++ b/Documentation/config/fetch.txt
@@ -56,17 +56,16 @@ 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".
+	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.  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
diff --git a/fetch-negotiator.c b/fetch-negotiator.c
index 273390229fe..874797d767b 100644
--- a/fetch-negotiator.c
+++ b/fetch-negotiator.c
@@ -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;
 	}
diff --git a/repo-settings.c b/repo-settings.c
index 41e1c30845f..e984075df12 100644
--- a/repo-settings.c
+++ b/repo-settings.c
@@ -26,7 +26,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);
@@ -85,8 +85,9 @@ void prepare_repo_settings(struct repository *r)
 			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, "default"))
-			r->settings.fetch_negotiation_algorithm = FETCH_NEGOTIATION_DEFAULT;
+		else if (!strcasecmp(strval, "consecutive") ||
+			 !strcasecmp(strval, "default"))
+			r->settings.fetch_negotiation_algorithm = FETCH_NEGOTIATION_CONSECUTIVE;
 		else
 			die("unknown fetch negotiation algorithm '%s'", strval);
 	}
diff --git a/repository.h b/repository.h
index 2b5cf97f31e..ca837cb9e91 100644
--- a/repository.h
+++ b/repository.h
@@ -20,7 +20,7 @@ enum untracked_cache_setting {
 };
 
 enum fetch_negotiation_setting {
-	FETCH_NEGOTIATION_DEFAULT,
+	FETCH_NEGOTIATION_CONSECUTIVE,
 	FETCH_NEGOTIATION_SKIPPING,
 	FETCH_NEGOTIATION_NOOP,
 };
diff --git a/t/t5500-fetch-pack.sh b/t/t5500-fetch-pack.sh
index 41ea9f25de6..ee6d2dde9f3 100755
--- a/t/t5500-fetch-pack.sh
+++ b/t/t5500-fetch-pack.sh
@@ -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' '
-- 
gitgitgadget
Previous: Junio C HamanoNext: Junio C Hamano
Message 17 of 23 in “repo-settings: fix checking for fetch.negotiationAlgorithm=default”
  1. repo-settings: fix checking for fetch.negotiationAlgorithm=defaultElijah Newren via GitGitGadget, Jan 28, 2022
  2. Ævar Arnfjörð BjarmasonJan 28, 2022
  3. Elijah NewrenJan 29, 2022
  4. Ævar Arnfjörð BjarmasonJan 29, 2022
  5. Junio C HamanoJan 31, 2022
  6. Elijah NewrenJan 31, 2022
  7. Ævar Arnfjörð BjarmasonJan 31, 2022
  8. Elijah NewrenJan 31, 2022
  9. Jonathan TanFeb 1, 2022
  10. Junio C HamanoJan 31, 2022
  11. repo-settings: fix checking for fetch.negotiationAlgorithm=defaultElijah Newren via GitGitGadget, Jan 29, 2022
  12. 0/3 repo-settings: fix checking for fetch.negotiationAlgorithm=defaultElijah Newren via GitGitGadget, Feb 1, 2022
  13. 1/3 repo-settings: fix checking for fetch.negotiationAlgorithm=defaultElijah Newren via GitGitGadget, Feb 1, 2022
  14. Junio C HamanoFeb 1, 2022
  15. 2/3 repo-settings: fix error handling for unknown valuesElijah Newren via GitGitGadget, Feb 1, 2022
  16. Junio C HamanoFeb 1, 2022
  17. 3/3 repo-settings: name the default fetch.negotiationAlgorithm 'consecutive'Elijah Newren via GitGitGadget, Feb 1, 2022
  18. Junio C HamanoFeb 1, 2022
  19. 0/3 repo-settings: fix checking for fetch.negotiationAlgorithm=defaultElijah Newren via GitGitGadget, Feb 2, 2022
  20. 1/3 repo-settings: fix checking for fetch.negotiationAlgorithm=defaultElijah Newren via GitGitGadget, Feb 2, 2022
  21. 2/3 repo-settings: fix error handling for unknown valuesElijah Newren via GitGitGadget, Feb 2, 2022
  22. 3/3 repo-settings: rename the traditional default fetch.negotiationAlgorithmElijah Newren via GitGitGadget, Feb 2, 2022
  23. Junio C HamanoFeb 2, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.