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

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

From
Samuel Abraham <abrahamadekunle50@gmail.com>
Date
Oct 21, 2024, 17:12 UTC
Message-ID
<CADYq+fYERH=9_ZXq4JiwjE2_piP93u2=-9ii63SCA0r9p2==Ag@mail.gmail.com>
In-Reply-To
<ZxaG67wuvjOXc5kr@nand.local>
On Mon, Oct 21, 2024 at 5:53 PM Taylor Blau <me@ttaylorr.com> wrote:
Show 41 quoted lines
>
> On Mon, Oct 21, 2024 at 02:38:15PM +0000, Samuel Adekunle Abraham via GitGitGadget wrote:
> > From: Abraham Samuel Adekunle <abrahamadekunle50@gmail.com>
> >
> > Notes can be added to a commit using:
> >       - "-m" to provide a message on the command line.
> >       - -C to copy a note from a blob object.
> >       - -F to read the note from a file.
> > When these options are used, Git does not open an editor,
> > it simply takes the content provided via these options and
> > attaches it to the commit as a note.
> >
> > Improve flexibility to fine-tune the note before finalizing it
> > by allowing the messages to be prefilled in the editor and edited
> > after the messages have been provided through -[mF].
> >
> > Signed-off-by: Abraham Samuel Adekunle <abrahamadekunle50@gmail.com>
>
> Nicely described, this commit message is looking good. Let's take a look
> at the patch below...
>
> > diff --git a/t/t3301-notes.sh b/t/t3301-notes.sh
> > index 99137fb2357..2827f592c66 100755
> > --- a/t/t3301-notes.sh
> > +++ b/t/t3301-notes.sh
> > @@ -1567,4 +1567,75 @@ 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 &&
> > +     MSG="Edited notes message" git notes add -m "Initial notes message" -e &&
> > +     echo "Edited notes message" >expect &&
>
> Very nice use of the fake_editor script here.
>
> It is a little cumbersome to repeat the same message in MSG= and when
> populating the 'expect' file. Perhaps instead this could be written as:
>
>     echo "edited notes message" >expect &&
>     MSG="$(cat expect)" git notes -add -m "initial" -e
Concise! :-). Thank you very much Taylor.
Show 24 quoted lines
>
> > +     git notes show >actual &&
> > +     test_cmp expect actual &&
> > +     git notes remove HEAD &&
> > +
> > +     # Add a note using -F and edit it
> > +     echo "Note from file" >note_file &&
> > +     MSG="Edited note from file" git notes add -F note_file -e &&
> > +     echo "Edited note from file" >expect &&
>
> Same "note" here. ;-).
>
> > +     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 &&
> > +     git notes add -m "Initial note message" &&
> > +     MSG="Appended edited note message" git notes append -m "New appended note" -e &&
>
> It's fine to use shorter values for -m and $MSG here. I think "appended"
> and "edited" would be fine for each, respectively.
>
Okay. Noted
> Besides applying those suggestions throughout the patch's new tests
> (including the ones that I didn't explicitly comment on here), I think
> that this should be looking good after another round. Thanks for working
> on it.

Thank you very much, Abraham Samuel

>
> Thanks,
> Taylor
Previous: Taylor BlauNext: Eric Sunshine
Message 15 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.