aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--setup.c12
-rwxr-xr-xt/t0410-partial-clone.sh11
2 files changed, 20 insertions, 3 deletions
diff --git a/setup.c b/setup.c
index 597b41b822..eb066db6d8 100644
--- a/setup.c
+++ b/setup.c
@@ -507,9 +507,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) {
diff --git a/t/t0410-partial-clone.sh b/t/t0410-partial-clone.sh
index 16ad000382..463dc3a8be 100755
--- a/t/t0410-partial-clone.sh
+++ b/t/t0410-partial-clone.sh
@@ -42,6 +42,17 @@ test_expect_success 'convert shallow clone to partial clone' '
test_cmp_config -C client 1 core.repositoryformatversion
'
+test_expect_success 'convert shallow clone to partial clone must fail with any extension' '
+ rm -fr server client &&
+ test_create_repo server &&
+ test_commit -C server my_commit 1 &&
+ test_commit -C server my_commit2 1 &&
+ git clone --depth=1 "file://$(pwd)/server" client &&
+ test_cmp_config -C client 0 core.repositoryformatversion &&
+ git -C client config extensions.partialclone origin &&
+ test_must_fail git -C client fetch --unshallow --filter="blob:none"
+'
+
test_expect_success 'missing reflog object, but promised by a commit, passes fsck' '
rm -rf repo &&
test_create_repo repo &&