Skip to content

Commit eff1e59

Browse files
committed
built-in rebase --skip/--abort: clean up stale .git/<name> files
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 <johannes.schindelin@gmx.de>
1 parent 94e041a commit eff1e59

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

builtin/rebase.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include "wt-status.h"
2323
#include "revision.h"
2424
#include "rerere.h"
25+
#include "branch.h"
2526

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

10021003
if (reset_head(NULL, "reset", NULL, 0, NULL, NULL) < 0)
10031004
die(_("could not discard worktree changes"));
1005+
remove_branch_state();
10041006
if (read_basic_state(&options))
10051007
exit(1);
10061008
goto run_rebase;
@@ -1018,6 +1020,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
10181020
options.head_name, 0, NULL, NULL) < 0)
10191021
die(_("could not move back to %s"),
10201022
oid_to_hex(&options.orig_head));
1023+
remove_branch_state();
10211024
ret = finish_rebase(&options);
10221025
goto cleanup;
10231026
}

0 commit comments

Comments
 (0)