Skip to content

Commit 096c9b8

Browse files
jonathantanmygitster
authored andcommitted
fsck: support promisor objects as CLI argument
Teach fsck to not treat missing promisor objects provided on the CLI as an error when extensions.partialclone is set. Signed-off-by: Jonathan Tan <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent caba7fc commit 096c9b8

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

builtin/fsck.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,8 @@ int cmd_fsck(int argc, const char **argv, const char *prefix)
750750
struct object *obj = lookup_object(oid.hash);
751751

752752
if (!obj || !(obj->flags & HAS_OBJ)) {
753+
if (is_promisor_object(&oid))
754+
continue;
753755
error("%s: object missing", oid_to_hex(&oid));
754756
errors_found |= ERROR_OBJECT;
755757
continue;

t/t0410-partial-clone.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,4 +125,17 @@ test_expect_success 'missing object, but promised, passes fsck' '
125125
git -C repo fsck
126126
'
127127

128+
test_expect_success 'missing CLI object, but promised, passes fsck' '
129+
rm -rf repo &&
130+
test_create_repo repo &&
131+
test_commit -C repo my_commit &&
132+
133+
A=$(git -C repo commit-tree -m a HEAD^{tree}) &&
134+
promise_and_delete "$A" &&
135+
136+
git -C repo config core.repositoryformatversion 1 &&
137+
git -C repo config extensions.partialclone "arbitrary string" &&
138+
git -C repo fsck "$A"
139+
'
140+
128141
test_done

0 commit comments

Comments
 (0)