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>
Jonathan Tan committed
Jun 11, 2018 at 14:51 UTC
cac1137dc4908b03642ee10c45eb687feb9335c1
2 files changed
+10
list-objects-filter-options.c
+2
@@ -146,6 +146,8 @@ void partial_clone_get_default_filter_spec(
146
/*
147
* Parse default value, but silently ignore it if it is invalid.
148
*/
149
+ if (!core_partial_clone_filter_default)
150
+ return;
151
gently_parse_list_objects_filter(filter_options,
152
core_partial_clone_filter_default,
153
NULL);
t/t0410-partial-clone.sh
+8
@@ -23,7 +23,15 @@ promise_and_delete () {
23
delete_object repo "$HASH"
24
}
25
26
+test_expect_success 'extensions.partialclone without filter' '
27
+ test_create_repo server &&
28
+ git clone --filter="blob:none" "file://$(pwd)/server" client &&
29
+ git -C client config --unset core.partialclonefilter &&
30
+ git -C client fetch origin
31
+'
32
+
33
test_expect_success 'missing reflog object, but promised by a commit, passes fsck' '
34
+ rm -rf repo &&
35
test_create_repo repo &&
36
test_commit -C repo my_commit &&
37