diff options
author | Jonathan Tan <jonathantanmy@google.com> | 2017-09-29 13:11:40 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-10-02 10:15:19 +0900 |
commit | cf6be78c545e9c859bc7f7634f4dc63dfd1df4de (patch) | |
tree | 8612c314daf4b1b28e672328c6f36c1836320570 | |
parent | 36d8ef878d7c811d8909698e7b3def9b1ce1b38a (diff) | |
download | git-cf6be78c545e9c859bc7f7634f4dc63dfd1df4de.tar.gz |
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 <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r-- | builtin/fsck.c | 2 | ||||
-rwxr-xr-x | t/t0410-partial-clone.sh | 13 |
2 files changed, 15 insertions, 0 deletions
diff --git a/builtin/fsck.c b/builtin/fsck.c index 4492a4fab8..f6cb4d755b 100644 --- a/builtin/fsck.c +++ b/builtin/fsck.c @@ -755,6 +755,8 @@ int cmd_fsck(int argc, const char **argv, const char *prefix) struct object *obj = lookup_object(oid.hash); if (!obj || !(obj->flags & HAS_OBJ)) { + if (is_promisor_object(&oid)) + continue; error("%s: object missing", oid_to_hex(&oid)); errors_found |= ERROR_OBJECT; continue; diff --git a/t/t0410-partial-clone.sh b/t/t0410-partial-clone.sh index 4f9931f9bb..e96f436b09 100755 --- a/t/t0410-partial-clone.sh +++ b/t/t0410-partial-clone.sh @@ -125,4 +125,17 @@ test_expect_success 'missing object, but promised, passes fsck' ' git -C repo fsck ' +test_expect_success 'missing CLI object, but promised, passes fsck' ' + rm -rf repo && + test_create_repo repo && + test_commit -C repo my_commit && + + A=$(git -C repo commit-tree -m a HEAD^{tree}) && + promise_and_delete "$A" && + + git -C repo config core.repositoryformatversion 1 && + git -C repo config extensions.partialclone "arbitrary string" && + git -C repo fsck "$A" +' + test_done |