git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 3/7] merge: make the diverging advise configurable

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
Jul 22, 2021, 00:08 UTC
Message-ID
<20210722000854.1899129-4-felipe.contreras@gmail.com>
In-Reply-To
<20210722000854.1899129-1-felipe.contreras@gmail.com>
With advice.diverging.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 Documentation/config/advice.txt | 2 ++
 advice.c                        | 4 +++-
 advice.h                        | 1 +
 3 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/Documentation/config/advice.txt b/Documentation/config/advice.txt
index 8b2849ff7b..dae85310dc 100644
--- a/Documentation/config/advice.txt
+++ b/Documentation/config/advice.txt
@@ -123,4 +123,6 @@ advice.*::
 		Advice shown when either linkgit:git-add[1] or linkgit:git-rm[1]
 		is asked to update index entries outside the current sparse
 		checkout.
+	diverging::
+		Advice shown when a fast-forward is not possible.
 --
diff --git a/advice.c b/advice.c
index 8f068c8be9..60de7fbc4e 100644
--- a/advice.c
+++ b/advice.c
@@ -110,6 +110,7 @@ static struct {
 	[ADVICE_CHECKOUT_AMBIGUOUS_REMOTE_BRANCH_NAME] 	= { "checkoutAmbiguousRemoteBranchName", 1 },
 	[ADVICE_COMMIT_BEFORE_MERGE]			= { "commitBeforeMerge", 1 },
 	[ADVICE_DETACHED_HEAD]				= { "detachedHead", 1 },
+	[ADVICE_DIVERGING]				= { "diverging", 1 },
 	[ADVICE_FETCH_SHOW_FORCED_UPDATES]		= { "fetchShowForcedUpdates", 1 },
 	[ADVICE_GRAFT_FILE_DEPRECATED]			= { "graftFileDeprecated", 1 },
 	[ADVICE_IGNORED_HOOK]				= { "ignoredHook", 1 },
@@ -329,7 +330,8 @@ void detach_advice(const char *new_name)
 
 void diverging_advice(void)
 {
-	advise(_("Diverging branches can't be fast-forwarded, you need to either:\n"
+	advise_if_enabled(ADVICE_DIVERGING,
+		_("Diverging branches can't be fast-forwarded, you need to either:\n"
 		"\n"
 		"\tgit merge\n"
 		"\n"
diff --git a/advice.h b/advice.h
index 6ce967c962..695f5a62bb 100644
--- a/advice.h
+++ b/advice.h
@@ -49,6 +49,7 @@ extern int advice_add_empty_pathspec;
 	ADVICE_CHECKOUT_AMBIGUOUS_REMOTE_BRANCH_NAME,
 	ADVICE_COMMIT_BEFORE_MERGE,
 	ADVICE_DETACHED_HEAD,
+	ADVICE_DIVERGING,
 	ADVICE_FETCH_SHOW_FORCED_UPDATES,
 	ADVICE_GRAFT_FILE_DEPRECATED,
 	ADVICE_IGNORED_HOOK,
-- 
2.32.0.40.gb9b36f9b52
Previous: Felipe ContrerasNext: Felipe Contreras
Message 4 of 12 in “fast-forward: new command with advice and documentation”
  1. 0/7 fast-forward: new command with advice and documentationFelipe Contreras, Jul 22, 2021
  2. 1/7 merge: improve fatal fast-forward messageFelipe Contreras, Jul 22, 2021
  3. 2/7 merge: add diverging advice for novicesFelipe Contreras, Jul 22, 2021
  4. 3/7 merge: make the diverging advise configurableFelipe Contreras, Jul 22, 2021
  5. 4/7 merge: split cmd_merge()Felipe Contreras, Jul 22, 2021
  6. 5/7 fast-forward: add new builtinFelipe Contreras, Jul 22, 2021
  7. 6/7 doc: fast-forward: explain what it isFelipe Contreras, Jul 22, 2021
  8. 7/7 fast-forward: add help about merge vs. rebaseFelipe Contreras, Jul 22, 2021
  9. Philip OakleyJul 22, 2021
  10. Felipe ContrerasJul 23, 2021
  11. Philip OakleyJul 23, 2021
  12. Felipe ContrerasJul 23, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.