Re: [PATCH 4/6] merge hook tests: fix and update tests

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Mar 6, 2014 at 9:50 AM, Benoit Pierre <benoit.pierre@xxxxxxxxx> wrote:
> - update 'no editor' hook test and add 'editor' hook test
> - reset tree at the beginning of failing hook tests to avoid failures
>   due to an unclean tree after running a previous test
>
> Signed-off-by: Benoit Pierre <benoit.pierre@xxxxxxxxx>
> ---
>  t/t7505-prepare-commit-msg-hook.sh | 17 ++++++++++++++++-
>  1 file changed, 16 insertions(+), 1 deletion(-)
>
> diff --git a/t/t7505-prepare-commit-msg-hook.sh b/t/t7505-prepare-commit-msg-hook.sh
> index 3573751..ae7b2db 100755
> --- a/t/t7505-prepare-commit-msg-hook.sh
> +++ b/t/t7505-prepare-commit-msg-hook.sh
> @@ -141,7 +141,19 @@ test_expect_success 'with hook (merge)' '
>         git commit -m other &&
>         git checkout - &&
>         git merge other &&
> -       test "`git log -1 --pretty=format:%s`" = merge
> +       test "`git log -1 --pretty=format:%s`" = "merge (no editor)"
> +'
> +
> +test_expect_success 'with hook and editor (merge)' '
> +
> +       head=`git rev-parse HEAD` &&
> +       git checkout -B other HEAD@{1} &&
> +       echo "more" >> file &&

Drop space after >>.

> +       git add file &&
> +       git commit -m other &&
> +       git checkout - &&

If one of the commands above this point fails, then "git checkout -"
will never be invoked, and the working tree may be left in a state
inconsistent with what following tests expect. Instead, perhaps use
test_when_finished to perform the restorative "git checkout ...".

> +       env GIT_EDITOR="\"\$FAKE_EDITOR\"" git merge -e other &&
> +       test "`git log -1 --pretty=format:%s`" = "merge"
>  '
>
>  cat > "$HOOK" <<'EOF'
> @@ -151,6 +163,7 @@ EOF
>
>  test_expect_success 'with failing hook' '
>
> +       git reset --hard &&
>         head=`git rev-parse HEAD` &&
>         echo "more" >> file &&
>         git add file &&
> @@ -160,6 +173,7 @@ test_expect_success 'with failing hook' '
>
>  test_expect_success 'with failing hook (--no-verify)' '
>
> +       git reset --hard &&
>         head=`git rev-parse HEAD` &&
>         echo "more" >> file &&
>         git add file &&
> @@ -169,6 +183,7 @@ test_expect_success 'with failing hook (--no-verify)' '
>
>  test_expect_success 'with failing hook (merge)' '
>
> +       git reset --hard &&
>         git checkout -B other HEAD@{1} &&
>         echo "more" >> file &&
>         git add file &&
> --
> 1.9.0
>
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]