Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Tan <jonathantanmy@google.com>2020-09-29 01:26:38 +0300
committerJunio C Hamano <gitster@pobox.com>2020-09-29 02:11:59 +0300
commit23547c40518ac04a20acf2f688114f5d97b61f24 (patch)
tree83863e1707a8a30b70d09d9c3fc4aff71239d66c /list-objects-filter-options.c
parent625e7f148e46c7e09f817ce6ab25f14d4e753f1e (diff)
fetch: do not override partial clone filter
When a fetch with the --filter argument is made, the configured default filter is set even if one already exists. This change was made in 5e46139376 ("builtin/fetch: remove unique promisor remote limitation", 2019-06-25) - in particular, changing from: * If this is the FIRST partial-fetch request, we enable partial * on this repo and remember the given filter-spec as the default * for subsequent fetches to this remote. to: * If this is a partial-fetch request, we enable partial on * this repo if not already enabled and remember the given * filter-spec as the default for subsequent fetches to this * remote. (The given filter-spec is "remembered" even if there is already an existing one.) This is problematic whenever a lazy fetch is made, because lazy fetches are made using "git fetch --filter=blob:none", but this will also happen if the user invokes "git fetch --filter=<filter>" manually. Therefore, restore the behavior prior to 5e46139376, which writes a filter-spec only if the current fetch request is the first partial-fetch one (for that remote). Signed-off-by: Jonathan Tan <jonathantanmy@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'list-objects-filter-options.c')
-rw-r--r--list-objects-filter-options.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/list-objects-filter-options.c b/list-objects-filter-options.c
index b66314560a..defd3dfd10 100644
--- a/list-objects-filter-options.c
+++ b/list-objects-filter-options.c
@@ -344,11 +344,19 @@ void partial_clone_register(
const char *remote,
struct list_objects_filter_options *filter_options)
{
+ struct promisor_remote *promisor_remote;
char *cfg_name;
char *filter_name;
/* Check if it is already registered */
- if (!promisor_remote_find(remote)) {
+ if ((promisor_remote = promisor_remote_find(remote))) {
+ if (promisor_remote->partial_clone_filter)
+ /*
+ * Remote is already registered and a filter is already
+ * set, so we don't need to do anything here.
+ */
+ return;
+ } else {
if (upgrade_repository_format(1) < 0)
die(_("unable to upgrade repository format to support partial clone"));