If we fail to call the hook, we won't append to "actual_hooks".
"test_cmp" is able to handle a missing file just fine, so these
"pre-creations" are mostly confusing. Let's drop them.

Signed-off-by: Martin Ågren <martin.ag...@gmail.com>
--
 This "pre-creation" does protect against the file already
 existing, i.e., it could be seen as a "clearing". But since
 we use "test_when_finished" in this script... Also, these
 were "touch" before another of my suggestions, so these
 really were "pre-creating" these files if needed.

 t/t7503-pre-commit-and-pre-merge-commit-hooks.sh | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/t/t7503-pre-commit-and-pre-merge-commit-hooks.sh 
b/t/t7503-pre-commit-and-pre-merge-commit-hooks.sh
index 477207cb5c..f0c73fd58d 100755
--- a/t/t7503-pre-commit-and-pre-merge-commit-hooks.sh
+++ b/t/t7503-pre-commit-and-pre-merge-commit-hooks.sh
@@ -76,7 +76,6 @@ test_expect_success '--no-verify with no hook (merge)' '
 test_expect_success 'with succeeding hook' '
        test_when_finished "rm -f \"$PRECOMMIT\" expected_hooks actual_hooks" &&
        ln -s "success.sample" "$PRECOMMIT" &&
-       >actual_hooks &&
        echo "$PRECOMMIT" >expected_hooks &&
        echo "more" >>file &&
        git add file &&
@@ -87,7 +86,6 @@ test_expect_success 'with succeeding hook' '
 test_expect_success 'with succeeding hook (merge)' '
        test_when_finished "rm -f \"$PREMERGE\" expected_hooks actual_hooks" &&
        ln -s "success.sample" "$PREMERGE" &&
-       >actual_hooks &&
        echo "$PREMERGE" >expected_hooks &&
        git checkout side &&
        git merge -m "merge master" master &&
@@ -116,7 +114,6 @@ test_expect_success '--no-verify with succeeding hook 
(merge)' '
 test_expect_success 'with failing hook' '
        test_when_finished "rm -f \"$PRECOMMIT\" expected_hooks actual_hooks" &&
        ln -s "fail.sample" "$PRECOMMIT" &&
-       >actual_hooks &&
        echo "$PRECOMMIT" >expected_hooks &&
        echo "another" >>file &&
        git add file &&
@@ -136,7 +133,6 @@ test_expect_success '--no-verify with failing hook' '
 test_expect_success 'with failing hook (merge)' '
        test_when_finished "rm -f \"$PREMERGE\" expected_hooks actual_hooks" &&
        ln -s "fail.sample" "$PREMERGE" &&
-       >actual_hooks &&
        echo "$PREMERGE" >expected_hooks &&
        git checkout side &&
        test_must_fail git merge -m "merge master" master &&
-- 
2.23.0.rc0.30.g51cf315870

Reply via email to