git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: David Disseldorp <ddiss@suse.de>
Cc: git@vger.kernel.org
Subject: Re: [PATCH v2 1/1] notes: do not trigger editor when adding an empty note
Date: Mon, 29 Jul 2024 14:37:35 -0700	[thread overview]
Message-ID: <xmqqed7bhobk.fsf@gitster.g> (raw)
In-Reply-To: <20240729151639.19192-2-ddiss@suse.de> (David Disseldorp's message of "Mon, 29 Jul 2024 17:14:00 +0200")

David Disseldorp <ddiss@suse.de> writes:

> Restore the original behaviour of "git note" that takes the contents
> given via the "-m", "-C", "-F" options without invoking an editor, by
> checking for any prior parameter callbacks, indicated by a non-zero
> note_data.msg_nr.  Remove the now-unneeded note_data.given flag.
>
> Add a test for this regression by checking whether GIT_EDITOR is
> invoked alongside "git notes add -C $empty_blob --allow-empty"

Makes perfect sense.

A #leftoverbit that we may want to look into after this topic
settles is to teach the "-e" option, similar to "git commit" and
"git tag", so that messages seeded with -m/-F can still be edited.
In a sense, supporting both "-c/-C" was unnecessary if these
commands supported "-e" in the first place, and that mistake has
been inherited from "git commit" and "git tag" into this command.

> diff --git a/t/t3301-notes.sh b/t/t3301-notes.sh
> index 536bd11ff4..c0dbacc161 100755
> --- a/t/t3301-notes.sh
> +++ b/t/t3301-notes.sh
> @@ -1557,4 +1557,9 @@ test_expect_success 'empty notes are displayed by git log' '
>  	test_cmp expect actual
>  '
>  
> +test_expect_success 'empty notes do not invoke the editor' '
> +	test_commit 18th &&
> +	GIT_EDITOR="false" git notes add -C "$empty_blob" --allow-empty
> +'
> +
>  test_done

I am tempted to squash in

        diff --git i/t/t3301-notes.sh w/t/t3301-notes.sh
        index c0dbacc161..99137fb235 100755
        --- i/t/t3301-notes.sh
        +++ w/t/t3301-notes.sh
        @@ -1559,7 +1559,12 @@ test_expect_success 'empty notes are displayed by git log' '

         test_expect_success 'empty notes do not invoke the editor' '
                test_commit 18th &&
        -	GIT_EDITOR="false" git notes add -C "$empty_blob" --allow-empty
        +	GIT_EDITOR="false" git notes add -C "$empty_blob" --allow-empty &&
        +	git notes remove HEAD &&
        +	GIT_EDITOR="false" git notes add -m "" --allow-empty &&
        +	git notes remove HEAD &&
        +	GIT_EDITOR="false" git notes add -F /dev/null --allow-empty &&
        +	git notes remove HEAD
         '

         test_done

to make sure that all three options mentioned in the proposed commit
log message are tested.  It is not too much more effort to do so.

Will queue.

Thanks.


  reply	other threads:[~2024-07-29 21:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-29 15:13 [PATCH v2 0/1] notes: fix editor invocation regression David Disseldorp
2024-07-29 15:14 ` [PATCH v2 1/1] notes: do not trigger editor when adding an empty note David Disseldorp
2024-07-29 21:37   ` Junio C Hamano [this message]
2024-07-29 21:53     ` David Disseldorp
2024-07-29 22:50       ` Junio C Hamano

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=xmqqed7bhobk.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=ddiss@suse.de \
    --cc=git@vger.kernel.org \
    /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).