Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
builtin rebase: support --abort
author
Pratik Karki
<predatoramigo@gmail.com>
Wed, 8 Aug 2018 15:06:18 +0000
(20:51 +0545)
committer
Junio C Hamano
<gitster@pobox.com>
Thu, 6 Sep 2018 18:55:58 +0000
(11:55 -0700)
This commit teaches the builtin rebase the "abort" action, which a user
can call to roll back a rebase that is in progress.
Signed-off-by: Pratik Karki <predatoramigo@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/rebase.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
122420c
)
diff --git
a/builtin/rebase.c
b/builtin/rebase.c
index c477108f796fbb600d0931bf8622619ea34b234c..ceb786d3a052a5efa55176dbd219c0ceaa249617 100644
(file)
--- a/
builtin/rebase.c
+++ b/
builtin/rebase.c
@@
-470,6
+470,7
@@
int cmd_rebase(int argc, const char **argv, const char *prefix)
NO_ACTION,
ACTION_CONTINUE,
ACTION_SKIP,
NO_ACTION,
ACTION_CONTINUE,
ACTION_SKIP,
+ ACTION_ABORT,
} action = NO_ACTION;
struct option builtin_rebase_options[] = {
OPT_STRING(0, "onto", &options.onto_name,
} action = NO_ACTION;
struct option builtin_rebase_options[] = {
OPT_STRING(0, "onto", &options.onto_name,
@@
-496,6
+497,9
@@
int cmd_rebase(int argc, const char **argv, const char *prefix)
ACTION_CONTINUE),
OPT_CMDMODE(0, "skip", &action,
N_("skip current patch and continue"), ACTION_SKIP),
ACTION_CONTINUE),
OPT_CMDMODE(0, "skip", &action,
N_("skip current patch and continue"), ACTION_SKIP),
+ OPT_CMDMODE(0, "abort", &action,
+ N_("abort and check out the original branch"),
+ ACTION_ABORT),
OPT_END(),
};
OPT_END(),
};
@@
-608,6
+612,22
@@
int cmd_rebase(int argc, const char **argv, const char *prefix)
exit(1);
goto run_rebase;
}
exit(1);
goto run_rebase;
}
+ case ACTION_ABORT: {
+ struct string_list merge_rr = STRING_LIST_INIT_DUP;
+ options.action = "abort";
+
+ rerere_clear(&merge_rr);
+ string_list_clear(&merge_rr, 1);
+
+ if (read_basic_state(&options))
+ exit(1);
+ if (reset_head(&options.orig_head, "reset",
+ options.head_name, 0) < 0)
+ die(_("could not move back to %s"),
+ oid_to_hex(&options.orig_head));
+ ret = finish_rebase(&options);
+ goto cleanup;
+ }
default:
die("TODO");
}
default:
die("TODO");
}