summaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--t/helper/test-path-utils.c10
-rwxr-xr-xt/t0060-path-utils.sh41
-rwxr-xr-xt/t1350-config-hooks-path.sh7
-rwxr-xr-xt/t1450-fsck.sh37
-rwxr-xr-xt/t1800-hook.sh15
-rwxr-xr-xt/t5601-clone.sh51
6 files changed, 7 insertions, 154 deletions
diff --git a/t/helper/test-path-utils.c b/t/helper/test-path-utils.c
index 023ed2e..bf0e23e 100644
--- a/t/helper/test-path-utils.c
+++ b/t/helper/test-path-utils.c
@@ -501,16 +501,6 @@ int cmd__path_utils(int argc, const char **argv)
return !!res;
}
- if (argc == 4 && !strcmp(argv[1], "do_files_match")) {
- int ret = do_files_match(argv[2], argv[3]);
-
- if (ret)
- printf("equal\n");
- else
- printf("different\n");
- return !ret;
- }
-
fprintf(stderr, "%s: unknown function name: %s\n", argv[0],
argv[1] ? argv[1] : "(there was none)");
return 1;
diff --git a/t/t0060-path-utils.sh b/t/t0060-path-utils.sh
index 85686ee..0afa3d0 100755
--- a/t/t0060-path-utils.sh
+++ b/t/t0060-path-utils.sh
@@ -610,45 +610,4 @@ test_expect_success !VALGRIND,RUNTIME_PREFIX,CAN_EXEC_IN_PWD '%(prefix)/ works'
test_cmp expect actual
'
-test_expect_success 'do_files_match()' '
- test_seq 0 10 >0-10.txt &&
- test_seq -1 10 >-1-10.txt &&
- test_seq 1 10 >1-10.txt &&
- test_seq 1 9 >1-9.txt &&
- test_seq 0 8 >0-8.txt &&
-
- test-tool path-utils do_files_match 0-10.txt 0-10.txt >out &&
-
- assert_fails() {
- test_must_fail \
- test-tool path-utils do_files_match "$1" "$2" >out &&
- grep different out
- } &&
-
- assert_fails 0-8.txt 1-9.txt &&
- assert_fails -1-10.txt 0-10.txt &&
- assert_fails 1-10.txt 1-9.txt &&
- assert_fails 1-10.txt .git &&
- assert_fails does-not-exist 1-10.txt &&
-
- if test_have_prereq FILEMODE
- then
- cp 0-10.txt 0-10.x &&
- chmod a+x 0-10.x &&
- assert_fails 0-10.txt 0-10.x
- fi &&
-
- if test_have_prereq SYMLINKS
- then
- ln -sf 0-10.txt symlink &&
- ln -s 0-10.txt another-symlink &&
- ln -s over-the-ocean yet-another-symlink &&
- ln -s "$PWD/0-10.txt" absolute-symlink &&
- assert_fails 0-10.txt symlink &&
- test-tool path-utils do_files_match symlink another-symlink &&
- assert_fails symlink yet-another-symlink &&
- assert_fails symlink absolute-symlink
- fi
-'
-
test_done
diff --git a/t/t1350-config-hooks-path.sh b/t/t1350-config-hooks-path.sh
index f6dc83e..45a0492 100755
--- a/t/t1350-config-hooks-path.sh
+++ b/t/t1350-config-hooks-path.sh
@@ -41,4 +41,11 @@ test_expect_success 'git rev-parse --git-path hooks' '
test .git/custom-hooks/abc = "$(cat actual)"
'
+test_expect_success 'core.hooksPath=/dev/null' '
+ git clone -c core.hooksPath=/dev/null . no-templates &&
+ value="$(git -C no-templates config --local core.hooksPath)" &&
+ # The Bash used by Git for Windows rewrites `/dev/null` to `nul`
+ { test /dev/null = "$value" || test nul = "$value"; }
+'
+
test_done
diff --git a/t/t1450-fsck.sh b/t/t1450-fsck.sh
index 173b4fa..8a456b1 100755
--- a/t/t1450-fsck.sh
+++ b/t/t1450-fsck.sh
@@ -1060,41 +1060,4 @@ test_expect_success 'fsck reports problems in current worktree index without fil
test_cmp expect actual
'
-test_expect_success 'fsck warning on symlink target with excessive length' '
- symlink_target=$(printf "pattern %032769d" 1 | git hash-object -w --stdin) &&
- test_when_finished "remove_object $symlink_target" &&
- tree=$(printf "120000 blob %s\t%s\n" $symlink_target symlink | git mktree) &&
- test_when_finished "remove_object $tree" &&
- cat >expected <<-EOF &&
- warning in blob $symlink_target: symlinkTargetLength: symlink target too long
- EOF
- git fsck --no-dangling >actual 2>&1 &&
- test_cmp expected actual
-'
-
-test_expect_success 'fsck warning on symlink target pointing inside git dir' '
- gitdir=$(printf ".git" | git hash-object -w --stdin) &&
- ntfs_gitdir=$(printf "GIT~1" | git hash-object -w --stdin) &&
- hfs_gitdir=$(printf ".${u200c}git" | git hash-object -w --stdin) &&
- inside_gitdir=$(printf "nested/.git/config" | git hash-object -w --stdin) &&
- benign_target=$(printf "legit/config" | git hash-object -w --stdin) &&
- tree=$(printf "120000 blob %s\t%s\n" \
- $benign_target benign_target \
- $gitdir gitdir \
- $hfs_gitdir hfs_gitdir \
- $inside_gitdir inside_gitdir \
- $ntfs_gitdir ntfs_gitdir |
- git mktree) &&
- for o in $gitdir $ntfs_gitdir $hfs_gitdir $inside_gitdir $benign_target $tree
- do
- test_when_finished "remove_object $o" || return 1
- done &&
- printf "warning in blob %s: symlinkPointsToGitDir: symlink target points to git dir\n" \
- $gitdir $hfs_gitdir $inside_gitdir $ntfs_gitdir |
- sort >expected &&
- git fsck --no-dangling >actual 2>&1 &&
- sort actual >actual.sorted &&
- test_cmp expected actual.sorted
-'
-
test_done
diff --git a/t/t1800-hook.sh b/t/t1800-hook.sh
index 1894ebe..8b0234c 100755
--- a/t/t1800-hook.sh
+++ b/t/t1800-hook.sh
@@ -185,19 +185,4 @@ test_expect_success 'stdin to hooks' '
test_cmp expect actual
'
-test_expect_success 'clone protections' '
- test_config core.hooksPath "$(pwd)/my-hooks" &&
- mkdir -p my-hooks &&
- write_script my-hooks/test-hook <<-\EOF &&
- echo Hook ran $1
- EOF
-
- git hook run test-hook 2>err &&
- test_grep "Hook ran" err &&
- test_must_fail env GIT_CLONE_PROTECTION_ACTIVE=true \
- git hook run test-hook 2>err &&
- test_grep "active .core.hooksPath" err &&
- test_grep ! "Hook ran" err
-'
-
test_done
diff --git a/t/t5601-clone.sh b/t/t5601-clone.sh
index deb1c28..cc0b953 100755
--- a/t/t5601-clone.sh
+++ b/t/t5601-clone.sh
@@ -788,57 +788,6 @@ test_expect_success 'batch missing blob request does not inadvertently try to fe
git clone --filter=blob:limit=0 "file://$(pwd)/server" client
'
-test_expect_success 'clone with init.templatedir runs hooks' '
- git init tmpl/hooks &&
- write_script tmpl/hooks/post-checkout <<-EOF &&
- echo HOOK-RUN >&2
- echo I was here >hook.run
- EOF
- git -C tmpl/hooks add . &&
- test_tick &&
- git -C tmpl/hooks commit -m post-checkout &&
-
- test_when_finished "git config --global --unset init.templateDir || :" &&
- test_when_finished "git config --unset init.templateDir || :" &&
- (
- sane_unset GIT_TEMPLATE_DIR &&
- NO_SET_GIT_TEMPLATE_DIR=t &&
- export NO_SET_GIT_TEMPLATE_DIR &&
-
- git -c core.hooksPath="$(pwd)/tmpl/hooks" \
- clone tmpl/hooks hook-run-hookspath 2>err &&
- test_grep ! "active .* hook found" err &&
- test_path_is_file hook-run-hookspath/hook.run &&
-
- git -c init.templateDir="$(pwd)/tmpl" \
- clone tmpl/hooks hook-run-config 2>err &&
- test_grep ! "active .* hook found" err &&
- test_path_is_file hook-run-config/hook.run &&
-
- git clone --template=tmpl tmpl/hooks hook-run-option 2>err &&
- test_grep ! "active .* hook found" err &&
- test_path_is_file hook-run-option/hook.run &&
-
- git config --global init.templateDir "$(pwd)/tmpl" &&
- git clone tmpl/hooks hook-run-global-config 2>err &&
- git config --global --unset init.templateDir &&
- test_grep ! "active .* hook found" err &&
- test_path_is_file hook-run-global-config/hook.run &&
-
- # clone ignores local `init.templateDir`; need to create
- # a new repository because we deleted `.git/` in the
- # `setup` test case above
- git init local-clone &&
- cd local-clone &&
-
- git config init.templateDir "$(pwd)/../tmpl" &&
- git clone ../tmpl/hooks hook-run-local-config 2>err &&
- git config --unset init.templateDir &&
- test_grep ! "active .* hook found" err &&
- test_path_is_missing hook-run-local-config/hook.run
- )
-'
-
. "$TEST_DIRECTORY"/lib-httpd.sh
start_httpd