Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2022-03-17 13:13:14 +0300
committerJunio C Hamano <gitster@pobox.com>2022-03-17 18:40:26 +0300
commitbef805b7d8eed8ab5ee20128acf636a95bcba1f2 (patch)
tree2ae941a9b1cf89f1fe81ce76b6d1a47151f8f28c /t/t7113-post-index-change-hook.sh
parent60a8a6bf6cf2cd7c8c0524c711df50dd5c2ace4f (diff)
tests: change "mkdir -p && write_script" to use "test_hook"
Change tests that used a "mkdir -p .git/hooks && write_script" pattern to use the new "test_hook" helper instead. The new helper does not create the .git/hooks directory, rather we assume that the default template will do so for us. An upcoming series[1] will extend "test_hook" to operate in a "--template=" mode, but for now assuming that we have a .git/hooks already is a safe assumption. If that assumption becomes false in the future we'll only need to change 'test_hook", instead of all of these callsites. 1. https://lore.kernel.org/git/cover-00.13-00000000000-20211212T201308Z-avarab@gmail.com/ Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t7113-post-index-change-hook.sh')
-rwxr-xr-xt/t7113-post-index-change-hook.sh7
1 files changed, 3 insertions, 4 deletions
diff --git a/t/t7113-post-index-change-hook.sh b/t/t7113-post-index-change-hook.sh
index a21781d68a..58e55a7c77 100755
--- a/t/t7113-post-index-change-hook.sh
+++ b/t/t7113-post-index-change-hook.sh
@@ -17,8 +17,7 @@ test_expect_success 'setup' '
'
test_expect_success 'test status, add, commit, others trigger hook without flags set' '
- mkdir -p .git/hooks &&
- write_script .git/hooks/post-index-change <<-\EOF &&
+ test_hook post-index-change <<-\EOF &&
if test "$1" -eq 1; then
echo "Invalid combination of flags passed to hook; updated_workdir is set." >testfailure
exit 1
@@ -63,7 +62,7 @@ test_expect_success 'test status, add, commit, others trigger hook without flags
'
test_expect_success 'test checkout and reset trigger the hook' '
- write_script .git/hooks/post-index-change <<-\EOF &&
+ test_hook post-index-change <<-\EOF &&
if test "$1" -eq 1 && test "$2" -eq 1; then
echo "Invalid combination of flags passed to hook; updated_workdir and updated_skipworktree are both set." >testfailure
exit 1
@@ -106,7 +105,7 @@ test_expect_success 'test checkout and reset trigger the hook' '
'
test_expect_success 'test reset --mixed and update-index triggers the hook' '
- write_script .git/hooks/post-index-change <<-\EOF &&
+ test_hook post-index-change <<-\EOF &&
if test "$1" -eq 1 && test "$2" -eq 1; then
echo "Invalid combination of flags passed to hook; updated_workdir and updated_skipworktree are both set." >testfailure
exit 1