git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: Samuel Adekunle Abraham via GitGitGadget <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org,
	"brian m. carlson" <sandals@crustytoothpaste.net>,
	Kristoffer Haugsbakk <kristofferhaugsbakk@fastmail.com>,
	Phillip Wood <phillip.wood@dunelm.org.uk>,
	Junio C Hamano <gitster@pobox.com>, Taylor Blau <me@ttaylorr.com>,
	Samuel Adekunle Abraham <abrahamadekunle50@gmail.com>
Subject: Re: [PATCH v4] notes: teach the -e option to edit messages in editor
Date: Wed, 23 Oct 2024 08:14:41 +0200	[thread overview]
Message-ID: <ZxiUTbmGpeK3KnOx@pks.im> (raw)
In-Reply-To: <pull.1817.v4.git.1729534340786.gitgitgadget@gmail.com>

On Mon, Oct 21, 2024 at 06:12:20PM +0000, Samuel Adekunle Abraham via GitGitGadget wrote:
> From: Abraham Samuel Adekunle <abrahamadekunle50@gmail.com>
> diff --git a/t/t3301-notes.sh b/t/t3301-notes.sh
> index 99137fb2357..813dfd8db97 100755
> --- a/t/t3301-notes.sh
> +++ b/t/t3301-notes.sh
> @@ -1567,4 +1567,67 @@ test_expect_success 'empty notes do not invoke the editor' '
>  	git notes remove HEAD
>  '
>  
> +test_expect_success 'git notes add with -m/-F invokes editor with -e' '
> +	test_commit 19th &&
> +	echo "edited" >expect &&
> +	MSG="$(cat expect)" git notes add -m "initial" -e &&
> +	git notes show >actual &&
> +	test_cmp expect actual &&
> +	git notes remove HEAD &&
> +
> +	# Add a note using -F and edit it
> +	echo "initial" >note_file &&
> +	MSG="$(cat expect)" git notes add -F note_file -e &&
> +	git notes show >actual &&
> +	test_cmp expect actual
> +'
> +
> +test_expect_success 'git notes append with -m/-F invokes the editor with -e' '
> +	test_commit 20th &&
> +	cat >expect <<-EOF &&
> +		initial
> +
> +		edited
> +	EOF

Nit: we typically align the contents of HERE docs with `cat`. I'm not a
huge fan of it and had been struggling with it initially, as well, but
coding style is subjective anyway and it's totally fine that one doesn't
agree with everything.

In any case, I don't think this warrants a reroll of this patch, just
to keep it in mind for future patches you may send.

[snip]
> +test_expect_success 'git notes append aborts when editor fails with -e' '
> +	test_commit 22nd &&
> +	echo "foo-file-1" >note_1 &&
> +
> +	# Try to append a note with -F and -e, but make the editor fail
> +	test_env GIT_EDITOR="false" test_must_fail git notes append -F note_1 -e &&
> +
> +	# Verify that no note was added due to editor failure
> +	test_must_fail git notes show
> +'
> +

Nice.

Thanks, this looks good to me overall.

Patrick

  parent reply	other threads:[~2024-10-23  6:14 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-19  0:14 [PATCH] notes: teach the -e option to edit messages in editor Samuel Adekunle Abraham via GitGitGadget
2024-10-19  0:38 ` brian m. carlson
2024-10-19 11:03   ` Kristoffer Haugsbakk
2024-10-19 11:24     ` Samuel Abraham
2024-10-19 10:28 ` Kristoffer Haugsbakk
2024-10-19 11:19   ` Samuel Abraham
2024-10-19 11:36 ` Kristoffer Haugsbakk
2024-10-19 11:58   ` Samuel Abraham
2024-10-20  0:03 ` [PATCH v2] " Samuel Adekunle Abraham via GitGitGadget
2024-10-21 11:58   ` Patrick Steinhardt
2024-10-21 12:37     ` Samuel Abraham
2024-10-21 18:22     ` Eric Sunshine
2024-10-21 14:38   ` [PATCH v3] " Samuel Adekunle Abraham via GitGitGadget
2024-10-21 16:52     ` Taylor Blau
2024-10-21 17:12       ` Samuel Abraham
2024-10-21 18:28       ` Eric Sunshine
2024-10-21 19:52         ` Taylor Blau
2024-10-21 18:12     ` [PATCH v4] " Samuel Adekunle Abraham via GitGitGadget
2024-10-21 19:53       ` Taylor Blau
2024-10-21 21:44         ` Samuel Abraham
2024-10-23  6:14       ` Patrick Steinhardt [this message]
2024-10-23 16:51         ` Samuel Abraham

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=ZxiUTbmGpeK3KnOx@pks.im \
    --to=ps@pks.im \
    --cc=abrahamadekunle50@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=gitster@pobox.com \
    --cc=kristofferhaugsbakk@fastmail.com \
    --cc=me@ttaylorr.com \
    --cc=phillip.wood@dunelm.org.uk \
    --cc=sandals@crustytoothpaste.net \
    /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).