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

Re: [PATCH v2 1/3] advice: handle "rebase" in error_resolve_conflict()

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 28, 2023, 19:01 UTC
Message-ID
<xmqqjzxvde6p.fsf@gitster.g>
In-Reply-To
<20230428125649.1719796-1-oswald.buddenhagen@gmx.de>
Oswald Buddenhagen <oswald.buddenhagen@gmx.de> writes:
> This makes sure that we get a properly translated message rather than
> inserting the command (which we failed to translate) into a generic
> fallback message.

Hmph, can this be accompanied with a change to add a test to an existing test script to demonstrate that the function can be called with me set to "rebase" and results in a generic message?

> We now also BUG() out when encountering an unexpected command.

This needs to be reviewed by somebody who is more familiar with the rebase/chrry-pick/revert/sequencer codepaths so that they can give a definitive "good--I know that we never call this function with any other value in 'me'" and that person would not be me.

> Arguably, it would be cleaner to pass the command as an enum in the
> first place ...
True, but that can be left to a different topic, I would think.
Thanks.
Show 23 quoted lines
> Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
> Cc: Junio C Hamano <gitster@pobox.com>
> ---
>  advice.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/advice.c b/advice.c
> index d6232439c3..c35ae82e7d 100644
> --- a/advice.c
> +++ b/advice.c
> @@ -190,9 +190,10 @@ int error_resolve_conflict(const char *me)
>  		error(_("Pulling is not possible because you have unmerged files."));
>  	else if (!strcmp(me, "revert"))
>  		error(_("Reverting is not possible because you have unmerged files."));
> +	else if (!strcmp(me, "rebase"))
> +		error(_("Rebasing is not possible because you have unmerged files."));
>  	else
> -		error(_("It is not possible to %s because you have unmerged files."),
> -			me);
> +		BUG("Unhandled conflict reason '%s'", me);
>  
>  	if (advice_enabled(ADVICE_RESOLVE_CONFLICT))
>  		/*
Previous: Junio C HamanoNext: Oswald Buddenhagen
Message 17 of 21 in “Capitalization and punctuation fixes to some user visible messages”
  1. 1/3 Capitalization and punctuation fixes to some user visible messagesOswald Buddenhagen, Mar 23, 2023
  2. 3/3 advice: translate all actions in error_resolve_conflict()Oswald Buddenhagen, Mar 23, 2023
  3. Junio C HamanoMar 24, 2023
  4. 2/3 sequencer: actually translate report in do_exec()Oswald Buddenhagen, Mar 23, 2023
  5. Junio C HamanoMar 23, 2023
  6. Oswald BuddenhagenMar 23, 2023
  7. Junio C HamanoMar 23, 2023
  8. Oswald BuddenhagenMar 23, 2023
  9. Junio C HamanoMar 23, 2023
  10. Oswald BuddenhagenMar 23, 2023
  11. 1/3 advice: handle "rebase" in error_resolve_conflict()Oswald Buddenhagen, Apr 28, 2023
  12. 2/3 sequencer: actually translate report in do_exec()Oswald Buddenhagen, Apr 28, 2023
  13. Junio C HamanoApr 28, 2023
  14. 3/3 Capitalization and punctuation fixes to some user visible messagesOswald Buddenhagen, Apr 28, 2023
  15. Junio C HamanoApr 28, 2023
  16. Junio C HamanoApr 28, 2023
  17. Junio C HamanoApr 28, 2023
  18. Oswald BuddenhagenApr 29, 2023
  19. Junio C HamanoApr 30, 2023
  20. advice: handle "rebase" in error_resolve_conflict()Oswald Buddenhagen, Aug 7, 2023
  21. Junio C HamanoAug 7, 2023

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.