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

Re: [PATCH] rebase: simplify an assignment of options.type in cmd_rebase

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 18, 2022, 17:07 UTC
Message-ID
<xmqqr15uxqvc.fsf@gitster.g>
In-Reply-To
<20220418164359.205723-1-eantoranz@gmail.com>
Edmundo Carmona Antoranz <eantoranz@gmail.com> writes:
Show 21 quoted lines
> There is an if statement where both if and else have the same
> assignment of options.type to REBASE_MERGE. Simplify
> it by getting that assigmnent out of the if.
>
> Signed-off-by: Edmundo Carmona Antoranz <eantoranz@gmail.com>
> ---
>  builtin/rebase.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/builtin/rebase.c b/builtin/rebase.c
> index 27fde7bf28..d2d63bdef1 100644
> --- a/builtin/rebase.c
> +++ b/builtin/rebase.c
> @@ -1187,11 +1187,9 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
>  		} else {
>  			strbuf_reset(&buf);
>  			strbuf_addf(&buf, "%s/interactive", merge_dir());
> -			if(file_exists(buf.buf)) {
> -				options.type = REBASE_MERGE;
> +			options.type = REBASE_MERGE;
> +			if(file_exists(buf.buf))

Perhaps fix the style as we are changing the line anyway by losing {}? i.e.

			if (file_exists(buf.buf))
Show 6 quoted lines
>  				options.flags |= REBASE_INTERACTIVE_EXPLICIT;
> -			} else
> -				options.type = REBASE_MERGE;
>  		}
>  		options.state_dir = merge_dir();
>  	}
Other than that, good finding!
Previous: Edmundo Carmona Antoranz
Message 2 of 2 in “rebase: simplify an assignment of options.type in cmd_rebase”
  1. rebase: simplify an assignment of options.type in cmd_rebaseEdmundo Carmona Antoranz, Apr 18, 2022
  2. Junio C HamanoApr 18, 2022

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.