git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Elijah Newren via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: "Derrick Stolee" <dstolee@microsoft.com>,
	"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
	"Elijah Newren" <newren@gmail.com>,
	"Jonathan Tan" <jonathantanmy@google.com>,
	"Elijah Newren" <newren@gmail.com>,
	"Elijah Newren" <newren@gmail.com>
Subject: [PATCH v4 3/3] repo-settings: rename the traditional default fetch.negotiationAlgorithm
Date: Wed, 02 Feb 2022 03:42:40 +0000	[thread overview]
Message-ID: <7500a4d2e44008b1d8df9cc8b24b67ff973a98ae.1643773361.git.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.1131.v4.git.1643773361.gitgitgadget@gmail.com>

From: Elijah Newren <newren@gmail.com>

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>
---
 Documentation/config/fetch.txt | 25 +++++++++++++------------
 fetch-negotiator.c             |  2 +-
 repo-settings.c                |  7 +++++--
 repository.h                   |  2 +-
 t/t5500-fetch-pack.sh          |  2 +-
 5 files changed, 21 insertions(+), 17 deletions(-)

diff --git a/Documentation/config/fetch.txt b/Documentation/config/fetch.txt
index 63748c02b72..cd65d236b43 100644
--- a/Documentation/config/fetch.txt
+++ b/Documentation/config/fetch.txt
@@ -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].
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..b4fbd16cdcc 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);
@@ -81,12 +81,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);
 	}
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

  parent reply	other threads:[~2022-02-02  3:43 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-28  1:56 [PATCH] repo-settings: fix checking for fetch.negotiationAlgorithm=default Elijah Newren via GitGitGadget
2022-01-28  7:25 ` Ævar Arnfjörð Bjarmason
2022-01-29  1:40   ` Elijah Newren
2022-01-29  6:08     ` Ævar Arnfjörð Bjarmason
2022-01-31 16:57     ` Junio C Hamano
2022-01-31 17:33       ` Elijah Newren
2022-01-31 21:03         ` Ævar Arnfjörð Bjarmason
2022-01-31 21:47           ` Elijah Newren
2022-02-01 17:37             ` Jonathan Tan
2022-01-31 22:06           ` Junio C Hamano
2022-01-29 17:51 ` [PATCH v2] " Elijah Newren via GitGitGadget
2022-02-01 17:00   ` [PATCH v3 0/3] " Elijah Newren via GitGitGadget
2022-02-01 17:00     ` [PATCH v3 1/3] " Elijah Newren via GitGitGadget
2022-02-01 18:21       ` Junio C Hamano
2022-02-01 17:00     ` [PATCH v3 2/3] repo-settings: fix error handling for unknown values Elijah Newren via GitGitGadget
2022-02-01 18:21       ` Junio C Hamano
2022-02-01 17:00     ` [PATCH v3 3/3] repo-settings: name the default fetch.negotiationAlgorithm 'consecutive' Elijah Newren via GitGitGadget
2022-02-01 18:35       ` Junio C Hamano
2022-02-02  3:42     ` [PATCH v4 0/3] repo-settings: fix checking for fetch.negotiationAlgorithm=default Elijah Newren via GitGitGadget
2022-02-02  3:42       ` [PATCH v4 1/3] " Elijah Newren via GitGitGadget
2022-02-02  3:42       ` [PATCH v4 2/3] repo-settings: fix error handling for unknown values Elijah Newren via GitGitGadget
2022-02-02  3:42       ` Elijah Newren via GitGitGadget [this message]
2022-02-02 17:50         ` [PATCH v4 3/3] repo-settings: rename the traditional default fetch.negotiationAlgorithm Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7500a4d2e44008b1d8df9cc8b24b67ff973a98ae.1643773361.git.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=avarab@gmail.com \
    --cc=dstolee@microsoft.com \
    --cc=git@vger.kernel.org \
    --cc=jonathantanmy@google.com \
    --cc=newren@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).