list-objects-filter: give a more specific error sparse parsing error

The sparse:oid filter has two error modes: we might fail to resolve the name to an OID, or we might fail to parse the contents of that OID. In the latter case, let's give a less generic error message, and mention the OID we did find. While we're here, let's also mark both messages as translatable. Signed-off-by: Jeff King <peff@peff.net> Acked-by: Jeff Hostetler <jeffhost@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jon Simons committed Sep 14, 2019 at 21:13 UTC cf34337f9886bb45f16f0114dc8f3265aea912ce
2 files changed +4 -3
list-objects-filter.c
+3 -2
@@ -469,11 +469,12 @@ static void *filter_sparse_oid__init(
469 if (get_oid_with_context(the_repository,
470 filter_options->sparse_oid_name,
471 GET_OID_BLOB, &sparse_oid, &oc))
472 - die("unable to access sparse blob in '%s'",
472 + die(_("unable to access sparse blob in '%s'"),
473 filter_options->sparse_oid_name);
474 d->omits = omitted;
475 if (add_excludes_from_blob_to_list(&sparse_oid, NULL, 0, &d->el) < 0)
476 - die("could not load filter specification");
476 + die(_("unable to parse sparse filter data in %s"),
477 + oid_to_hex(&sparse_oid));
478
479 ALLOC_GROW(d->array_frame, d->nr + 1, d->alloc);
480 d->array_frame[d->nr].defval = 0; /* default to include */
t/t5616-partial-clone.sh
+1 -1
@@ -274,7 +274,7 @@ test_expect_success 'partial clone with unresolvable sparse filter fails cleanly
274 test_must_fail git clone --no-local --bare \
275 --filter=sparse:oid=master \
276 sparse-src dst.git 2>err &&
277 - test_i18ngrep "could not load filter specification" err
277 + test_i18ngrep "unable to parse sparse filter data in" err
278 '
279
280 . "$TEST_DIRECTORY"/lib-httpd.sh