Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2023-03-20 01:03:12 +0300
committerJunio C Hamano <gitster@pobox.com>2023-03-20 01:03:13 +0300
commit9de14c71f720b1da50c95309fc06d30c8455aae2 (patch)
tree4876b04221d79c5152e2f9ec4d1d3ffa4e1c0ad7
parentfc1a4ce043e4b07d1551a24ec224bd43b9405ec8 (diff)
parent765071a8f27fcaae27ce940b3a784b9d586faa12 (diff)
Merge branch 'fc/advice-diverged-history'
After "git pull" that is configured with pull.rebase=false merge.ff=only fails due to our end having our own development, give advice messages to get out of the "Not possible to fast-forward" state. * fc/advice-diverged-history: advice: add diverging advice for novices
-rw-r--r--Documentation/config/advice.txt2
-rw-r--r--advice.c9
-rw-r--r--advice.h1
3 files changed, 12 insertions, 0 deletions
diff --git a/Documentation/config/advice.txt b/Documentation/config/advice.txt
index a00d0100a8..c96b5b2e5d 100644
--- a/Documentation/config/advice.txt
+++ b/Documentation/config/advice.txt
@@ -136,4 +136,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 a5ea460ab8..d6232439c3 100644
--- a/advice.c
+++ b/advice.c
@@ -46,6 +46,7 @@ static struct {
[ADVICE_COMMIT_BEFORE_MERGE] = { "commitBeforeMerge", 1 },
[ADVICE_DETACHED_HEAD] = { "detachedHead", 1 },
[ADVICE_SUGGEST_DETACHING_HEAD] = { "suggestDetachingHead", 1 },
+ [ADVICE_DIVERGING] = { "diverging", 1 },
[ADVICE_FETCH_SHOW_FORCED_UPDATES] = { "fetchShowForcedUpdates", 1 },
[ADVICE_GRAFT_FILE_DEPRECATED] = { "graftFileDeprecated", 1 },
[ADVICE_IGNORED_HOOK] = { "ignoredHook", 1 },
@@ -219,6 +220,14 @@ void NORETURN die_conclude_merge(void)
void NORETURN die_ff_impossible(void)
{
+ advise_if_enabled(ADVICE_DIVERGING,
+ _("Diverging branches can't be fast-forwarded, you need to either:\n"
+ "\n"
+ "\tgit merge --no-ff\n"
+ "\n"
+ "or:\n"
+ "\n"
+ "\tgit rebase\n"));
die(_("Not possible to fast-forward, aborting."));
}
diff --git a/advice.h b/advice.h
index 3e1b48bf68..0f584163f5 100644
--- a/advice.h
+++ b/advice.h
@@ -19,6 +19,7 @@ struct string_list;
ADVICE_CHECKOUT_AMBIGUOUS_REMOTE_BRANCH_NAME,
ADVICE_COMMIT_BEFORE_MERGE,
ADVICE_DETACHED_HEAD,
+ ADVICE_DIVERGING,
ADVICE_SUGGEST_DETACHING_HEAD,
ADVICE_FETCH_SHOW_FORCED_UPDATES,
ADVICE_GRAFT_FILE_DEPRECATED,