{"thread":{"id":"57757","subject":"[PATCH v2] rebase: simplify an assignment of options.type in cmd_rebase","startedAt":"2022-04-18T17:27:59Z","lastAt":"2022-04-18T17:27:59Z","messageCount":1,"participants":["Edmundo Carmona Antoranz"],"isPatch":true,"patchVersion":2,"patchTotal":null},"messages":[{"id":"453892","messageId":"20220418172721.215898-1-eantoranz@gmail.com","threadId":"57757","inReplyTo":null,"subject":"[PATCH v2] rebase: simplify an assignment of options.type in cmd_rebase","fromName":"Edmundo Carmona Antoranz","fromEmail":"eantoranz@gmail.com","sentAt":"2022-04-18T17:27:21Z","receivedAt":"2022-04-18T17:27:59Z","isPatch":true,"sender":{"key":"eantoranz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1491018?v=4"},"body":"There is an if statement where both if and else have the same\nassignment of options.type to REBASE_MERGE. Simplify\nit by getting that assigmnent out of the if.\n\nSigned-off-by: Edmundo Carmona Antoranz <eantoranz@gmail.com>\n---\nRange-diff:\n1:  7b6483fcce ! 1:  959aff8b8e rebase: simplify an assignment of options.type in cmd_rebase\n    @@ builtin/rebase.c: int cmd_rebase(int argc, const char **argv, const char *prefix\n     -\t\t\tif(file_exists(buf.buf)) {\n     -\t\t\t\toptions.type = REBASE_MERGE;\n     +\t\t\toptions.type = REBASE_MERGE;\n    -+\t\t\tif(file_exists(buf.buf))\n    ++\t\t\tif (file_exists(buf.buf))\n      \t\t\t\toptions.flags |= REBASE_INTERACTIVE_EXPLICIT;\n     -\t\t\t} else\n     -\t\t\t\toptions.type = REBASE_MERGE;\n\n builtin/rebase.c | 6 ++----\n 1 file changed, 2 insertions(+), 4 deletions(-)\n\ndiff --git a/builtin/rebase.c b/builtin/rebase.c\nindex 27fde7bf28..baf7a0bb36 100644\n--- a/builtin/rebase.c\n+++ b/builtin/rebase.c\n@@ -1187,11 +1187,9 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)\n \t\t} else {\n \t\t\tstrbuf_reset(&buf);\n \t\t\tstrbuf_addf(&buf, \"%s/interactive\", merge_dir());\n-\t\t\tif(file_exists(buf.buf)) {\n-\t\t\t\toptions.type = REBASE_MERGE;\n+\t\t\toptions.type = REBASE_MERGE;\n+\t\t\tif (file_exists(buf.buf))\n \t\t\t\toptions.flags |= REBASE_INTERACTIVE_EXPLICIT;\n-\t\t\t} else\n-\t\t\t\toptions.type = REBASE_MERGE;\n \t\t}\n \t\toptions.state_dir = merge_dir();\n \t}\n-- \n2.35.1\n\n"}]}