From: David Disseldorp <ddiss@suse.de>
To: git@vger.kernel.org
Cc: Teng Long <dyroneteng@gmail.com>, David Disseldorp <ddiss@suse.de>
Subject: [PATCH 2/2] notes: revert note_data.given behavior with empty notes add
Date: Thu, 25 Jul 2024 16:41:07 +0200 [thread overview]
Message-ID: <20240725144548.3434-3-ddiss@suse.de> (raw)
In-Reply-To: <20240725144548.3434-1-ddiss@suse.de>
Prior to 90bc19b3ae, note_data.given was set alongside an -m, -C or -F
parameter for add / append. Following 90bc19b3ae, note_data.given is
only set if the notes data buffer length is non-zero, which results in
GIT_EDITOR invocation if e.g. a zero length blob object is provided.
Revert to pre-90bc19b3ae note_data.given behavior, to fix
non-interactive callers.
Fixes: 90bc19b3ae ("notes.c: introduce '--separator=<paragraph-break>' option")
Link: https://github.com/ddiss/icyci/issues/12
Signed-off-by: David Disseldorp <ddiss@suse.de>
---
builtin/notes.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/builtin/notes.c b/builtin/notes.c
index d9c356e354..3ccb3eb602 100644
--- a/builtin/notes.c
+++ b/builtin/notes.c
@@ -282,6 +282,7 @@ static int parse_msg_arg(const struct option *opt, const char *arg, int unset)
ALLOC_GROW_BY(d->messages, d->msg_nr, 1, d->msg_alloc);
d->messages[d->msg_nr - 1] = msg;
msg->stripspace = STRIPSPACE;
+ d->given = 1;
return 0;
}
@@ -302,6 +303,7 @@ static int parse_file_arg(const struct option *opt, const char *arg, int unset)
ALLOC_GROW_BY(d->messages, d->msg_nr, 1, d->msg_alloc);
d->messages[d->msg_nr - 1] = msg;
msg->stripspace = STRIPSPACE;
+ d->given = 1;
return 0;
}
@@ -335,6 +337,7 @@ static int parse_reuse_arg(const struct option *opt, const char *arg, int unset)
ALLOC_GROW_BY(d->messages, d->msg_nr, 1, d->msg_alloc);
d->messages[d->msg_nr - 1] = msg;
msg->stripspace = NO_STRIPSPACE;
+ d->given = 1;
return 0;
}
@@ -515,7 +518,6 @@ static int add(int argc, const char **argv, const char *prefix)
if (d.msg_nr)
concat_messages(&d);
- d.given = !!d.buf.len;
object_ref = argc > 1 ? argv[1] : "HEAD";
@@ -692,7 +694,6 @@ static int append_edit(int argc, const char **argv, const char *prefix)
if (d.msg_nr)
concat_messages(&d);
- d.given = !!d.buf.len;
if (d.given && edit)
fprintf(stderr, _("The -m/-F/-c/-C options have been deprecated "
--
2.43.0
next prev parent reply other threads:[~2024-07-25 14:46 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-25 14:41 [PATCH 0/2] notes: fix editor invocation regression David Disseldorp
2024-07-25 14:41 ` [PATCH 1/2] t3301-notes: check editor isn't invoked for empty notes add David Disseldorp
2024-07-25 15:52 ` Kristoffer Haugsbakk
2024-07-25 16:03 ` David Disseldorp
2024-07-25 17:10 ` Junio C Hamano
2024-07-25 16:31 ` Junio C Hamano
2024-07-25 23:10 ` David Disseldorp
2024-07-25 14:41 ` David Disseldorp [this message]
2024-07-25 17:09 ` [PATCH 2/2] notes: revert note_data.given behavior with " Junio C Hamano
2024-07-25 17:22 ` Kristoffer Haugsbakk
2024-07-25 23:26 ` David Disseldorp
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=20240725144548.3434-3-ddiss@suse.de \
--to=ddiss@suse.de \
--cc=dyroneteng@gmail.com \
--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