From: Junio C Hamano <gitster@pobox.com>
To: Wincent Colaiuta <win@wincent.com>
Cc: git@vger.kernel.org, krh@redhat.com
Subject: Re: [PATCH] Interactive editor tests for commit-msg hook
Date: Sun, 09 Dec 2007 19:42:45 -0800 [thread overview]
Message-ID: <7vwsrnmczu.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: 1197204731-19553-1-git-send-email-win@wincent.com
Wincent Colaiuta <win@wincent.com> writes:
> I didn't add similar tests for the pre-commit hook because I don't
> think that's an interesting code path; we don't care about the commit
> message in that case, only whether the commit is allowed to proceed or
> not.
Sensible.
> +# set up fake editor for interactive editing
> +cat > fake-editor <<'EOF'
> +#!/bin/sh
> +cp FAKE_MSG "$1"
> +exit 0
> +EOF
> +chmod +x fake-editor
> +FAKE_EDITOR="$(pwd)/fake-editor"
> +export FAKE_EDITOR
Hmm. Why "export"?
> +test_expect_success "with no hook (editor)" \
> + "echo 'more foo' >> file &&
> + git add file &&
> + echo 'more foo' > FAKE_MSG &&
> + GIT_EDITOR="$FAKE_EDITOR" git commit"
> +
I initially was going to say "this is just a style thing", but I really
want our tests to read uniformly like this:
test_expect_success 'without hook (editor)' '
echo more foo >>file &&
git add file &&
echo more foo >FAKE_MSG &&
GIT_EDITOR="$FAKE_EDITOR" git commit
'
* Use single quotes around test unless there is a compelling reason not
to;
* The opening single quote of the test body on the same line as
expect-success; the end quote at column 1 on a line on its own.
Notice a bug in your version? Dq around $FAKE_EDITOR is stripped away
and it is harder to spot it because the script does not follow that
style.
next prev parent reply other threads:[~2007-12-10 3:43 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-09 12:52 [PATCH] Interactive editor tests for commit-msg hook Wincent Colaiuta
2007-12-10 3:42 ` Junio C Hamano [this message]
2007-12-10 7:32 ` Wincent Colaiuta
2007-12-10 7:33 ` [PATCH 7/7] " Wincent Colaiuta
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=7vwsrnmczu.fsf@gitster.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=krh@redhat.com \
--cc=win@wincent.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).