Re: [PATCH 1/2] t7503: use write_script to generate hook scripts
On Tue, Nov 25, 2014 at 5:51 PM, Øystein Walle <oystwa@gmail.com> wrote:
Show 19 quoted lines
> 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"
You can drop the 'chmod' too since write_script does that for you.
Show 22 quoted lines
> @@ -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