[PATCH 00/34] Teach the sequencer to act as rebase -i's backend
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Aug 31, 2016, 08:53 UTC
- Message-ID
- <cover.1472633606.git.johannes.schindelin@gmx.de>
This marks the count down to '3': two more patch series after this (really tiny ones) and we have a faster rebase -i.
The idea of this patch series is to teach the sequencer to understand all of the commands in `git-rebase-todo` scripts, to execute them and to behave pretty much very the same as `git rebase -i --continue` when called with the newly-introduced REPLAY_INTERACTIVE_REBASE setting.
Most of these patches should be pretty much straight-forward. When not, I tried to make a point of describing enough background in the commit message. Please feel free to point out where my explanations fall short.
Note that even after this patch series is applied, rebase -i is still unaffected. It will require the next patch series which introduces the rebase--helper that essentially implements `git rebase -i --continue` by calling the sequencer with the appropriate options.
The final patch series will move a couple of pre- and post-processing steps into the rebase--helper/sequencer (such as expanding/shrinking the SHA-1s, reordering the fixup!/squash! lines, etc). This might sound like a mere add-on, but it is essential for the speed improvements: those stupid little processing steps really dominated the execution time in my tests.
Apart from mostly cosmetic patches (and the occasional odd bug that I fixed promptly), I used these patches since mid May to perform all of my interactive rebases. In mid June, I had the idea to teach rebase -i to run *both* scripted rebase and rebase--helper and to cross-validate the results. This slowed down all my interactive rebases since, but helped me catch three rather obscure bugs (e.g. that git commit --fixup unfolds long onelines and rebase -i still finds the correct original commit).
This is all only to say that I am rather confident that the current code does the job.
As stated earlier, my plan is to integrate all of these patch series into Git for Windows v2.10.0. And then be mostly offline during the second half of September ;-) There are multiple reasons why I want to pull through with this: I have been working on these patches since mid February and it is high time that they benefit users other than me. Also: I got a bit tired of postponing the integration for a couple of Git for Windows versions already. Originally, I had planned it for v2.9.0, but then I wanted to give the patches some review, regretting that idea when it took one of the 14 patch series over a month to stabilize.
This means that I will not perform any major refactoring at this stage, but postpone any such work, if necessary at all.
Just to reiterate why I do all this: it speeds up the interactive rebase substantially. Even with a not yet fully builtin rebase -i, but just the part after the user edited the `git-rebase-todo` script.
The performance test I introduced to demonstrate this (p3404) shows a speed-up of +380% here (i.e. roughly 5x), from ~8.8 seconds to ~1.8 seconds. This is on Windows, where the performance impact of avoiding shell scripting is most noticable.
On MacOSX and on Linux, the speed-up is less pronounced, but still noticable, at least if you trust Travis CI, which I abused to perform that test for me. Check for yourself (searching for "3404.2") here: https://travis-ci.org/git/git/builds/156295227. According to those logs, p3404 is speeded up from ~0.45 seconds to ~0.12 seconds on Linux (read: about 3.5x) and from ~1.7 seconds to ~0.5 seconds on MacOSX (read: almost 4x).
Johannes Schindelin (34):
sequencer: support a new action: 'interactive rebase'
sequencer (rebase -i): implement the 'noop' command
sequencer (rebase -i): implement the 'edit' command
sequencer (rebase -i): implement the 'exec' command
sequencer (rebase -i): learn about the 'verbose' mode
sequencer (rebase -i): write the 'done' file
sequencer (rebase -i): add support for the 'fixup' and 'squash'
commands
sequencer (rebase -i): implement the short commands
sequencer (rebase -i): write an author-script file
sequencer (rebase -i): allow continuing with staged changes
sequencer (rebase -i): remove CHERRY_PICK_HEAD when no longer needed
sequencer (rebase -i): skip some revert/cherry-pick specific code path
sequencer (rebase -i): the todo can be empty when continuing
sequencer (rebase -i): update refs after a successful rebase
sequencer (rebase -i): leave a patch upon error
sequencer (rebase -i): implement the 'reword' command
sequencer (rebase -i): allow fast-forwarding for edit/reword
sequencer (rebase -i): refactor setting the reflog message
sequencer (rebase -i): set the reflog message consistently
sequencer (rebase -i): copy commit notes at end
sequencer (rebase -i): record interrupted commits in rewritten, too
sequencer (rebase -i): run the post-rewrite hook, if needed
sequencer (rebase -i): respect the rebase.autostash setting
sequencer (rebase -i): respect strategy/strategy_opts settings
sequencer (rebase -i): allow rescheduling commands
sequencer (rebase -i): implement the 'drop' command
sequencer (rebase -i): differentiate between comments and 'noop'
run_command_opt(): optionally hide stderr when the command succeeds
sequencer (rebase -i): show only failed `git commit`'s output
sequencer (rebase -i): show only failed cherry-picks' output
sequencer (rebase -i): suggest --edit-todo upon unknown command
sequencer (rebase -i): show the progress
sequencer (rebase -i): write the progress into files
sequencer (rebase -i): write out the final messagerun-command.c | 23 ++ run-command.h | 1 + sequencer.c | 990 +++++++++++++++++++++++++++++++++++++++++++++++++++++++--- sequencer.h | 4 +- 4 files changed, 971 insertions(+), 47 deletions(-)
Based-On: prepare-sequencer-and-wt_status at https://github.com/dscho/git Fetch-Base-Via: git fetch https://github.com/dscho/git prepare-sequencer-and-wt_status Published-As: https://github.com/dscho/git/releases/tag/sequencer-i-v1 Fetch-It-Via: git fetch https://github.com/dscho/git sequencer-i-v1
-- 2.10.0.rc2.102.g5c102ec base-commit: 45bfeb0c4044dfcf090ad97e839d250d62308fac