From patchwork Tue Sep 22 03:03:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Tan X-Patchwork-Id: 11791453 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 195EA112C for ; Tue, 22 Sep 2020 03:04:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F1A8623A1D for ; Tue, 22 Sep 2020 03:04:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="ttGtaSYF" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726982AbgIVDEF (ORCPT ); Mon, 21 Sep 2020 23:04:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726594AbgIVDED (ORCPT ); Mon, 21 Sep 2020 23:04:03 -0400 Received: from mail-pj1-x104a.google.com (mail-pj1-x104a.google.com [IPv6:2607:f8b0:4864:20::104a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F1CDDC061755 for ; Mon, 21 Sep 2020 20:04:02 -0700 (PDT) Received: by mail-pj1-x104a.google.com with SMTP id f9so1132642pjp.1 for ; Mon, 21 Sep 2020 20:04:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:in-reply-to:message-id:mime-version:references:subject :from:to:cc; bh=Nav9ruYX5IoQSDu938hK2WzbTgq4nFFeMaVC7jH/qVI=; b=ttGtaSYFG56LOMiWcuDT5thcvrfyaM/7hotMnLiYfOhRquDyHewEO9kWS+x1HivEp4 DPNF0nAvhPlgWQCtjsehOh6jF7f7mUPN7qYyGgkK/nx8k8ZyJrMLAcGZyK/Z4+S/6zOp CX4v/hlzsqpYcOpAVraEBfaUHokwzqYkJqgVGBJcDle3myBeR2mIMFhfcreqjdQOA+1D VI1wAIpY9xmPZNj1/Je2rVClNfObGrN/Fag3sX31f7UZb1vJ5GqidiNGtc5TdITXkI1S cs5kuG5YjVNtpJAqlAFn3j1AoO1/84NZKEghi97VI/bkNrMj4A9+1xz7O7/TWHioQjDP yp9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=Nav9ruYX5IoQSDu938hK2WzbTgq4nFFeMaVC7jH/qVI=; b=ILb3pKKSbTv+08r4B3lVAWvHhWd0OShoxP6vRaBghHzY+2hSyb2kxvtd85TUW9EIsg oYZIU5p9XpYrS/kuv9Mor8gFzj/YrWlfhZ1bV/cE4YrG8sLFBkwd59h9oSyHFdR2KNHh Ot+ZVbI/4vFucC5czcsXfmG+Bwl3SiTYTxEyZPwhcm0W/0NYmu9HaDOLThVyaAffZitH wIwoq6prUaSssdWAhBIN7uVkloDWruqQnebjOOF+REJHRFLkQIUwyrAdXMfOoLvaHR0T DI1zd6WUZZiw9VRLaDho4zlgMvsdFycZAHn9L7dt1XWPGl4TKzErNCHJGW2wQX6MB1Uo 4Gzw== X-Gm-Message-State: AOAM5316R9R3ZVzLFMt+pQtcqx0rT/N+gTKEtH8XzxW/RWePcu3gZi4y RHQ58D0SjL2IoK807u/x0UGQkfW3ik1McxAfXZwjoWhwVIsWwaR0hL+/z8nCC4alI1SeKQx/FCa 1WweUw/JP+kDVdUdKHTOquiLsNLs9GaxksHXTLzA7alf6+1CfGaXfGG5Z/PZ9ZfWvXfcQ22Zra0 4k X-Google-Smtp-Source: ABdhPJxKvBcdU/G40XWtnjpMSi9qK0wCjKrJ5ttl9KS13i/UYAVy9VUzBRRIlEDnnzJmkTHSWBf590yF6YsOWwIZkx9y Sender: "jonathantanmy via sendgmr" X-Received: from twelve4.c.googlers.com ([fda3:e722:ac3:10:24:72f4:c0a8:18d]) (user=jonathantanmy job=sendgmr) by 2002:a65:42c9:: with SMTP id l9mr1855141pgp.41.1600743842254; Mon, 21 Sep 2020 20:04:02 -0700 (PDT) Date: Mon, 21 Sep 2020 20:03:56 -0700 In-Reply-To: Message-Id: Mime-Version: 1.0 References: X-Mailer: git-send-email 2.28.0.681.g6f77f65b4e-goog Subject: [PATCH 1/2] promisor-remote: remove unused variable From: Jonathan Tan To: git@vger.kernel.org Cc: Jonathan Tan , chriscool@tuxfamily.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The variable core_partial_clone_filter_default has been unused since fa3d1b63e8 ("promisor-remote: parse remote.*.partialclonefilter", 2019-06-25), when Git was changed to refer to remote.*.partialclonefilter as the default filter when fetching in a partial clone, but (perhaps inadvertently) there was no fallback to core.partialclonefilter. One alternative is to add the fallback, but the aforementioned change was made more than a year ago and I have not heard of any complaints regarding this matter. In addition, there is currently no mention of core.partialclonefilter in the user documentation. So it seems best to reaffirm that Git will only support remote.*.partialclonefilter. Signed-off-by: Jonathan Tan --- promisor-remote.c | 5 ----- promisor-remote.h | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/promisor-remote.c b/promisor-remote.c index 6530e26f98..3c572b1c81 100644 --- a/promisor-remote.c +++ b/promisor-remote.c @@ -6,7 +6,6 @@ #include "strvec.h" static char *repository_format_partial_clone; -static const char *core_partial_clone_filter_default; void set_repository_format_partial_clone(char *partial_clone) { @@ -100,10 +99,6 @@ static int promisor_remote_config(const char *var, const char *value, void *data size_t namelen; const char *subkey; - if (!strcmp(var, "core.partialclonefilter")) - return git_config_string(&core_partial_clone_filter_default, - var, value); - if (parse_config_key(var, "remote", &name, &namelen, &subkey) < 0) return 0; diff --git a/promisor-remote.h b/promisor-remote.h index 6343c47d18..c7a14063c5 100644 --- a/promisor-remote.h +++ b/promisor-remote.h @@ -9,7 +9,7 @@ struct object_id; * Promisor remote linked list * * Information in its fields come from remote.XXX config entries or - * from extensions.partialclone or core.partialclonefilter. + * from extensions.partialclone. */ struct promisor_remote { struct promisor_remote *next; From patchwork Tue Sep 22 03:03:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Tan X-Patchwork-Id: 11791451 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 368B0112C for ; Tue, 22 Sep 2020 03:04:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1AE0423A1B for ; Tue, 22 Sep 2020 03:04:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="sCpHn6RY" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727030AbgIVDEF (ORCPT ); Mon, 21 Sep 2020 23:04:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726763AbgIVDEE (ORCPT ); Mon, 21 Sep 2020 23:04:04 -0400 Received: from mail-pf1-x44a.google.com (mail-pf1-x44a.google.com [IPv6:2607:f8b0:4864:20::44a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C735DC0613CF for ; Mon, 21 Sep 2020 20:04:04 -0700 (PDT) Received: by mail-pf1-x44a.google.com with SMTP id s204so10170764pfs.18 for ; Mon, 21 Sep 2020 20:04:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:in-reply-to:message-id:mime-version:references:subject :from:to:cc; bh=eyMRYlTllKidF8RTGExmefcXc9eTpX6VroACkw+yrOQ=; b=sCpHn6RYQbzv5ye4ihvXyb0bmrThx2nW6cdvXozk9s+U+WVJw5p11ZJJ1JBUohCUyE 8xBMZ2PxEbO7ItqH9s3/+LQtkoiv9RvIU1sf3c3/USzyrURwtPaZqsNKRA2I/aFc/tog fWW9qDWb8or1Z08ifqpzBVn9FcMVi5/C5OXnhQG94fM6oqbOVyMsDenW4aDu8MxpBs4T 2eRmy654RI2ruLDisgCmcNr4yDNsVXHO+xVs5eDJPXr/rB/eIuCcDTydGCiKejqR2qUp D4AyfWGXx4ZP2mR7mLfVNKLOKNxvYi4gP0O3P8tSCb9t8h7Uy6j9XXjQT7zACReYvueX w47g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=eyMRYlTllKidF8RTGExmefcXc9eTpX6VroACkw+yrOQ=; b=YIjHiLbbqIEYbswR1X0syddElWka2My0stPHA2Nrlsvo08TQtzk+yA80bDmlFUssjQ 3QXut6KL/BAI7Yse7lMGD1Q2S4ipUxf6kJc0f3C5I10oK7ehnIBEvWY2/P/CpGnC+Q+b ZYDpx5jjjYVxDMrL5pdzR3tq0jiXCah9mYpAOzS/RJ6X2KAP+fbYGhK2jQEmetv+ZHey 6HZYjXVv9cifcO8OZGv4nhfpktPETfN1SmIBtp/f+i/KvZBuecjDX9b16EyaQQAav/7X MTrnWPCcRYH11LpWi+jvgGJW4NEvqNDXUOhTh/jOrIooMo3LWJr8llqX8/XShJRM1TPl mAPA== X-Gm-Message-State: AOAM531/Yew8gSPpU68b1cp25hHH3CApAzYzE74edeyGprkha3Aa39Uc tmSSxRpVkuM03gzOs5F+DYD0n3CKJtzE3vH9bObXMK18Wp3SZ3bxd3CYvKwKXT+VYDnpDP99GXN bYR7wTSROE8/bqBEnnsxT74aWLOXcAcH8AGaPNaejmMFH67jtwQEZcjlGOMdQuQLnJNxlGkaL78 Lr X-Google-Smtp-Source: ABdhPJxTRWi1psR4U6tpBA9QU8/L6lW9fbS0HjaTip4fjsOS5mRlypED+EmFZvaInUTLWRUndfUTaOFfweeRvaJZPfn4 Sender: "jonathantanmy via sendgmr" X-Received: from twelve4.c.googlers.com ([fda3:e722:ac3:10:24:72f4:c0a8:18d]) (user=jonathantanmy job=sendgmr) by 2002:a17:90a:fe07:: with SMTP id ck7mr2018215pjb.20.1600743844102; Mon, 21 Sep 2020 20:04:04 -0700 (PDT) Date: Mon, 21 Sep 2020 20:03:57 -0700 In-Reply-To: Message-Id: <070a717aabbac31ae44567dbe54a325029f9931f.1600743698.git.jonathantanmy@google.com> Mime-Version: 1.0 References: X-Mailer: git-send-email 2.28.0.681.g6f77f65b4e-goog Subject: [PATCH 2/2] fetch: do not override partial clone filter From: Jonathan Tan To: git@vger.kernel.org Cc: Jonathan Tan , chriscool@tuxfamily.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org 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=" 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 --- builtin/fetch.c | 2 +- list-objects-filter-options.c | 10 +++++++++- t/t5601-clone.sh | 5 +++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/builtin/fetch.c b/builtin/fetch.c index a6d3268661..752148eec5 100644 --- a/builtin/fetch.c +++ b/builtin/fetch.c @@ -1677,7 +1677,7 @@ static inline void fetch_one_setup_partial(struct remote *remote) * 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. + * remote if there is currently no default filter-spec. */ if (filter_options.choice) { partial_clone_register(remote->name, &filter_options); 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")); diff --git a/t/t5601-clone.sh b/t/t5601-clone.sh index 15fb64c18d..7c5cf5a2ec 100755 --- a/t/t5601-clone.sh +++ b/t/t5601-clone.sh @@ -672,6 +672,11 @@ test_expect_success 'partial clone with -o' ' git clone -o blah --filter=blob:limit=0 "file://$(pwd)/server" client ' +test_expect_success 'ensure that filter is written to config' ' + FILTER=$(git -C client config --get remote.blah.partialclonefilter) && + test "$FILTER" == "blob:limit=0" +' + test_expect_success 'partial clone: warn if server does not support object filtering' ' rm -rf server client && test_create_repo server &&