Skip to content

Commit

Permalink
built-in rebase --skip/--abort: clean up stale .git/<name> files
Browse files Browse the repository at this point in the history
The scripted version of the rebase used to execute `git reset --hard`
when skipping or aborting. When we ported this to C, we did update the
worktree and some reflogs, but we failed to imitate `git reset --hard`'s
behavior regarding files in .git/ such as MERGE_HEAD.

Let's address this oversight.

Signed-off-by: Johannes Schindelin <[email protected]>
  • Loading branch information
dscho committed Nov 15, 2018
1 parent 94e041a commit eff1e59
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions builtin/rebase.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "wt-status.h"
#include "revision.h"
#include "rerere.h"
#include "branch.h"

static char const * const builtin_rebase_usage[] = {
N_("git rebase [-i] [options] [--exec <cmd>] [--onto <newbase>] "
Expand Down Expand Up @@ -1001,6 +1002,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)

if (reset_head(NULL, "reset", NULL, 0, NULL, NULL) < 0)
die(_("could not discard worktree changes"));
remove_branch_state();
if (read_basic_state(&options))
exit(1);
goto run_rebase;
Expand All @@ -1018,6 +1020,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
options.head_name, 0, NULL, NULL) < 0)
die(_("could not move back to %s"),
oid_to_hex(&options.orig_head));
remove_branch_state();
ret = finish_rebase(&options);
goto cleanup;
}
Expand Down

0 comments on commit eff1e59

Please sign in to comment.