summaryrefslogtreecommitdiff
path: root/list-objects-filter.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2019-10-07 02:32:54 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-10-07 02:32:54 (GMT)
commitad8f0368b45bf1ab0f1339033d0a62cee94b1ae2 (patch)
tree71a1f07b3ab935a0e2efd73b71b17bd3a4d82403 /list-objects-filter.c
parentba2d45112224a0bd5ba0f10ba180c88d148cec36 (diff)
parenta4cafc737916c2df5a52875cb1d0976662e3ab0e (diff)
downloadgit-ad8f0368b45bf1ab0f1339033d0a62cee94b1ae2.zip
git-ad8f0368b45bf1ab0f1339033d0a62cee94b1ae2.tar.gz
git-ad8f0368b45bf1ab0f1339033d0a62cee94b1ae2.tar.bz2
Merge branch 'jk/partial-clone-sparse-blob'
The name of the blob object that stores the filter specification for sparse cloning/fetching was interpreted in a wrong place in the code, causing Git to abort. * jk/partial-clone-sparse-blob: list-objects-filter: use empty string instead of NULL for sparse "base" list-objects-filter: give a more specific error sparse parsing error list-objects-filter: delay parsing of sparse oid t5616: test cloning/fetching with sparse:oid=<oid> filter
Diffstat (limited to 'list-objects-filter.c')
-rw-r--r--list-objects-filter.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/list-objects-filter.c b/list-objects-filter.c
index d624f1c..1e8d4e7 100644
--- a/list-objects-filter.c
+++ b/list-objects-filter.c
@@ -483,9 +483,17 @@ static void filter_sparse_oid__init(
struct filter *filter)
{
struct filter_sparse_data *d = xcalloc(1, sizeof(*d));
- if (add_patterns_from_blob_to_list(filter_options->sparse_oid_value,
- NULL, 0, &d->pl) < 0)
- die("could not load filter specification");
+ struct object_context oc;
+ struct object_id sparse_oid;
+
+ if (get_oid_with_context(the_repository,
+ filter_options->sparse_oid_name,
+ GET_OID_BLOB, &sparse_oid, &oc))
+ die(_("unable to access sparse blob in '%s'"),
+ filter_options->sparse_oid_name);
+ if (add_patterns_from_blob_to_list(&sparse_oid, "", 0, &d->pl) < 0)
+ die(_("unable to parse sparse filter data in %s"),
+ oid_to_hex(&sparse_oid));
ALLOC_GROW(d->array_frame, d->nr + 1, d->alloc);
d->array_frame[d->nr].default_match = 0; /* default to include */