summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2020-10-05 21:01:53 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-10-05 21:01:53 (GMT)
commite68f0a4e574f38beeac513e824b685965dda31b7 (patch)
tree91c653dc49ef9a5e1b9d6f5354823d93f480540c
parent300cd14ee92eaa0e56688078e967402371488013 (diff)
parent23547c40518ac04a20acf2f688114f5d97b61f24 (diff)
downloadgit-e68f0a4e574f38beeac513e824b685965dda31b7.zip
git-e68f0a4e574f38beeac513e824b685965dda31b7.tar.gz
git-e68f0a4e574f38beeac513e824b685965dda31b7.tar.bz2
Merge branch 'jt/keep-partial-clone-filter-upon-lazy-fetch'
The lazy fetching done internally to make missing objects available in a partial clone incorrectly made permanent damage to the partial clone filter in the repository, which has been corrected. * jt/keep-partial-clone-filter-upon-lazy-fetch: fetch: do not override partial clone filter promisor-remote: remove unused variable
-rw-r--r--builtin/fetch.c2
-rw-r--r--list-objects-filter-options.c10
-rw-r--r--promisor-remote.c5
-rw-r--r--promisor-remote.h2
-rwxr-xr-xt/t5601-clone.sh3
5 files changed, 13 insertions, 9 deletions
diff --git a/builtin/fetch.c b/builtin/fetch.c
index d5bf526..25fa1cf 100644
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
@@ -1684,7 +1684,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 b663145..defd3df 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/promisor-remote.c b/promisor-remote.c
index 6530e26..3c572b1 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 6343c47..c7a1406 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;
diff --git a/t/t5601-clone.sh b/t/t5601-clone.sh
index b6c8312..7df3c53 100755
--- a/t/t5601-clone.sh
+++ b/t/t5601-clone.sh
@@ -683,7 +683,8 @@ test_expect_success 'partial clone' '
test_expect_success 'partial clone with -o' '
partial_clone_server server &&
- git clone -o blah --filter=blob:limit=0 "file://$(pwd)/server" client
+ git clone -o blah --filter=blob:limit=0 "file://$(pwd)/server" client &&
+ test_cmp_config -C client "blob:limit=0" --get-all remote.blah.partialclonefilter
'
test_expect_success 'partial clone: warn if server does not support object filtering' '