diff mbox series

[v4,4/7] bisect--helper: use `res` instead of return in BISECT_RESET case option

Message ID 20210125191710.45161-5-mirucam@gmail.com (mailing list archive)
State Superseded
Headers show
Series Finish converting git bisect to C part 3 | expand

Commit Message

Miriam R. Jan. 25, 2021, 7:17 p.m. UTC
From: Pranit Bauva <pranit.bauva@gmail.com>

Use `res` variable to store `bisect_reset()` output in BISECT_RESET
case option to make bisect--helper.c more consistent.

Mentored-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Miriam Rubio <mirucam@gmail.com>
---
 builtin/bisect--helper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Christian Couder Jan. 29, 2021, 7:57 a.m. UTC | #1
On Mon, Jan 25, 2021 at 8:17 PM Miriam Rubio <mirucam@gmail.com> wrote:

> @@ -1043,7 +1043,7 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix)
>         case BISECT_RESET:
>                 if (argc > 1)
>                         return error(_("--bisect-reset requires either no argument or a commit"));
> -               return !!bisect_reset(argc ? argv[0] : NULL);
> +               res = bisect_reset(argc ? argv[0] : NULL);
>                 break;

This "break;" was not necessary before but it becomes necessary when
the above "return ..." is replaced with something else.

>         case CHECK_AND_SET_TERMS:
>                 if (argc != 3)
diff mbox series

Patch

diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c
index 0b16653f13..8232e795fa 100644
--- a/builtin/bisect--helper.c
+++ b/builtin/bisect--helper.c
@@ -1043,7 +1043,7 @@  int cmd_bisect__helper(int argc, const char **argv, const char *prefix)
 	case BISECT_RESET:
 		if (argc > 1)
 			return error(_("--bisect-reset requires either no argument or a commit"));
-		return !!bisect_reset(argc ? argv[0] : NULL);
+		res = bisect_reset(argc ? argv[0] : NULL);
 		break;
 	case CHECK_AND_SET_TERMS:
 		if (argc != 3)