git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 1/2] t7503: use write_script to generate hook scripts

From
Øystein Walle <oystwa@gmail.com>
Date
Nov 25, 2014, 22:51 UTC
Message-ID
<78f25aaa60554f7e3b917c565df0f89fb9c08921.1416955873.git.oystwa@gmail.com>
In-Reply-To
<cover.1416953772.git.oystwa@gmail.com>
Signed-off-by: Øystein Walle <oystwa@gmail.com>
---
 t/t7503-pre-commit-hook.sh | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/t/t7503-pre-commit-hook.sh b/t/t7503-pre-commit-hook.sh
index 984889b..99ed967 100755
--- a/t/t7503-pre-commit-hook.sh
+++ b/t/t7503-pre-commit-hook.sh
@@ -24,8 +24,7 @@ test_expect_success '--no-verify with no hook' '
 HOOKDIR="$(git rev-parse --git-dir)/hooks"
 HOOK="$HOOKDIR/pre-commit"
 mkdir -p "$HOOKDIR"
-cat > "$HOOK" <<EOF
-#!/bin/sh
+write_script "$HOOK" <<EOF
 exit 0
 EOF
 chmod +x "$HOOK"
@@ -47,8 +46,7 @@ test_expect_success '--no-verify with succeeding hook' '
 '
 
 # now a hook that fails
-cat > "$HOOK" <<EOF
-#!/bin/sh
+write_script "$HOOK" <<EOF
 exit 1
 EOF
 
@@ -88,8 +86,7 @@ chmod +x "$HOOK"
 
 # a hook that checks $GIT_PREFIX and succeeds inside the
 # success/ subdirectory only
-cat > "$HOOK" <<EOF
-#!/bin/sh
+write_script "$HOOK" <<EOF
 test \$GIT_PREFIX = success/
 EOF
 
-- 
2.2.0.rc3
Previous: Øystein WalleNext: Eric Sunshine
Message 2 of 13 in “pre-commit hook updates”
  1. 0/2 pre-commit hook updatesØystein Walle, Nov 25, 2014
  2. 1/2 t7503: use write_script to generate hook scriptsØystein Walle, Nov 25, 2014
  3. Eric SunshineNov 26, 2014
  4. Jeff KingNov 26, 2014
  5. Junio C HamanoNov 26, 2014
  6. Jeff KingNov 26, 2014
  7. Junio C HamanoNov 26, 2014
  8. 2/2 commit: inform pre-commit that --amend was usedØystein Walle, Nov 25, 2014
  9. Eric SunshineNov 26, 2014
  10. Eric SunshineNov 26, 2014
  11. Jeff KingNov 26, 2014
  12. Junio C HamanoNov 26, 2014
  13. Jeff KingNov 26, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.