public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Matthieu Moy <Matthieu.Moy@grenoble-inp•fr>
To: Ryan Biesemeyer <ryan@yaauie•com>
Cc: git@vger•kernel.org, "Junio C Hamano" <gitster@pobox•com>,
	"Nguyễn Thái Ngọc Duy" <pclouds@gmail•com>,
	"Jeff King" <peff@peff•net>,
	"Ævar Arnfjörð Bjarmason" <avarab@gmail•com>,
	"Jonathan Nieder" <jrnieder@gmail•com>
Subject: Re: [PATCH] merge: make merge state available to prepare-commit-msg hook
Date: Wed, 08 Jan 2014 21:06:05 +0100	[thread overview]
Message-ID: <vpqr48ip7bm.fsf@anie.imag.fr> (raw)
In-Reply-To: <DA9E6645-82DC-4714-845F-423726F96A40@yaauie.com> (Ryan Biesemeyer's message of "Wed, 8 Jan 2014 19:02:57 +0000")

Ryan Biesemeyer <ryan@yaauie•com> writes:

> index 3573751..89cdfe8 100755
> --- a/t/t7505-prepare-commit-msg-hook.sh
> +++ b/t/t7505-prepare-commit-msg-hook.sh
> @@ -181,5 +181,27 @@ test_expect_success 'with failing hook (merge)' '
>  	test_must_fail git merge other
>  
>  '
> +git merge --abort # cleanup, since the merge failed.

Please, avoid having code outside a test_expect_* (see t/README, " - Put
all code inside test_expect_success and other assertions.").

> +test_expect_success 'should have MERGE_HEAD (merge)' '
> +
> +	git checkout -B other HEAD@{1} &&
> +	echo "more" >> file &&
> +	git add file &&
> +	rm -f "$HOOK" &&
> +	git commit -m other &&
> +	git checkout - &&
> +	write_script "$HOOK" <<-EOF
> +	if [ -s "$(git rev-parse --git-dir)/MERGE_HEAD" ]; then
> +		exit 0
> +	else
> +		exit 1
> +	fi
> +	EOF

I think you lack one && for the write_script line.

There's another instance in the same file (probably where you got it
from), you should add this to your patch series:

>From c3d754a2a16d98b31d43a7e45973821ae8adc043 Mon Sep 17 00:00:00 2001
From: Matthieu Moy <Matthieu.Moy@imag•fr>
Date: Wed, 8 Jan 2014 21:03:27 +0100
Subject: [PATCH] t7505: add missing &&

---
 t/t7505-prepare-commit-msg-hook.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/t/t7505-prepare-commit-msg-hook.sh b/t/t7505-prepare-commit-msg-hook.sh
index 3573751..1c95652 100755
--- a/t/t7505-prepare-commit-msg-hook.sh
+++ b/t/t7505-prepare-commit-msg-hook.sh
@@ -174,7 +174,7 @@ test_expect_success 'with failing hook (merge)' '
 	git add file &&
 	rm -f "$HOOK" &&
 	git commit -m other &&
-	write_script "$HOOK" <<-EOF
+	write_script "$HOOK" <<-EOF &&
 	exit 1
 	EOF
 	git checkout - &&
-- 
1.8.5.rc3.4.g8bd3721

(a quick "git grep write_script" seems to show a lot of other instances,
but no time to dig this now sorry)

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

  reply	other threads:[~2014-01-08 20:06 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-08 19:00 [PATCH] merge: make merge state available to prepare-commit-msg hook Ryan Biesemeyer
2014-01-08 19:02 ` Ryan Biesemeyer
2014-01-08 20:06   ` Matthieu Moy [this message]
2014-01-08 20:21     ` Ryan Biesemeyer
2014-01-08 20:29       ` Jonathan Nieder
2014-01-08 21:30       ` Matthieu Moy
2014-01-08 22:01         ` Jonathan Nieder
2014-01-09 13:25           ` Matthieu Moy
2014-01-08 19:03 ` Ryan Biesemeyer
2014-01-09  0:45 ` [PATCH v2 0/4] " Ryan Biesemeyer
2014-01-09  0:45   ` [PATCH v2 1/4] t7505: add missing && Ryan Biesemeyer
2014-01-09  0:45   ` [PATCH v2 2/4] t7505: ensure cleanup after hook blocks merge Ryan Biesemeyer
2014-01-09 13:00     ` Matthieu Moy
2014-01-10 23:40       ` Junio C Hamano
2014-01-09  0:45   ` [PATCH v2 3/4] merge: make prepare_to_commit responsible for write_merge_state Ryan Biesemeyer
2014-01-11  0:11     ` Junio C Hamano
2014-01-11  0:20     ` Junio C Hamano
2014-01-09  0:45   ` [PATCH v2 4/4] merge: drop unused arg from abort_commit method signature Ryan Biesemeyer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=vpqr48ip7bm.fsf@anie.imag.fr \
    --to=matthieu.moy@grenoble-inp$(echo .)fr \
    --cc=avarab@gmail$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=gitster@pobox$(echo .)com \
    --cc=jrnieder@gmail$(echo .)com \
    --cc=pclouds@gmail$(echo .)com \
    --cc=peff@peff$(echo .)net \
    --cc=ryan@yaauie$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox