Message ID | 20230308024834.1562386-2-felipe.contreras@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | advice: add diverging advice | expand |
Felipe Contreras <felipe.contreras@gmail.com> writes: > The user might not necessarily know why ff only was configured, maybe an > admin did it, or the installer (Git for Windows), or perhaps they just > followed some online advice. > > This can happen not only on pull.ff=only, but merge.ff=only too. > > Even worse if the user has configured pull.rebase=false and > merge.ff=only, because in those cases a diverging merge will constantly > keep failing. There's no trivial way to get out of this other than > `git merge --no-ff`. A good description. Without this explained, the instruction to run "git merge" with "--no-ff" in the text would have been puzzling to readers. At least I was initially puzzled as I read the patch text before the proposed log message. > void NORETURN die_ff_impossible(void) > { > + advise(_("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.c b/advice.c index fd18968943..c3fb631f93 100644 --- a/advice.c +++ b/advice.c @@ -217,6 +217,13 @@ void NORETURN die_conclude_merge(void) void NORETURN die_ff_impossible(void) { + advise(_("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.")); }
The user might not necessarily know why ff only was configured, maybe an admin did it, or the installer (Git for Windows), or perhaps they just followed some online advice. This can happen not only on pull.ff=only, but merge.ff=only too. Even worse if the user has configured pull.rebase=false and merge.ff=only, because in those cases a diverging merge will constantly keep failing. There's no trivial way to get out of this other than `git merge --no-ff`. Let's not assume our users are experts in git who completely understand all their configurations. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> --- advice.c | 7 +++++++ 1 file changed, 7 insertions(+)