summaryrefslogtreecommitdiff
path: root/builtin/rebase--helper.c
diff options
context:
space:
mode:
authorLibravatar Alban Gruin <alban.gruin@gmail.com>2018-08-10 18:51:34 +0200
committerLibravatar Junio C Hamano <gitster@pobox.com>2018-08-10 11:56:22 -0700
commit4df66c40b08931eb224964f12decbb0f660cf932 (patch)
treed50cbac660ed4085f7477a56beb248abfdc90221 /builtin/rebase--helper.c
parentrebase -i: rewrite setup_reflog_action() in C (diff)
downloadtgif-4df66c40b08931eb224964f12decbb0f660cf932.tar.xz
rebase -i: rewrite checkout_onto() in C
This rewrites checkout_onto() from shell to C. A new command (“checkout-onto”) is added to rebase--helper.c. The shell version is then stripped. Signed-off-by: Alban Gruin <alban.gruin@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/rebase--helper.c')
-rw-r--r--builtin/rebase--helper.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/builtin/rebase--helper.c b/builtin/rebase--helper.c
index 0e76dadba6..7d9426d23c 100644
--- a/builtin/rebase--helper.c
+++ b/builtin/rebase--helper.c
@@ -18,7 +18,8 @@ int cmd_rebase__helper(int argc, const char **argv, const char *prefix)
enum {
CONTINUE = 1, ABORT, MAKE_SCRIPT, SHORTEN_OIDS, EXPAND_OIDS,
CHECK_TODO_LIST, SKIP_UNNECESSARY_PICKS, REARRANGE_SQUASH,
- ADD_EXEC, APPEND_TODO_HELP, EDIT_TODO, PREPARE_BRANCH
+ ADD_EXEC, APPEND_TODO_HELP, EDIT_TODO, PREPARE_BRANCH,
+ CHECKOUT_ONTO
} command = 0;
struct option options[] = {
OPT_BOOL(0, "ff", &opts.allow_ff, N_("allow fast-forward")),
@@ -54,6 +55,8 @@ int cmd_rebase__helper(int argc, const char **argv, const char *prefix)
EDIT_TODO),
OPT_CMDMODE(0, "prepare-branch", &command,
N_("prepare the branch to be rebased"), PREPARE_BRANCH),
+ OPT_CMDMODE(0, "checkout-onto", &command,
+ N_("checkout a commit"), CHECKOUT_ONTO),
OPT_END()
};
@@ -99,5 +102,7 @@ int cmd_rebase__helper(int argc, const char **argv, const char *prefix)
return !!edit_todo_list(flags);
if (command == PREPARE_BRANCH && argc == 2)
return !!prepare_branch_to_be_rebased(&opts, argv[1]);
+ if (command == CHECKOUT_ONTO && argc == 4)
+ return !!checkout_onto(&opts, argv[1], argv[2], argv[3]);
usage_with_options(builtin_rebase_helper_usage, options);
}