9ea1378d04
Various leak fixes. * ab/various-leak-fixes: built-ins: use free() not UNLEAK() if trivial, rm dead code revert: fix parse_options_concat() leak cherry-pick: free "struct replay_opts" members rebase: don't leak on "--abort" connected.c: free the "struct packed_git" sequencer.c: fix "opts->strategy" leak in read_strategy_opts() ls-files: fix a --with-tree memory leak revision API: call graph_clear() in release_revisions() unpack-file: fix ancient leak in create_temp_file() built-ins & libs & helpers: add/move destructors, fix leaks dir.c: free "ident" and "exclude_per_dir" in "struct untracked_cache" read-cache.c: clear and free "sparse_checkout_patterns" commit: discard partial cache before (re-)reading it {reset,merge}: call discard_index() before returning tests: mark tests as passing with SANITIZE=leak
31 lines
884 B
Bash
Executable File
31 lines
884 B
Bash
Executable File
#!/bin/sh
|
|
|
|
test_description='git read-tree in partial clones'
|
|
|
|
TEST_NO_CREATE_REPO=1
|
|
TEST_PASSES_SANITIZE_LEAK=true
|
|
. ./test-lib.sh
|
|
|
|
test_expect_success 'read-tree in partial clone prefetches in one batch' '
|
|
test_when_finished "rm -rf server client trace" &&
|
|
|
|
git init server &&
|
|
echo foo >server/one &&
|
|
echo bar >server/two &&
|
|
git -C server add one two &&
|
|
git -C server commit -m "initial commit" &&
|
|
TREE=$(git -C server rev-parse HEAD^{tree}) &&
|
|
|
|
git -C server config uploadpack.allowfilter 1 &&
|
|
git -C server config uploadpack.allowanysha1inwant 1 &&
|
|
git clone --bare --filter=blob:none "file://$(pwd)/server" client &&
|
|
GIT_TRACE_PACKET="$(pwd)/trace" git -C client read-tree $TREE $TREE &&
|
|
|
|
# "done" marks the end of negotiation (once per fetch). Expect that
|
|
# only one fetch occurs.
|
|
grep "fetch> done" trace >donelines &&
|
|
test_line_count = 1 donelines
|
|
'
|
|
|
|
test_done
|