diff mbox series

sequencer: change amend advice to an actual advice

Message ID 20230310014740.1076715-1-felipe.contreras@gmail.com (mailing list archive)
State New, archived
Headers show
Series sequencer: change amend advice to an actual advice | expand

Commit Message

Felipe Contreras March 10, 2023, 1:47 a.m. UTC
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 mbox series

Patch

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"