]> git.ipfire.org Git - thirdparty/git.git/commitdiff
list-objects-filter: give a more specific error sparse parsing error
authorJon Simons <jon@jonsimons.org>
Sun, 15 Sep 2019 01:13:47 +0000 (21:13 -0400)
committerJunio C Hamano <gitster@pobox.com>
Mon, 16 Sep 2019 19:47:45 +0000 (12:47 -0700)
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>
list-objects-filter.c
t/t5616-partial-clone.sh

index d2cdc03a73d93c2c24da0aa690c575cbcf6152bd..50f0c6d07bc1c5de698ebbded98a98da708f1791 100644 (file)
@@ -469,11 +469,12 @@ static void *filter_sparse_oid__init(
        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'",
+               die(_("unable to access sparse blob in '%s'"),
                    filter_options->sparse_oid_name);
        d->omits = omitted;
        if (add_excludes_from_blob_to_list(&sparse_oid, NULL, 0, &d->el) < 0)
-               die("could not load filter specification");
+               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].defval = 0; /* default to include */
index 84365b802a8ea7cfa710140fb692136ddc78c1c2..b85d3f5e4cb66ae74cd1864c09d3e7c3475eb799 100755 (executable)
@@ -274,7 +274,7 @@ test_expect_success 'partial clone with unresolvable sparse filter fails cleanly
        test_must_fail git clone --no-local --bare \
                                 --filter=sparse:oid=master \
                                 sparse-src dst.git 2>err &&
-       test_i18ngrep "could not load filter specification" err
+       test_i18ngrep "unable to parse sparse filter data in" err
 '
 
 . "$TEST_DIRECTORY"/lib-httpd.sh