Skip to content

Commit

Permalink
tests: assume the hooks are disabled by default
Browse files Browse the repository at this point in the history
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
f0d4d39 (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>
  • Loading branch information
avar authored and gitster committed Mar 17, 2022
1 parent 9494532 commit ee32abd
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 5 deletions.
1 change: 0 additions & 1 deletion t/t1416-ref-transaction-hooks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 &&
Expand Down
3 changes: 1 addition & 2 deletions t/t5516-fetch-push.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
}

Expand Down
2 changes: 0 additions & 2 deletions t/t7519-status-fsmonitor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ test_lazy_prereq UNTRACKED_CACHE '
'

test_expect_success 'setup' '
mkdir -p .git/hooks &&
: >tracked &&
: >modified &&
mkdir dir1 &&
Expand Down Expand Up @@ -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 &&
Expand Down

0 comments on commit ee32abd

Please sign in to comment.