diff options
author | Pratik Karki <predatoramigo@gmail.com> | 2018-08-08 20:51:19 +0545 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-09-06 11:55:58 -0700 |
commit | 5a61494539bb549127695d42d7160f0562ed7bf7 (patch) | |
tree | b3c9eb24989f39d69090a0e4e8a7ae2d2b7f5e17 /builtin | |
parent | builtin rebase: support --abort (diff) | |
download | tgif-5a61494539bb549127695d42d7160f0562ed7bf7.tar.xz |
builtin rebase: support --quit
With this patch, the builtin rebase handles the `--quit` action which
can be used to abort a rebase without rolling back any changes performed
during the rebase (this is useful when a user forgot that they were in
the middle of a rebase and continued working normally).
Signed-off-by: Pratik Karki <predatoramigo@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/rebase.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/builtin/rebase.c b/builtin/rebase.c index ceb786d3a0..f64fa42422 100644 --- a/builtin/rebase.c +++ b/builtin/rebase.c @@ -471,6 +471,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix) ACTION_CONTINUE, ACTION_SKIP, ACTION_ABORT, + ACTION_QUIT, } action = NO_ACTION; struct option builtin_rebase_options[] = { OPT_STRING(0, "onto", &options.onto_name, @@ -500,6 +501,8 @@ int cmd_rebase(int argc, const char **argv, const char *prefix) OPT_CMDMODE(0, "abort", &action, N_("abort and check out the original branch"), ACTION_ABORT), + OPT_CMDMODE(0, "quit", &action, + N_("abort but keep HEAD where it is"), ACTION_QUIT), OPT_END(), }; @@ -628,6 +631,14 @@ int cmd_rebase(int argc, const char **argv, const char *prefix) ret = finish_rebase(&options); goto cleanup; } + case ACTION_QUIT: { + strbuf_reset(&buf); + strbuf_addstr(&buf, options.state_dir); + ret = !!remove_dir_recursively(&buf, 0); + if (ret) + die(_("could not remove '%s'"), options.state_dir); + goto cleanup; + } default: die("TODO"); } |