Skip to content

Commit 35f070b

Browse files
phillipwoodgitster
authored andcommitted
rebase: use our standard error return value
Git uses −1 to signal an error. The builtin rebase converts these to +1 all over the place using !! (presumably because the in the scripted version an error was signalled by +1). This is confusing and clutters the code, we only need to convert the value when the function returns. Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent d045719 commit 35f070b

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

builtin/rebase.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1575,7 +1575,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
15751575
die(_("could not move back to %s"),
15761576
oid_to_hex(&options.orig_head));
15771577
remove_branch_state(the_repository, 0);
1578-
ret = !!finish_rebase(&options);
1578+
ret = finish_rebase(&options);
15791579
goto cleanup;
15801580
}
15811581
case ACTION_QUIT: {
@@ -1584,11 +1584,11 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
15841584
struct replay_opts replay = REPLAY_OPTS_INIT;
15851585

15861586
replay.action = REPLAY_INTERACTIVE_REBASE;
1587-
ret = !!sequencer_remove_state(&replay);
1587+
ret = sequencer_remove_state(&replay);
15881588
} else {
15891589
strbuf_reset(&buf);
15901590
strbuf_addstr(&buf, options.state_dir);
1591-
ret = !!remove_dir_recursively(&buf, 0);
1591+
ret = remove_dir_recursively(&buf, 0);
15921592
if (ret)
15931593
error(_("could not remove '%s'"),
15941594
options.state_dir);
@@ -1960,7 +1960,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
19601960

19611961
if (require_clean_work_tree(the_repository, "rebase",
19621962
_("Please commit or stash them."), 1, 1)) {
1963-
ret = 1;
1963+
ret = -1;
19641964
goto cleanup;
19651965
}
19661966

@@ -1995,7 +1995,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
19951995
RESET_HEAD_RUN_POST_CHECKOUT_HOOK,
19961996
NULL, buf.buf,
19971997
DEFAULT_REFLOG_ACTION) < 0) {
1998-
ret = !!error(_("could not switch to "
1998+
ret = error(_("could not switch to "
19991999
"%s"),
20002000
options.switch_to);
20012001
goto cleanup;
@@ -2010,7 +2010,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
20102010
else
20112011
printf(_("Current branch %s is up to date.\n"),
20122012
branch_name);
2013-
ret = !!finish_rebase(&options);
2013+
ret = finish_rebase(&options);
20142014
goto cleanup;
20152015
} else if (!(options.flags & REBASE_NO_QUIET))
20162016
; /* be quiet */
@@ -2088,7 +2088,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
20882088
RESET_HEAD_REFS_ONLY, "HEAD", msg.buf,
20892089
DEFAULT_REFLOG_ACTION);
20902090
strbuf_release(&msg);
2091-
ret = !!finish_rebase(&options);
2091+
ret = finish_rebase(&options);
20922092
goto cleanup;
20932093
}
20942094

@@ -2102,7 +2102,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
21022102
options.revisions = revisions.buf;
21032103

21042104
run_rebase:
2105-
ret = !!run_specific_rebase(&options, action);
2105+
ret = run_specific_rebase(&options, action);
21062106

21072107
cleanup:
21082108
strbuf_release(&buf);
@@ -2113,5 +2113,5 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
21132113
free(options.strategy);
21142114
strbuf_release(&options.git_format_patch_opt);
21152115
free(squash_onto_name);
2116-
return ret;
2116+
return !!ret;
21172117
}

0 commit comments

Comments
 (0)