]> git.ipfire.org Git - thirdparty/git.git/commitdiff
list-objects: check if filter is NULL before using
authorJonathan Tan <jonathantanmy@google.com>
Mon, 11 Jun 2018 21:51:26 +0000 (14:51 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 12 Jun 2018 17:46:56 +0000 (10:46 -0700)
In partial_clone_get_default_filter_spec(), the
core_partial_clone_filter_default variable may be NULL; ensure that it
is not NULL before using it.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
list-objects-filter-options.c
t/t0410-partial-clone.sh

index 6a3cc985c45e751dd0c3f37880cf0bfd205ef088..c0e2bd6a06a27b6056364c43b003d74539fd6cad 100644 (file)
@@ -146,6 +146,8 @@ void partial_clone_get_default_filter_spec(
        /*
         * Parse default value, but silently ignore it if it is invalid.
         */
+       if (!core_partial_clone_filter_default)
+               return;
        gently_parse_list_objects_filter(filter_options,
                                         core_partial_clone_filter_default,
                                         NULL);
index cc18b75c03880eb9018b0d37aa9a26f7964dcee7..4984ca583d03a7cc0a6fb9323799e776eee4565b 100755 (executable)
@@ -23,7 +23,15 @@ promise_and_delete () {
        delete_object repo "$HASH"
 }
 
+test_expect_success 'extensions.partialclone without filter' '
+       test_create_repo server &&
+       git clone --filter="blob:none" "file://$(pwd)/server" client &&
+       git -C client config --unset core.partialclonefilter &&
+       git -C client fetch origin
+'
+
 test_expect_success 'missing reflog object, but promised by a commit, passes fsck' '
+       rm -rf repo &&
        test_create_repo repo &&
        test_commit -C repo my_commit &&