diff options
author | Junio C Hamano <gitster@pobox.com> | 2019-07-29 22:38:20 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-07-29 22:38:20 +0300 |
commit | 649cae69bc8cc99fd5a9e72f8a08ae301d0d5e16 (patch) | |
tree | dacfd5d2a4738af3ffffd3215f9cb2fd090336e7 /sequencer.c | |
parent | 39521d07bedc4a8f1f8891ff1bc0a5b34213504f (diff) | |
parent | d559f502c59658ea1f360fd28d8909894e40a4fe (diff) |
Merge branch 'pw/rebase-abort-clean-rewritten' into maint
"git rebase --abort" used to leave refs/rewritten/ when concluding
"git rebase -r", which has been corrected.
* pw/rebase-abort-clean-rewritten:
rebase --abort/--quit: cleanup refs/rewritten
sequencer: return errors from sequencer_remove_state()
rebase: warn if state directory cannot be removed
rebase: fix a memory leak
Diffstat (limited to 'sequencer.c')
-rw-r--r-- | sequencer.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/sequencer.c b/sequencer.c index 63b09cfceb..1d206fd224 100644 --- a/sequencer.c +++ b/sequencer.c @@ -279,7 +279,7 @@ static const char *gpg_sign_opt_quoted(struct replay_opts *opts) int sequencer_remove_state(struct replay_opts *opts) { struct strbuf buf = STRBUF_INIT; - int i; + int i, ret = 0; if (is_rebase_i(opts) && strbuf_read_file(&buf, rebase_path_refs_to_delete(), 0) > 0) { @@ -288,8 +288,10 @@ int sequencer_remove_state(struct replay_opts *opts) char *eol = strchr(p, '\n'); if (eol) *eol = '\0'; - if (delete_ref("(rebase -i) cleanup", p, NULL, 0) < 0) + if (delete_ref("(rebase -i) cleanup", p, NULL, 0) < 0) { warning(_("could not delete '%s'"), p); + ret = -1; + } if (!eol) break; p = eol + 1; @@ -305,10 +307,11 @@ int sequencer_remove_state(struct replay_opts *opts) strbuf_reset(&buf); strbuf_addstr(&buf, get_dir(opts)); - remove_dir_recursively(&buf, 0); + if (remove_dir_recursively(&buf, 0)) + ret = error(_("could not remove '%s'"), buf.buf); strbuf_release(&buf); - return 0; + return ret; } static const char *action_name(const struct replay_opts *opts) |