git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v4] notes: teach the -e option to edit messages in editor

From
Patrick Steinhardt <ps@pks.im>
Date
Oct 23, 2024, 06:14 UTC
Message-ID
<ZxiUTbmGpeK3KnOx@pks.im>
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:
Show 31 quoted lines
> 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]
Show 11 quoted lines
> +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
Previous: Samuel AbrahamNext: Samuel Abraham
Message 21 of 22 in “notes: teach the -e option to edit messages in editor”
  1. notes: teach the -e option to edit messages in editorSamuel Adekunle Abraham via GitGitGadget, Oct 19, 2024
  2. brian m. carlsonOct 19, 2024
  3. Kristoffer HaugsbakkOct 19, 2024
  4. Samuel AbrahamOct 19, 2024
  5. Kristoffer HaugsbakkOct 19, 2024
  6. Samuel AbrahamOct 19, 2024
  7. Kristoffer HaugsbakkOct 19, 2024
  8. Samuel AbrahamOct 19, 2024
  9. notes: teach the -e option to edit messages in editorSamuel Adekunle Abraham via GitGitGadget, Oct 20, 2024
  10. Patrick SteinhardtOct 21, 2024
  11. Samuel AbrahamOct 21, 2024
  12. Eric SunshineOct 21, 2024
  13. notes: teach the -e option to edit messages in editorSamuel Adekunle Abraham via GitGitGadget, Oct 21, 2024
  14. Taylor BlauOct 21, 2024
  15. Samuel AbrahamOct 21, 2024
  16. Eric SunshineOct 21, 2024
  17. Taylor BlauOct 21, 2024
  18. notes: teach the -e option to edit messages in editorSamuel Adekunle Abraham via GitGitGadget, Oct 21, 2024
  19. Taylor BlauOct 21, 2024
  20. Samuel AbrahamOct 21, 2024
  21. Patrick SteinhardtOct 23, 2024
  22. Samuel AbrahamOct 23, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.