Message ID | 20200717105406.82226-2-mirucam@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Finish converting git bisect to C part 2 | expand |
Hello Miriam, > In cmd_bisect__helper() function, there would be a bug > if an invalid or no subcommand was passed.return error() > should be replaced by BUG() in that case. > Mentored-by: Christian Couder <chriscool@tuxfamily.org> > Mentored-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> > Signed-off-by: Miriam Rubio <mirucam@gmail.com> > --- I think we can try for a better message. Maybe something like: One encounters a BUG when an invalid or no subcommand is passed to 'cmd_bisect__helper()'. BUG() out instead of returning an error. > - return error("BUG: unknown subcommand '%d'", cmdmode); > + BUG("unknown subcommand %d", (int)cmdmode); Do we need to typecast an integer to an integer here? Regards, Shourya Shukla
diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index ec4996282e..c452d3f6b7 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -716,7 +716,7 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) res = bisect_start(&terms, no_checkout, argv, argc); break; default: - return error("BUG: unknown subcommand '%d'", cmdmode); + BUG("unknown subcommand %d", (int)cmdmode); } free_terms(&terms);
In cmd_bisect__helper() function, there would be a bug if an invalid or no subcommand was passed.return error() should be replaced by BUG() in that case. Mentored-by: Christian Couder <chriscool@tuxfamily.org> Mentored-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Miriam Rubio <mirucam@gmail.com> --- builtin/bisect--helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)