Skip to content

Commit 37e9ee5

Browse files
phillipwoodgitster
authored andcommitted
sequencer: return errors from sequencer_remove_state()
If there is an error when removing the state directory then we should report it. This matches what the non-interactive rebase does. Signed-off-by: Phillip Wood <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent d3fce47 commit 37e9ee5

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

sequencer.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ static const char *gpg_sign_opt_quoted(struct replay_opts *opts)
274274
int sequencer_remove_state(struct replay_opts *opts)
275275
{
276276
struct strbuf buf = STRBUF_INIT;
277-
int i;
277+
int i, ret = 0;
278278

279279
if (is_rebase_i(opts) &&
280280
strbuf_read_file(&buf, rebase_path_refs_to_delete(), 0) > 0) {
@@ -283,8 +283,10 @@ int sequencer_remove_state(struct replay_opts *opts)
283283
char *eol = strchr(p, '\n');
284284
if (eol)
285285
*eol = '\0';
286-
if (delete_ref("(rebase -i) cleanup", p, NULL, 0) < 0)
286+
if (delete_ref("(rebase -i) cleanup", p, NULL, 0) < 0) {
287287
warning(_("could not delete '%s'"), p);
288+
ret = -1;
289+
}
288290
if (!eol)
289291
break;
290292
p = eol + 1;
@@ -300,10 +302,11 @@ int sequencer_remove_state(struct replay_opts *opts)
300302

301303
strbuf_reset(&buf);
302304
strbuf_addstr(&buf, get_dir(opts));
303-
remove_dir_recursively(&buf, 0);
305+
if (remove_dir_recursively(&buf, 0))
306+
ret = error(_("could not remove '%s'"), buf.buf);
304307
strbuf_release(&buf);
305308

306-
return 0;
309+
return ret;
307310
}
308311

309312
static const char *action_name(const struct replay_opts *opts)

0 commit comments

Comments
 (0)