Subject: Re: [PATCH v4] fetch: allow adding a filter after initial clone.

From: Junio C Hamano <[email-masked]>
Date: Fri, 29 May 2020 11:06:58 -0700

Jonathan Nieder <[email-masked]> writes:

>> diff --git a/t/t2404-worktree-config.sh b/t/t2404-worktree-config.sh
>> index 286121d8de..9536d10919 100755
>> --- a/t/t2404-worktree-config.sh
>> +++ b/t/t2404-worktree-config.sh
>> @@ -23,8 +23,10 @@ test_expect_success 'config --worktree without extension' '
>>  '
>>  
>>  test_expect_success 'enable worktreeConfig extension' '
>> +	git config core.repositoryformatversion 1 &&
>>  	git config extensions.worktreeConfig true &&
>
> Yes, makes sense.  Does this patch need it, or could this go in a
> separate patch?

I think it is the consequence of unrelated change in this hunk:

@@ -506,9 +510,15 @@ static int check_repository_format_gently(const char *gitdir, struct repository_
 		die("%s", err.buf);
 	}
 
-	repository_format_precious_objects = candidate->precious_objects;
-	set_repository_format_partial_clone(candidate->partial_clone);
-	repository_format_worktree_config = candidate->worktree_config;
+	if (candidate->version >= 1) {
+		repository_format_precious_objects = candidate->precious_objects;
+		set_repository_format_partial_clone(candidate->partial_clone);
+		repository_format_worktree_config = candidate->worktree_config;
+	} else {
+		repository_format_precious_objects = 0;
+		set_repository_format_partial_clone(NULL);
+		repository_format_worktree_config = 0;
+	}
 	string_list_clear(&candidate->unknown_extensions, 0);
 
 	if (repository_format_worktree_config) {

We used to honor extensions.*, as long as the version of Git
understand it, even in a repository whose version is still v0.

I am not sure if this backward incompatible change is necessary for
the purpose of "allow safe upgrade of repository format version"
topic, but as you hinted, it does smell like it belongs to a
separate (and much larger and potentially controversial) patch.

Thanks for carefully reading.