@@ -464,9 +464,13 @@ static void *filter_sparse_oid__init(
{
struct filter_sparse_data *d = xcalloc(1, sizeof(*d));
d->omits = omitted;
+ if (!filter_options->sparse_oid_value)
+ die(_("unable to read sparse filter specification from %s"),
+ filter_options->filter_spec);
if (add_excludes_from_blob_to_list(filter_options->sparse_oid_value,
NULL, 0, &d->el) < 0)
- die("could not load filter specification");
+ die(_("unable to parse sparse filter data in %s"),
+ oid_to_hex(filter_options->sparse_oid_value));
ALLOC_GROW(d->array_frame, d->nr + 1, d->alloc);
d->array_frame[d->nr].defval = 0; /* default to include */
@@ -262,6 +262,13 @@ test_expect_success 'partial clone with sparse filter succeeds' '
git clone --no-local --no-checkout --filter=sparse:oid=master:odd-files sparse-src pc-odd
'
+test_expect_success 'partial clone with unresolvable sparse filter fails cleanly' '
+ test_must_fail git clone --no-local --no-checkout --filter=sparse:oid=master:sparse-filter sparse-src sc1 2>err &&
+ test_i18ngrep "unable to read sparse filter specification from sparse:oid=master:sparse-filter" err &&
+ test_must_fail git clone --no-local --no-checkout --filter=sparse:oid=master sparse-src sc2 2>err &&
+ test_i18ngrep "unable to parse sparse filter data in $(git -C sparse-src rev-parse master)" err
+'
+
. "$TEST_DIRECTORY"/lib-httpd.sh
start_httpd