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> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Johannes Schindelin committed
Nov 12, 2018 at 15:26 UTC
5aec9271d343f117eb075a2b7038481f0d9f276f
1 file changed
+3
builtin/rebase.c
+3
@@ -23,6 +23,7 @@
23
#include "revision.h"
24
#include "commit-reach.h"
25
#include "rerere.h"
26
+#include "branch.h"
27
28
static char const * const builtin_rebase_usage[] = {
29
N_("git rebase [-i] [options] [--exec <cmd>] [--onto <newbase>] "
@@ -1002,6 +1003,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
1003
1004
if (reset_head(NULL, "reset", NULL, 0, NULL, NULL) < 0)
1005
die(_("could not discard worktree changes"));
1006
+ remove_branch_state();
1007
if (read_basic_state(&options))
1008
exit(1);
1009
goto run_rebase;
@@ -1019,6 +1021,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
1021
options.head_name, 0, NULL, NULL) < 0)
1022
die(_("could not move back to %s"),
1023
oid_to_hex(&options.orig_head));
1024
+ remove_branch_state();
1025
ret = finish_rebase(&options);
1026
goto cleanup;
1027
}