git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Felipe Contreras <felipe.contreras@gmail.com>
To: git@vger.kernel.org
Cc: Felipe Contreras <felipe.contreras@gmail.com>
Subject: [PATCH] sequencer: change amend advice to an actual advice
Date: Thu,  9 Mar 2023 19:47:40 -0600	[thread overview]
Message-ID: <20230310014740.1076715-1-felipe.contreras@gmail.com> (raw)

Show it like a proper advice, and also allow the possibility to turn
that off for experts who don't need this annoying advice.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 Documentation/config/advice.txt | 2 ++
 advice.c                        | 1 +
 advice.h                        | 1 +
 sequencer.c                     | 2 +-
 4 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/Documentation/config/advice.txt b/Documentation/config/advice.txt
index a00d0100a8..f493af466a 100644
--- a/Documentation/config/advice.txt
+++ b/Documentation/config/advice.txt
@@ -80,6 +80,8 @@ advice.*::
 		prevent the operation from being performed.
 	sequencerInUse::
 		Advice shown when a sequencer command is already in progress.
+	sequencerToAmend::
+		Advice shown when a sequencer is ready to ammend a commit.
 	implicitIdentity::
 		Advice on how to set your identity configuration when
 		your information is guessed from the system username and
diff --git a/advice.c b/advice.c
index fd18968943..28e7401c68 100644
--- a/advice.c
+++ b/advice.c
@@ -66,6 +66,7 @@ static struct {
 	[ADVICE_RESOLVE_CONFLICT]			= { "resolveConflict", 1 },
 	[ADVICE_RM_HINTS]				= { "rmHints", 1 },
 	[ADVICE_SEQUENCER_IN_USE]			= { "sequencerInUse", 1 },
+	[ADVICE_SEQUENCER_TO_AMEND]			= { "sequencerToAmend", 1 },
 	[ADVICE_SET_UPSTREAM_FAILURE]			= { "setUpstreamFailure", 1 },
 	[ADVICE_SKIPPED_CHERRY_PICKS]			= { "skippedCherryPicks", 1 },
 	[ADVICE_STATUS_AHEAD_BEHIND_WARNING]		= { "statusAheadBehindWarning", 1 },
diff --git a/advice.h b/advice.h
index 07e0f76833..933a6614ca 100644
--- a/advice.h
+++ b/advice.h
@@ -41,6 +41,7 @@ struct string_list;
 	ADVICE_RESOLVE_CONFLICT,
 	ADVICE_RM_HINTS,
 	ADVICE_SEQUENCER_IN_USE,
+	ADVICE_SEQUENCER_TO_AMEND,
 	ADVICE_SET_UPSTREAM_FAILURE,
 	ADVICE_STATUS_AHEAD_BEHIND_WARNING,
 	ADVICE_STATUS_HINTS,
diff --git a/sequencer.c b/sequencer.c
index 1c96a75b1e..e5831907f6 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -3559,7 +3559,7 @@ static int error_with_patch(struct repository *r,
 		if (intend_to_amend())
 			return -1;
 
-		fprintf(stderr,
+		advise_if_enabled(ADVICE_SEQUENCER_TO_AMEND,
 			_("You can amend the commit now, with\n"
 			  "\n"
 			  "  git commit --amend %s\n"
-- 
2.40.0.rc2.1.gf652911b76.dirty


                 reply	other threads:[~2023-03-10  1:47 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20230310014740.1076715-1-felipe.contreras@gmail.com \
    --to=felipe.contreras@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.
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).