bisect: refactor bisect_run() to match CodingGuidelines
We didn't add "{}" to all "if/else" branches, and one "error" was mis-indented. Let's fix that first, which makes subsequent commits smaller. In the case of the "if" we can simply early return instead. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com> Signed-off-by: Taylor Blau <me@ttaylorr.com>
Ævar Arnfjörð Bjarmason committed
Nov 10, 2022 at 23:36 UTC
bdd2aa8a8bc46efce4a300d3cd6e169d89e99bc8
1 file changed
+3
-4
builtin/bisect--helper.c
+3
-4
@@ -1191,13 +1191,12 @@ static int bisect_run(struct bisect_terms *terms, const char **argv, int argc)
1191
if (bisect_next_check(terms, NULL))
1192
return BISECT_FAILED;
1193
1194
- if (argc)
1195
- sq_quote_argv(&command, argv);
1196
- else {
1194
+ if (!argc) {
1195
error(_("bisect run failed: no command provided."));
1196
return BISECT_FAILED;
1197
}
1198
1199
+ sq_quote_argv(&command, argv);
1200
while (1) {
1201
res = do_bisect_run(command.buf);
1202
@@ -1268,7 +1267,7 @@ static int bisect_run(struct bisect_terms *terms, const char **argv, int argc)
1267
res = BISECT_OK;
1268
} else if (res) {
1269
error(_("bisect run failed: 'git bisect--helper --bisect-state"
1271
- " %s' exited with error code %d"), new_state, res);
1270
+ " %s' exited with error code %d"), new_state, res);
1271
} else {
1272
continue;
1273
}