git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: phillip.wood123@gmail.com
Cc: Philippe Blain via GitGitGadget <gitgitgadget@gmail.com>,
	git@vger.kernel.org,  Elijah Newren <newren@gmail.com>,
	 Phillip Wood <phillip.wood@dunelm.org.uk>,
	 Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	 ZheNing Hu <adlternative@gmail.com>,
	Philippe Blain <levraiphilippeblain@gmail.com>
Subject: Re: [PATCH v2 2/2] builtin/am: allow disabling conflict advice
Date: Mon, 11 Mar 2024 10:49:32 -0700	[thread overview]
Message-ID: <xmqq1q8gsloz.fsf@gitster.g> (raw)
In-Reply-To: <xmqq5xxsu1z5.fsf@gitster.g> (Junio C. Hamano's message of "Mon, 11 Mar 2024 10:12:30 -0700")

Junio C Hamano <gitster@pobox.com> writes:

>> I think you need to append "\n" to the message strings here (and
>> below) to match the behavior of printf_ln().
>
> Good eyes.  You'll get the final "\n" but the line breaks inside the
> paragraph you give to advise*() functions are your responsibility.
> Even though advice.c:vadvise() handles multi-line message better
> (unlike usage.c:vreportf() that is used for error() and die()) by
> giving a line header for each line of the message, we do not wrap
> lines at runtime.

Perhaps something like this.

The overly long lines are getting a bit annoying but I do not
offhand think of a good way to shorten them.

Also, having to assemble the message in a buffer and emit them all
once with ("%s" % sb.buf) is a highly annoying pattern.  Perhaps
given enough examples, somebody will come up with a simpler API to
do the same thing, but that is not in the scope of this series.

 builtin/am.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git i/builtin/am.c w/builtin/am.c
index 0e97b827e4..227036d732 100644
--- i/builtin/am.c
+++ w/builtin/am.c
@@ -1155,14 +1155,13 @@ static void NORETURN die_user_resolve(const struct am_state *state)
 		const char *cmdline = state->interactive ? "git am -i" : "git am";
 		struct strbuf sb = STRBUF_INIT;
 
-		strbuf_addf(&sb, _("When you have resolved this problem, run \"%s --continue\"."), cmdline);
-		strbuf_addf(&sb, _("If you prefer to skip this patch, run \"%s --skip\" instead."), cmdline);
+		strbuf_addf(&sb, _("When you have resolved this problem, run \"%s --continue\".\n"), cmdline);
+		strbuf_addf(&sb, _("If you prefer to skip this patch, run \"%s --skip\" instead.\n"), cmdline);
 
 		if (advice_enabled(ADVICE_AM_WORK_DIR) &&
 		    is_empty_or_missing_file(am_path(state, "patch")) &&
 		    !repo_index_has_changes(the_repository, NULL, NULL))
-			strbuf_addf(&sb, _("To record the empty patch as an empty commit, run \"%s --allow-empty\"."), cmdline);
-
+			strbuf_addf(&sb, _("To record the empty patch as an empty commit, run \"%s --allow-empty\".\n"), cmdline);
 		strbuf_addf(&sb, _("To restore the original branch and stop patching, run \"%s --abort\"."), cmdline);
 
 		advise_if_enabled(ADVICE_MERGE_CONFLICT, "%s", sb.buf);


  reply	other threads:[~2024-03-11 17:50 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-02 16:18 [PATCH] sequencer: allow disabling conflict advice Philippe Blain via GitGitGadget
2024-03-02 16:32 ` Philippe Blain
2024-03-03 22:57 ` Junio C Hamano
2024-03-09 17:22   ` Philippe Blain
2024-03-09 18:58     ` Philippe Blain
2024-03-09 19:55       ` Junio C Hamano
2024-03-09 23:19         ` Junio C Hamano
2024-03-04 10:12 ` Phillip Wood
2024-03-04 10:27   ` Phillip Wood
2024-03-04 17:56     ` Junio C Hamano
2024-03-09 17:53       ` Philippe Blain
2024-03-09 19:15         ` Phillip Wood
2024-03-09 19:56           ` Junio C Hamano
2024-03-09 18:01   ` Philippe Blain
2024-03-10 19:50 ` [PATCH v2 0/2] Allow disabling advice shown after merge conflicts Philippe Blain via GitGitGadget
2024-03-10 19:51   ` [PATCH v2 1/2] sequencer: allow disabling conflict advice Philippe Blain via GitGitGadget
2024-03-11 10:29     ` Kristoffer Haugsbakk
2024-03-16 19:33       ` Philippe Blain
2024-03-10 19:51   ` [PATCH v2 2/2] builtin/am: " Philippe Blain via GitGitGadget
2024-03-11 10:54     ` phillip.wood123
2024-03-11 17:12       ` Junio C Hamano
2024-03-11 17:49         ` Junio C Hamano [this message]
2024-03-16 19:44           ` Philippe Blain
2024-03-16 20:01         ` Philippe Blain
2024-03-11 20:58   ` [PATCH v2 0/2] Allow disabling advice shown after merge conflicts Rubén Justo
2024-03-16 20:33     ` Philippe Blain
2024-03-16 21:16   ` [PATCH v3 " Philippe Blain via GitGitGadget
2024-03-16 21:16     ` [PATCH v3 1/2] sequencer: allow disabling conflict advice Philippe Blain via GitGitGadget
2024-03-16 21:16     ` [PATCH v3 2/2] builtin/am: " Philippe Blain via GitGitGadget
2024-03-18 16:31     ` [PATCH v3 0/2] Allow disabling advice shown after merge conflicts Junio C Hamano
2024-03-25 10:48     ` Phillip Wood
2024-03-25 16:57       ` 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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqq1q8gsloz.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=adlternative@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=levraiphilippeblain@gmail.com \
    --cc=newren@gmail.com \
    --cc=phillip.wood123@gmail.com \
    --cc=phillip.wood@dunelm.org.uk \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).