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
44 lines
1.4 KiB
Bash
Executable File
44 lines
1.4 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
test_description='git for-each-repo builtin'
|
|
|
|
TEST_PASSES_SANITIZE_LEAK=true
|
|
. ./test-lib.sh
|
|
|
|
test_expect_success 'run based on configured value' '
|
|
git init one &&
|
|
git init two &&
|
|
git init three &&
|
|
git init ~/four &&
|
|
git -C two commit --allow-empty -m "DID NOT RUN" &&
|
|
git config run.key "$TRASH_DIRECTORY/one" &&
|
|
git config --add run.key "$TRASH_DIRECTORY/three" &&
|
|
git config --add run.key "~/four" &&
|
|
git for-each-repo --config=run.key commit --allow-empty -m "ran" &&
|
|
git -C one log -1 --pretty=format:%s >message &&
|
|
grep ran message &&
|
|
git -C two log -1 --pretty=format:%s >message &&
|
|
! grep ran message &&
|
|
git -C three log -1 --pretty=format:%s >message &&
|
|
grep ran message &&
|
|
git -C ~/four log -1 --pretty=format:%s >message &&
|
|
grep ran message &&
|
|
git for-each-repo --config=run.key -- commit --allow-empty -m "ran again" &&
|
|
git -C one log -1 --pretty=format:%s >message &&
|
|
grep again message &&
|
|
git -C two log -1 --pretty=format:%s >message &&
|
|
! grep again message &&
|
|
git -C three log -1 --pretty=format:%s >message &&
|
|
grep again message &&
|
|
git -C ~/four log -1 --pretty=format:%s >message &&
|
|
grep again message
|
|
'
|
|
|
|
test_expect_success 'do nothing on empty config' '
|
|
# the whole thing would fail if for-each-ref iterated even
|
|
# once, because "git help --no-such-option" would fail
|
|
git for-each-repo --config=bogus.config -- help --no-such-option
|
|
'
|
|
|
|
test_done
|