git-commit-vandalism/t/t9146-git-svn-empty-dirs.sh
Ævar Arnfjörð Bjarmason e5e37517dd tests: mark tests as passing with SANITIZE=leak
This marks tests that have been leak-free since various recent
commits, but which were not marked us such when the memory leak was
fixed. These were mostly discovered with the "check" mode added in
faececa53f (test-lib: have the "check" mode for SANITIZE=leak
consider leak logs, 2022-07-28).

Commits that fixed the last memory leak in these tests. Per narrowing
down when they started to pass under SANITIZE=leak with "bisect":

- t1022-read-tree-partial-clone.sh:
  7e2619d8ff (list_objects_filter_options: plug leak of filter_spec
  strings, 2022-09-08)

- t4053-diff-no-index.sh: 07a6f94a6d (diff-no-index: release prefixed
  filenames, 2022-09-07)

- t6415-merge-dir-to-symlink.sh: bac92b1f39 (Merge branch
  'js/ort-clean-up-after-failed-merge', 2022-08-08).

- t5554-noop-fetch-negotiator.sh:
  66eede4a37 (prepare_repo_settings(): plug leak of config values,
  2022-09-08)

- t2012-checkout-last.sh, t7504-commit-msg-hook.sh,
  t91{15,46,60}-git-svn-*.sh: The in-flight "pw/rebase-no-reflog-action"
  series, upon which this is based:
  https://lore.kernel.org/git/pull.1405.git.1667575142.gitgitgadget@gmail.com/

Let's mark all of these as passing with
"TEST_PASSES_SANITIZE_LEAK=true", to have it regression tested,
including as part of the "linux-leaks" CI job.

Additionally, let's remove the "!SANITIZE_LEAK" prerequisite from
tests that now pass, these were marked as failing in:

- 77e56d55ba (diff.c: fix a double-free regression in a18d66cefb,
  2022-03-17)
- c4d1d52631 (tests: change some 'test $(git) = "x"' to test_cmp,
  2022-03-07)

These were not spotted with the new "check" mode, but manually, it
doesn't cover these sort of prerequisites. There's few enough that we
shouldn't bother to automate it. They'll be going away sooner than
later.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
2022-11-21 12:32:48 +09:00

161 lines
3.0 KiB
Bash
Executable File

#!/bin/sh
#
# Copyright (c) 2009 Eric Wong
test_description='git svn creates empty directories'
. ./lib-git-svn.sh
test_expect_success 'initialize repo' '
for i in a b c d d/e d/e/f "weird file name"
do
svn_cmd mkdir -m "mkdir $i" "$svnrepo"/"$i" || return 1
done
'
test_expect_success 'clone' 'git svn clone "$svnrepo" cloned'
test_expect_success 'empty directories exist' '
(
cd cloned &&
for i in a b c d d/e d/e/f "weird file name"
do
if ! test -d "$i"
then
echo >&2 "$i does not exist" &&
exit 1
fi
done
)
'
test_expect_success 'option automkdirs set to false' '
(
git svn init "$svnrepo" cloned-no-mkdirs &&
cd cloned-no-mkdirs &&
git config svn-remote.svn.automkdirs false &&
git svn fetch &&
for i in a b c d d/e d/e/f "weird file name"
do
if test -d "$i"
then
echo >&2 "$i exists" &&
exit 1
fi
done
)
'
test_expect_success 'more emptiness' '
svn_cmd mkdir -m "bang bang" "$svnrepo"/"! !"
'
test_expect_success 'git svn rebase creates empty directory' '
( cd cloned && git svn rebase ) &&
test -d cloned/"! !"
'
test_expect_success 'git svn mkdirs recreates empty directories' '
(
cd cloned &&
rm -r * &&
git svn mkdirs &&
for i in a b c d d/e d/e/f "weird file name" "! !"
do
if ! test -d "$i"
then
echo >&2 "$i does not exist" &&
exit 1
fi
done
)
'
test_expect_success 'git svn mkdirs -r works' '
(
cd cloned &&
rm -r * &&
git svn mkdirs -r7 &&
for i in a b c d d/e d/e/f "weird file name"
do
if ! test -d "$i"
then
echo >&2 "$i does not exist" &&
exit 1
fi
done &&
if test -d "! !"
then
echo >&2 "$i should not exist" &&
exit 1
fi &&
git svn mkdirs -r8 &&
if ! test -d "! !"
then
echo >&2 "$i not exist" &&
exit 1
fi
)
'
test_expect_success 'initialize trunk' '
for i in trunk trunk/a trunk/"weird file name"
do
svn_cmd mkdir -m "mkdir $i" "$svnrepo"/"$i" || return 1
done
'
test_expect_success 'clone trunk' 'git svn clone -s "$svnrepo" trunk'
test_expect_success 'empty directories in trunk exist' '
(
cd trunk &&
for i in a "weird file name"
do
if ! test -d "$i"
then
echo >&2 "$i does not exist" &&
exit 1
fi
done
)
'
test_expect_success 'remove a top-level directory from svn' '
svn_cmd rm -m "remove d" "$svnrepo"/d
'
test_expect_success 'removed top-level directory does not exist' '
git svn clone "$svnrepo" removed &&
test ! -e removed/d
'
unhandled=.git/svn/refs/remotes/git-svn/unhandled.log
test_expect_success 'git svn gc-ed files work' '
(
cd removed &&
git svn gc &&
: Compress::Zlib may not be available &&
if test -f "$unhandled".gz
then
svn_cmd mkdir -m gz "$svnrepo"/gz &&
git reset --hard $(git rev-list HEAD | tail -1) &&
git svn rebase &&
test -f "$unhandled".gz &&
test -f "$unhandled" &&
for i in a b c "weird file name" gz "! !"
do
if ! test -d "$i"
then
echo >&2 "$i does not exist" &&
exit 1
fi
done
fi
)
'
test_done