git/t/t7423-submodule-symlinks.sh
Patrick Steinhardt fba95dad6a t: mark a bunch of tests as leak-free
There are a bunch of tests which do not have any leaks:

  - t0411: Introduced via 5c5a4a1c05 (t0411: add tests for cloning from
    partial repo, 2024-01-28), passes since its inception.

  - t0610: Introduced via 57db2a094d (refs: introduce reftable backend,
    2024-02-07), passes since its inception.

  - t2405: Passes since 6741e917de (repository: avoid leaking
    `fsmonitor` data, 2024-04-12).

  - t7423: Introduced via b20c10fd9b (t7423: add tests for symlinked
    submodule directories, 2024-01-28), passes since e8d0608944
    (submodule: require the submodule path to contain directories only,
    2024-03-26). The fix is not obviously related, but probably works
    because we now die early in many code paths.

  - t9xxx: All of these are exercising CVS-related tooling and pass
    since at least Git v2.40. It's likely that these pass for a long
    time already, but nobody ever noticed because Git developers do not
    tend to have CVS on their machines.

Mark all of these tests as passing.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2024-05-27 11:19:57 -07:00

69 lines
2.0 KiB
Bash
Executable File

#!/bin/sh
test_description='check that submodule operations do not follow symlinks'
TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'prepare' '
git config --global protocol.file.allow always &&
test_commit initial &&
git init upstream &&
test_commit -C upstream upstream submodule_file &&
git submodule add ./upstream a/sm &&
test_tick &&
git commit -m submodule
'
test_expect_success SYMLINKS 'git submodule update must not create submodule behind symlink' '
rm -rf a b &&
mkdir b &&
ln -s b a &&
test_path_is_missing b/sm &&
test_must_fail git submodule update &&
test_path_is_missing b/sm
'
test_expect_success SYMLINKS,CASE_INSENSITIVE_FS 'git submodule update must not create submodule behind symlink on case insensitive fs' '
rm -rf a b &&
mkdir b &&
ln -s b A &&
test_must_fail git submodule update &&
test_path_is_missing b/sm
'
prepare_symlink_to_repo() {
rm -rf a &&
mkdir a &&
git init a/target &&
git -C a/target fetch ../../upstream &&
ln -s target a/sm
}
test_expect_success SYMLINKS 'git restore --recurse-submodules must not be confused by a symlink' '
prepare_symlink_to_repo &&
test_must_fail git restore --recurse-submodules a/sm &&
test_path_is_missing a/sm/submodule_file &&
test_path_is_dir a/target/.git &&
test_path_is_missing a/target/submodule_file
'
test_expect_success SYMLINKS 'git restore --recurse-submodules must not migrate git dir of symlinked repo' '
prepare_symlink_to_repo &&
rm -rf .git/modules &&
test_must_fail git restore --recurse-submodules a/sm &&
test_path_is_dir a/target/.git &&
test_path_is_missing .git/modules/a/sm &&
test_path_is_missing a/target/submodule_file
'
test_expect_success SYMLINKS 'git checkout -f --recurse-submodules must not migrate git dir of symlinked repo when removing submodule' '
prepare_symlink_to_repo &&
rm -rf .git/modules &&
test_must_fail git checkout -f --recurse-submodules initial &&
test_path_is_dir a/target/.git &&
test_path_is_missing .git/modules/a/sm
'
test_done