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
This commit is contained in:
Junio C Hamano 2020-10-05 14:01:53 -07:00
commit e68f0a4e57
5 changed files with 13 additions and 9 deletions

View File

@ -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);

View File

@ -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"));

View File

@ -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;

View File

@ -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;

View File

@ -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' '