git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] sequencer: change amend advice to an actual advice
@ 2023-03-10  1:47 Felipe Contreras
  0 siblings, 0 replies; only message in thread
From: Felipe Contreras @ 2023-03-10  1:47 UTC (permalink / raw)
  To: git; +Cc: Felipe Contreras

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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2023-03-10  1:47 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-10  1:47 [PATCH] sequencer: change amend advice to an actual advice Felipe Contreras

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).