summaryrefslogtreecommitdiff
path: root/builtin/rebase--helper.c
diff options
context:
space:
mode:
authorJohannes Schindelin <johannes.schindelin@gmx.de>2017-07-14 14:45:11 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-07-27 22:35:05 (GMT)
commit3546c8d927d31048f0d6f41aa132ebdb82cf8bda (patch)
treea55c2138c0cc1d80b83390964d929bde54f520d7 /builtin/rebase--helper.c
parent1f4044af7f35f9979d464bc2009b554e8e9dfb99 (diff)
downloadgit-3546c8d927d31048f0d6f41aa132ebdb82cf8bda.zip
git-3546c8d927d31048f0d6f41aa132ebdb82cf8bda.tar.gz
git-3546c8d927d31048f0d6f41aa132ebdb82cf8bda.tar.bz2
rebase -i: also expand/collapse the SHA-1s via the rebase--helper
This is crucial to improve performance on Windows, as the speed is now mostly dominated by the SHA-1 transformation (because it spawns a new rev-parse process for *every* line, and spawning processes is pretty slow from Git for Windows' MSYS2 Bash). Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/rebase--helper.c')
-rw-r--r--builtin/rebase--helper.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/builtin/rebase--helper.c b/builtin/rebase--helper.c
index 6130532..791b629 100644
--- a/builtin/rebase--helper.c
+++ b/builtin/rebase--helper.c
@@ -14,7 +14,7 @@ int cmd_rebase__helper(int argc, const char **argv, const char *prefix)
struct replay_opts opts = REPLAY_OPTS_INIT;
int keep_empty = 0;
enum {
- CONTINUE = 1, ABORT, MAKE_SCRIPT
+ CONTINUE = 1, ABORT, MAKE_SCRIPT, SHORTEN_SHA1S, EXPAND_SHA1S
} command = 0;
struct option options[] = {
OPT_BOOL(0, "ff", &opts.allow_ff, N_("allow fast-forward")),
@@ -25,6 +25,10 @@ int cmd_rebase__helper(int argc, const char **argv, const char *prefix)
ABORT),
OPT_CMDMODE(0, "make-script", &command,
N_("make rebase script"), MAKE_SCRIPT),
+ OPT_CMDMODE(0, "shorten-ids", &command,
+ N_("shorten SHA-1s in the todo list"), SHORTEN_SHA1S),
+ OPT_CMDMODE(0, "expand-ids", &command,
+ N_("expand SHA-1s in the todo list"), EXPAND_SHA1S),
OPT_END()
};
@@ -43,5 +47,9 @@ int cmd_rebase__helper(int argc, const char **argv, const char *prefix)
return !!sequencer_remove_state(&opts);
if (command == MAKE_SCRIPT && argc > 1)
return !!sequencer_make_script(keep_empty, stdout, argc, argv);
+ if (command == SHORTEN_SHA1S && argc == 1)
+ return !!transform_todo_ids(1);
+ if (command == EXPAND_SHA1S && argc == 1)
+ return !!transform_todo_ids(0);
usage_with_options(builtin_rebase_helper_usage, options);
}