* [PATCH 0/2] advice: add diverging advice @ 2023-03-08 2:48 Felipe Contreras 2023-03-08 2:48 ` [PATCH 1/2] advice: add diverging advice for novices Felipe Contreras ` (2 more replies) 0 siblings, 3 replies; 7+ messages in thread From: Felipe Contreras @ 2023-03-08 2:48 UTC (permalink / raw) To: git Cc: Alex Henrie, Heba Waly, Nguyễn Thái Ngọc Duy, Matheus Tavares, Felipe Contreras Not all our users are experts in git who understand their configurations perfectly, some might be stuck in a simple error: Not possible to fast-forward, aborting. That's not very friendly. Let's add a bit more advice in case the user doesn't know what's going on. Felipe Contreras (2): advice: add diverging advice for novices advice: make diverging advice configurable Documentation/config/advice.txt | 2 ++ advice.c | 9 +++++++++ advice.h | 1 + 3 files changed, 12 insertions(+) -- 2.39.2 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/2] advice: add diverging advice for novices 2023-03-08 2:48 [PATCH 0/2] advice: add diverging advice Felipe Contreras @ 2023-03-08 2:48 ` Felipe Contreras 2023-03-08 17:17 ` Junio C Hamano 2023-03-08 2:48 ` [PATCH 2/2] advice: make diverging advice configurable Felipe Contreras 2023-03-08 16:03 ` [PATCH 0/2] advice: add diverging advice Taylor Blau 2 siblings, 1 reply; 7+ messages in thread From: Felipe Contreras @ 2023-03-08 2:48 UTC (permalink / raw) To: git Cc: Alex Henrie, Heba Waly, Nguyễn Thái Ngọc Duy, Matheus Tavares, Felipe Contreras 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(+) 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.")); } -- 2.39.2 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] advice: add diverging advice for novices 2023-03-08 2:48 ` [PATCH 1/2] advice: add diverging advice for novices Felipe Contreras @ 2023-03-08 17:17 ` Junio C Hamano 0 siblings, 0 replies; 7+ messages in thread From: Junio C Hamano @ 2023-03-08 17:17 UTC (permalink / raw) To: Felipe Contreras Cc: git, Alex Henrie, Heba Waly, Nguyễn Thái Ngọc Duy, Matheus Tavares 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.")); > } ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 2/2] advice: make diverging advice configurable 2023-03-08 2:48 [PATCH 0/2] advice: add diverging advice Felipe Contreras 2023-03-08 2:48 ` [PATCH 1/2] advice: add diverging advice for novices Felipe Contreras @ 2023-03-08 2:48 ` Felipe Contreras 2023-03-08 16:03 ` [PATCH 0/2] advice: add diverging advice Taylor Blau 2 siblings, 0 replies; 7+ messages in thread From: Felipe Contreras @ 2023-03-08 2:48 UTC (permalink / raw) To: git Cc: Alex Henrie, Heba Waly, Nguyễn Thái Ngọc Duy, Matheus Tavares, Felipe Contreras 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 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 c3fb631f93..fbc59f9c6d 100644 --- a/advice.c +++ b/advice.c @@ -44,6 +44,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 }, @@ -217,7 +218,8 @@ 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" + advise_if_enabled(ADVICE_DIVERGING, + _("Diverging branches can't be fast-forwarded, you need to either:\n" "\n" "\tgit merge --no-ff\n" "\n" diff --git a/advice.h b/advice.h index 07e0f76833..41b5bc127c 100644 --- a/advice.h +++ b/advice.h @@ -21,6 +21,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, -- 2.39.2 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 0/2] advice: add diverging advice 2023-03-08 2:48 [PATCH 0/2] advice: add diverging advice Felipe Contreras 2023-03-08 2:48 ` [PATCH 1/2] advice: add diverging advice for novices Felipe Contreras 2023-03-08 2:48 ` [PATCH 2/2] advice: make diverging advice configurable Felipe Contreras @ 2023-03-08 16:03 ` Taylor Blau 2023-03-08 17:17 ` Junio C Hamano 2023-03-09 23:44 ` Junio C Hamano 2 siblings, 2 replies; 7+ messages in thread From: Taylor Blau @ 2023-03-08 16:03 UTC (permalink / raw) To: Felipe Contreras Cc: git, Alex Henrie, Heba Waly, Nguyễn Thái Ngọc Duy, Matheus Tavares Hi Felipe, On Tue, Mar 07, 2023 at 08:48:32PM -0600, Felipe Contreras wrote: > Not all our users are experts in git who understand their configurations > perfectly, some might be stuck in a simple error: > > Not possible to fast-forward, aborting. > > That's not very friendly. > > Let's add a bit more advice in case the user doesn't know what's going > on. Thanks for improving this case. I think the new advice() is reasonable and will be helpful for users who might otherwise get stuck here. I don't think that splitting it into two separate patches was strictly necessary. If I were queuing, I'd probably squash the two together, but I leave that one to Junio to figure out ;-). Thanks, Taylor ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 0/2] advice: add diverging advice 2023-03-08 16:03 ` [PATCH 0/2] advice: add diverging advice Taylor Blau @ 2023-03-08 17:17 ` Junio C Hamano 2023-03-09 23:44 ` Junio C Hamano 1 sibling, 0 replies; 7+ messages in thread From: Junio C Hamano @ 2023-03-08 17:17 UTC (permalink / raw) To: Taylor Blau Cc: Felipe Contreras, git, Alex Henrie, Heba Waly, Nguyễn Thái Ngọc Duy, Matheus Tavares Taylor Blau <me@ttaylorr.com> writes: > I don't think that splitting it into two separate patches was strictly > necessary. If I were queuing, I'd probably squash the two together, ... One advantage of sending a topic like this as two patches is that, if the review discussion leads to a consensus that the new help message should be given unconditionally to everybody, only [1/2] can be queued while dropping [2/2]. But the point of advise() is to serve as a training wheel that can be disabled by users who no longer need it, so need for such a "flexibility" may not appear in topics that add new advise() calls all that often, I would imagine. I am willing to do the squashing on the receiving end. The effect of two patches combined together is a good improvement, and the proposed log message for the first one covers why we want to do both of these two. Thanks, both, for writing and reviewing. ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 0/2] advice: add diverging advice 2023-03-08 16:03 ` [PATCH 0/2] advice: add diverging advice Taylor Blau 2023-03-08 17:17 ` Junio C Hamano @ 2023-03-09 23:44 ` Junio C Hamano 1 sibling, 0 replies; 7+ messages in thread From: Junio C Hamano @ 2023-03-09 23:44 UTC (permalink / raw) To: Taylor Blau Cc: Felipe Contreras, git, Alex Henrie, Heba Waly, Nguyễn Thái Ngọc Duy, Matheus Tavares Taylor Blau <me@ttaylorr.com> writes: > On Tue, Mar 07, 2023 at 08:48:32PM -0600, Felipe Contreras wrote: >> Not all our users are experts in git who understand their configurations >> perfectly, some might be stuck in a simple error: >> >> Not possible to fast-forward, aborting. >> >> That's not very friendly. >> >> Let's add a bit more advice in case the user doesn't know what's going >> on. > > Thanks for improving this case. I think the new advice() is reasonable > and will be helpful for users who might otherwise get stuck here. We may want to further tweak the advise() message depending on the caller [*], but that can come on top after these two patches settle. [Footnote] * When a failed "git pull" gave the new advise() message, the user may not be advanced enough to adjust the advice to run "git merge --no-ff" to the given situation, for example. ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2023-03-09 23:45 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2023-03-08 2:48 [PATCH 0/2] advice: add diverging advice Felipe Contreras 2023-03-08 2:48 ` [PATCH 1/2] advice: add diverging advice for novices Felipe Contreras 2023-03-08 17:17 ` Junio C Hamano 2023-03-08 2:48 ` [PATCH 2/2] advice: make diverging advice configurable Felipe Contreras 2023-03-08 16:03 ` [PATCH 0/2] advice: add diverging advice Taylor Blau 2023-03-08 17:17 ` Junio C Hamano 2023-03-09 23:44 ` Junio C Hamano
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).