1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-22 03:56:33 +02:00

list-objects: check if filter is NULL before using

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>
This commit is contained in:
Jonathan Tan 2018-06-11 14:51:26 -07:00 committed by Junio C Hamano
parent c7620bd0f3
commit cac1137dc4
2 changed files with 10 additions and 0 deletions

View 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);

View File

@ -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 &&