From: Johannes Schindelin <johannes.schindelin@gmx.de>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>,
Philip Oakley <philipoakley@iee.org>, Jeff King <peff@peff.net>,
Phillip Wood <phillip.wood@dunelm.org.uk>,
Liam Beguin <liambeguin@gmail.com>
Subject: [PATCH v5 00/10] The final building block for a faster rebase -i
Date: Wed, 14 Jun 2017 15:06:58 +0200 (CEST) [thread overview]
Message-ID: <cover.1497444257.git.johannes.schindelin@gmx.de> (raw)
This patch series reimplements the expensive pre- and post-processing of
the todo script in C.
And it concludes the work I did to accelerate rebase -i so far.
I am still unwilling to replace a compile-time safe way to pass the
options to the revision machinery by the alternative (which I am still
flabbergasted about) proposed by Junio. This will not change.
Changes since v4:
- replaced the "sha1s" part of the names by "ids", to reflect the
current effort to move away from the cryptographically unsafe SHA-1
- replaced the confusing term "instruction sheet" in an error message by
the more commonly used "todo list"
Johannes Schindelin (10):
t3415: verify that an empty instructionFormat is handled as before
rebase -i: generate the script via rebase--helper
rebase -i: remove useless indentation
rebase -i: do not invent onelines when expanding/collapsing SHA-1s
rebase -i: also expand/collapse the SHA-1s via the rebase--helper
t3404: relax rebase.missingCommitsCheck tests
rebase -i: check for missing commits in the rebase--helper
rebase -i: skip unnecessary picks using the rebase--helper
t3415: test fixup with wrapped oneline
rebase -i: rearrange fixup/squash lines using the rebase--helper
Documentation/git-rebase.txt | 16 +-
builtin/rebase--helper.c | 29 ++-
git-rebase--interactive.sh | 373 ++++-------------------------
sequencer.c | 530 ++++++++++++++++++++++++++++++++++++++++++
sequencer.h | 8 +
t/t3404-rebase-interactive.sh | 22 +-
t/t3415-rebase-autosquash.sh | 28 ++-
7 files changed, 646 insertions(+), 360 deletions(-)
base-commit: 02a2850ad58eff6de70eb2dc5f96345c463857ac
Based-On: rebase--helper at https://github.com/dscho/git
Fetch-Base-Via: git fetch https://github.com/dscho/git rebase--helper
Published-As: https://github.com/dscho/git/releases/tag/rebase-i-extra-v5
Fetch-It-Via: git fetch https://github.com/dscho/git rebase-i-extra-v5
Interdiff vs v4:
diff --git a/builtin/rebase--helper.c b/builtin/rebase--helper.c
index e6591f01112..64b36d429fa 100644
--- a/builtin/rebase--helper.c
+++ b/builtin/rebase--helper.c
@@ -25,9 +25,9 @@ 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-sha1s", &command,
+ OPT_CMDMODE(0, "shorten-ids", &command,
N_("shorten SHA-1s in the todo list"), SHORTEN_SHA1S),
- OPT_CMDMODE(0, "expand-sha1s", &command,
+ OPT_CMDMODE(0, "expand-ids", &command,
N_("expand SHA-1s in the todo list"), EXPAND_SHA1S),
OPT_CMDMODE(0, "check-todo-list", &command,
N_("check the todo list"), CHECK_TODO_LIST),
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index 71d190766cf..3b0340e7cc9 100644
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -714,11 +714,11 @@ do_rest () {
}
expand_todo_ids() {
- git rebase--helper --expand-sha1s
+ git rebase--helper --expand-ids
}
collapse_todo_ids() {
- git rebase--helper --shorten-sha1s
+ git rebase--helper --shorten-ids
}
# Add commands after a pick or after a squash/fixup serie
diff --git a/sequencer.c b/sequencer.c
index 6373f20a019..06c97e12267 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -2464,7 +2464,7 @@ int sequencer_make_script(int keep_empty, FILE *out,
}
-int transform_todo_ids(int shorten_sha1s)
+int transform_todo_ids(int shorten_ids)
{
const char *todo_file = rebase_path_todo();
struct todo_list todo_list = TODO_LIST_INIT;
@@ -2484,7 +2484,7 @@ int transform_todo_ids(int shorten_sha1s)
res = parse_insn_buffer(todo_list.buf.buf, &todo_list);
if (res) {
todo_list_release(&todo_list);
- return error(_("unusable instruction sheet: '%s'"), todo_file);
+ return error(_("unusable todo list: '%s'"), todo_file);
}
out = fopen(todo_file, "w");
@@ -2503,7 +2503,7 @@ int transform_todo_ids(int shorten_sha1s)
if (item->command >= TODO_EXEC && item->command != TODO_DROP)
fwrite(p, eol - bol, 1, out);
else {
- const char *sha1 = shorten_sha1s ?
+ const char *id = shorten_ids ?
short_commit_name(item->commit) :
oid_to_hex(&item->commit->object.oid);
int len;
@@ -2512,7 +2512,7 @@ int transform_todo_ids(int shorten_sha1s)
len = strcspn(p, " \t"); /* length of command */
fprintf(out, "%.*s %s %.*s\n",
- len, p, sha1, item->arg_len, item->arg);
+ len, p, id, item->arg_len, item->arg);
}
}
fclose(out);
@@ -2762,9 +2762,9 @@ static int subject2item_cmp(const struct subject2item_entry *a,
}
/*
- * Rearrange the todo list that has both "pick sha1 msg" and "pick sha1
- * fixup!/squash! msg" in it so that the latter is put immediately after the
- * former, and change "pick" to "fixup"/"squash".
+ * Rearrange the todo list that has both "pick commit-id msg" and "pick
+ * commit-id fixup!/squash! msg" in it so that the latter is put immediately
+ * after the former, and change "pick" to "fixup"/"squash".
*
* Note that if the config has specified a custom instruction format, each log
* message will have to be retrieved from the commit (as the oneline in the
diff --git a/sequencer.h b/sequencer.h
index 1c94bec7622..6f3d3df82c0 100644
--- a/sequencer.h
+++ b/sequencer.h
@@ -48,7 +48,7 @@ int sequencer_remove_state(struct replay_opts *opts);
int sequencer_make_script(int keep_empty, FILE *out,
int argc, const char **argv);
-int transform_todo_ids(int shorten_sha1s);
+int transform_todo_ids(int shorten_ids);
int check_todo_list(void);
int skip_unnecessary_picks(void);
int rearrange_squash(void);
--
2.13.1.windows.1.1.ga36e14b3aaa
next reply other threads:[~2017-06-14 13:07 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-14 13:06 Johannes Schindelin [this message]
2017-06-14 13:07 ` [PATCH v5 01/10] t3415: verify that an empty instructionFormat is handled as before Johannes Schindelin
2017-06-14 13:07 ` [PATCH v5 02/10] rebase -i: generate the script via rebase--helper Johannes Schindelin
2017-06-14 13:07 ` [PATCH v5 03/10] rebase -i: remove useless indentation Johannes Schindelin
2017-06-14 13:07 ` [PATCH v5 04/10] rebase -i: do not invent onelines when expanding/collapsing SHA-1s Johannes Schindelin
2017-06-14 13:07 ` [PATCH v5 05/10] rebase -i: also expand/collapse the SHA-1s via the rebase--helper Johannes Schindelin
2017-06-14 13:07 ` [PATCH v5 06/10] t3404: relax rebase.missingCommitsCheck tests Johannes Schindelin
2017-06-14 13:07 ` [PATCH v5 07/10] rebase -i: check for missing commits in the rebase--helper Johannes Schindelin
2017-06-14 13:08 ` [PATCH v5 08/10] rebase -i: skip unnecessary picks using " Johannes Schindelin
2017-06-16 2:39 ` Liam Beguin
2017-06-16 13:56 ` Johannes Schindelin
2017-06-17 22:48 ` Liam Beguin
2017-06-19 9:45 ` Johannes Schindelin
2017-06-19 16:10 ` Jeff King
2017-06-19 17:39 ` Junio C Hamano
2017-06-20 2:35 ` Liam Beguin
2017-06-14 13:08 ` [PATCH v5 09/10] t3415: test fixup with wrapped oneline Johannes Schindelin
2017-06-14 13:08 ` [PATCH v5 10/10] rebase -i: rearrange fixup/squash lines using the rebase--helper Johannes Schindelin
2017-06-15 23:13 ` [PATCH v5 00/10] The final building block for a faster rebase -i Junio C Hamano
2017-06-16 13:50 ` Johannes Schindelin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cover.1497444257.git.johannes.schindelin@gmx.de \
--to=johannes.schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=liambeguin@gmail.com \
--cc=peff@peff.net \
--cc=philipoakley@iee.org \
--cc=phillip.wood@dunelm.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).