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

Re: [PATCH 1/4] status: factor two rebase-related messages together

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 8, 2015, 22:00 UTC
Message-ID
<xmqqbngp97yp.fsf@gitster.dls.corp.google.com>
In-Reply-To
<1433368825-24617-1-git-send-email-guillaume.pages@ensimag.grenoble-inp.fr>
Guillaume Pagès  <guillaume.pages@ensimag.grenoble-inp.fr> writes:
> ---
>  wt-status.c | 30 +++++++++++-------------------
>  1 file changed, 11 insertions(+), 19 deletions(-)

Hmmm, it obviously does not break anything but it is not obvious why this is a good change.

Is it that you wanted to have a single instance of "if on a branch, we say 'you are rebasing that branch', otherwise we say 'you are rebasing'"? Even then, I am not sure if this code movement was the best way to do so (an obvious alternative is to use a shared helper function and call from the two arms of if/elseif/... chain).

Show 50 quoted lines
>
> diff --git a/wt-status.c b/wt-status.c
> index 33452f1..fec6e85 100644
> --- a/wt-status.c
> +++ b/wt-status.c
> @@ -1032,7 +1032,7 @@ static void show_rebase_in_progress(struct wt_status *s,
>  {
>  	struct stat st;
>  
> -	if (has_unmerged(s)) {
> +	if (has_unmerged(s) || state->rebase_in_progress || !stat(git_path("MERGE_MSG"), &st)) {
>  		if (state->branch)
>  			status_printf_ln(s, color,
>  					 _("You are currently rebasing branch '%s' on '%s'."),
> @@ -1042,25 +1042,17 @@ static void show_rebase_in_progress(struct wt_status *s,
>  			status_printf_ln(s, color,
>  					 _("You are currently rebasing."));
>  		if (s->hints) {
> -			status_printf_ln(s, color,
> -				_("  (fix conflicts and then run \"git rebase --continue\")"));
> -			status_printf_ln(s, color,
> -				_("  (use \"git rebase --skip\" to skip this patch)"));
> -			status_printf_ln(s, color,
> -				_("  (use \"git rebase --abort\" to check out the original branch)"));
> +			if (has_unmerged(s)) {
> +				status_printf_ln(s, color,
> +					_("  (fix conflicts and then run \"git rebase --continue\")"));
> +				status_printf_ln(s, color,
> +					_("  (use \"git rebase --skip\" to skip this patch)"));
> +				status_printf_ln(s, color,
> +					_("  (use \"git rebase --abort\" to check out the original branch)"));
> +			} else
> +				status_printf_ln(s, color,
> +					_("  (all conflicts fixed: run \"git rebase --continue\")"));
>  		}
> -	} else if (state->rebase_in_progress || !stat(git_path("MERGE_MSG"), &st)) {
> -		if (state->branch)
> -			status_printf_ln(s, color,
> -					 _("You are currently rebasing branch '%s' on '%s'."),
> -					 state->branch,
> -					 state->onto);
> -		else
> -			status_printf_ln(s, color,
> -					 _("You are currently rebasing."));
> -		if (s->hints)
> -			status_printf_ln(s, color,
> -				_("  (all conflicts fixed: run \"git rebase --continue\")"));
>  	} else if (split_commit_in_progress(s)) {
>  		if (state->branch)
>  			status_printf_ln(s, color,
Previous: Matthieu MoyNext: Guillaume Pages
Message 10 of 11 in “status: factor two rebase-related messages together”
  1. 1/4 status: factor two rebase-related messages togetherGuillaume Pagès, Jun 3, 2015
  2. 2/4 status: differentiate interactive from non-interactive rebasesGuillaume Pagès, Jun 3, 2015
  3. 3/4 status: give more information during rebase -iGuillaume Pagès, Jun 3, 2015
  4. Matthieu MoyJun 4, 2015
  5. Junio C HamanoJun 4, 2015
  6. Guillaume PagesJun 5, 2015
  7. Junio C HamanoJun 5, 2015
  8. 4/4 status: add new tests for status during rebase -iGuillaume Pagès, Jun 3, 2015
  9. Matthieu MoyJun 4, 2015
  10. Junio C HamanoJun 8, 2015
  11. Guillaume PagesJun 9, 2015

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.