* [PATCH] rebase: simplify an assignment of options.type in cmd_rebase
@ 2022-04-18 16:43 Edmundo Carmona Antoranz
2022-04-18 17:07 ` Junio C Hamano
0 siblings, 1 reply; 2+ messages in thread
From: Edmundo Carmona Antoranz @ 2022-04-18 16:43 UTC (permalink / raw)
To: git; +Cc: Edmundo Carmona Antoranz
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))
options.flags |= REBASE_INTERACTIVE_EXPLICIT;
- } else
- options.type = REBASE_MERGE;
}
options.state_dir = merge_dir();
}
--
2.35.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] rebase: simplify an assignment of options.type in cmd_rebase
2022-04-18 16:43 [PATCH] rebase: simplify an assignment of options.type in cmd_rebase Edmundo Carmona Antoranz
@ 2022-04-18 17:07 ` Junio C Hamano
0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2022-04-18 17:07 UTC (permalink / raw)
To: Edmundo Carmona Antoranz; +Cc: git
Edmundo Carmona Antoranz <eantoranz@gmail.com> writes:
> 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))
> options.flags |= REBASE_INTERACTIVE_EXPLICIT;
> - } else
> - options.type = REBASE_MERGE;
> }
> options.state_dir = merge_dir();
> }
Other than that, good finding!
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-04-18 17:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-18 16:43 [PATCH] rebase: simplify an assignment of options.type in cmd_rebase Edmundo Carmona Antoranz
2022-04-18 17:07 ` Junio C Hamano
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.