@@ -1056,6 +1056,20 @@ test_expect_success 'fetch with --filter=blob:limit=0' '
fetch_filter_blob_limit_zero server server
'
+test_expect_failure 'fetch with fsckObjects but without --lock-pack does not segfault' '
+ rm -rf server client &&
+ git init server &&
+ test_commit -C server 1 &&
+
+ git init client &&
+ # unpackLimit=1 forces to keep received pack as pack instead of
+ # unpacking it to loose objects. The code is currently segfaulting when
+ # trying to index that kept pack.
+ git -c fetch.fsckObjects=true -c fetch.unpackLimit=1 \
+ -C client fetch-pack ../server \
+ $(git -C server rev-parse refs/heads/main)
+'
+
. "$TEST_DIRECTORY"/lib-httpd.sh
start_httpd