]> git.ipfire.org Git - thirdparty/git.git/commitdiff
tests: assume the hooks are disabled by default
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Thu, 17 Mar 2022 10:13:09 +0000 (11:13 +0100)
committerJunio C Hamano <gitster@pobox.com>
Thu, 17 Mar 2022 15:40:26 +0000 (08:40 -0700)
Stop moving the .git/hooks directory out of the way, or creating it
during test setup. Instead assume that it will contain
harmless *.sample files.

That we can assume that is discussed in point #4 of
f0d4d398e28 (test-lib: split up and deprecate test_create_repo(),
2021-05-10), those parts of this could and should have been done in
that change.

Removing the "mkdir -p" here will then validate that our templates are
being used, since we'd subsequently fail to create a hook in that
directory if it didn't exist. Subsequent commits will have those hooks
created by a "test_hook" wrapper, which will then being doing that
same validation.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t1416-ref-transaction-hooks.sh
t/t5516-fetch-push.sh
t/t7519-status-fsmonitor.sh

index 6fca1f08d9a11e374c686fdfd23581aa3da83a55..085a7a46f21eec03b2c757e5140b397dc34898e6 100755 (executable)
@@ -8,7 +8,6 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 . ./test-lib.sh
 
 test_expect_success setup '
-       mkdir -p .git/hooks &&
        test_commit PRE &&
        PRE_OID=$(git rev-parse PRE) &&
        test_commit POST &&
index 3137eb8d4d2613005586ad0e8d1eea606f4b81bf..1a20e54adc151c0539d4df0e5894812868ac6165 100755 (executable)
@@ -28,8 +28,7 @@ mk_empty () {
        (
                cd "$repo_name" &&
                git init &&
-               git config receive.denyCurrentBranch warn &&
-               mv .git/hooks .git/hooks-disabled
+               git config receive.denyCurrentBranch warn
        )
 }
 
index 4c7c00c94f17313a8d29fb02aead763a45afb1d6..d4f9c6a837b18075a3bff10a7c87e7932e4e46fe 100755 (executable)
@@ -56,7 +56,6 @@ test_lazy_prereq UNTRACKED_CACHE '
 '
 
 test_expect_success 'setup' '
-       mkdir -p .git/hooks &&
        : >tracked &&
        : >modified &&
        mkdir dir1 &&
@@ -322,7 +321,6 @@ test_expect_success UNTRACKED_CACHE 'ignore .git changes when invalidating UNTR'
        test_create_repo dot-git &&
        (
                cd dot-git &&
-               mkdir -p .git/hooks &&
                : >tracked &&
                test-tool chmtime =-60 tracked &&
                : >modified &&