git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[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 message
 run-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
Next: Johannes Schindelin
Message 1 of 212 in “Teach the sequencer to act as rebase -i's backend”
  1. 00/34 Teach the sequencer to act as rebase -i's backendJohannes Schindelin, Aug 31, 2016
  2. 07/34 sequencer (rebase -i): add support for the 'fixup' and 'squash' commandsJohannes Schindelin, Aug 31, 2016
  3. Dennis KaarsemakerSep 1, 2016
  4. Johannes SchindelinSep 1, 2016
  5. Dennis KaarsemakerSep 1, 2016
  6. Johannes SchindelinSep 2, 2016
  7. Dennis KaarsemakerSep 2, 2016
  8. Johannes SchindelinSep 2, 2016
  9. Dennis KaarsemakerSep 2, 2016
  10. Junio C HamanoSep 1, 2016
  11. Johannes SchindelinSep 2, 2016
  12. 05/34 sequencer (rebase -i): learn about the 'verbose' modeJohannes Schindelin, Aug 31, 2016
  13. Dennis KaarsemakerAug 31, 2016
  14. Johannes SchindelinAug 31, 2016
  15. 04/34 sequencer (rebase -i): implement the 'exec' commandJohannes Schindelin, Aug 31, 2016
  16. 03/34 sequencer (rebase -i): implement the 'edit' commandJohannes Schindelin, Aug 31, 2016
  17. 02/34 sequencer (rebase -i): implement the 'noop' commandJohannes Schindelin, Aug 31, 2016
  18. 01/34 sequencer: support a new action: 'interactive rebase'Johannes Schindelin, Aug 31, 2016
  19. Kevin DaudtSep 2, 2016
  20. Johannes SchindelinSep 3, 2016
  21. 08/34 sequencer (rebase -i): implement the short commandsJohannes Schindelin, Aug 31, 2016
  22. 09/34 sequencer (rebase -i): write an author-script fileJohannes Schindelin, Aug 31, 2016
  23. 12/34 sequencer (rebase -i): skip some revert/cherry-pick specific code pathJohannes Schindelin, Aug 31, 2016
  24. 11/34 sequencer (rebase -i): remove CHERRY_PICK_HEAD when no longer neededJohannes Schindelin, Aug 31, 2016
  25. 13/34 sequencer (rebase -i): the todo can be empty when continuingJohannes Schindelin, Aug 31, 2016
  26. 10/34 sequencer (rebase -i): allow continuing with staged changesJohannes Schindelin, Aug 31, 2016
  27. 16/34 sequencer (rebase -i): implement the 'reword' commandJohannes Schindelin, Aug 31, 2016
  28. 19/34 sequencer (rebase -i): set the reflog message consistentlyJohannes Schindelin, Aug 31, 2016
  29. 18/34 sequencer (rebase -i): refactor setting the reflog messageJohannes Schindelin, Aug 31, 2016
  30. 21/34 sequencer (rebase -i): record interrupted commits in rewritten, tooJohannes Schindelin, Aug 31, 2016
  31. 20/34 sequencer (rebase -i): copy commit notes at endJohannes Schindelin, Aug 31, 2016
  32. Dennis KaarsemakerSep 1, 2016
  33. Johannes SchindelinSep 1, 2016
  34. 22/34 sequencer (rebase -i): run the post-rewrite hook, if neededJohannes Schindelin, Aug 31, 2016
  35. 26/34 sequencer (rebase -i): implement the 'drop' commandJohannes Schindelin, Aug 31, 2016
  36. 23/34 sequencer (rebase -i): respect the rebase.autostash settingJohannes Schindelin, Aug 31, 2016
  37. 27/34 sequencer (rebase -i): differentiate between comments and 'noop'Johannes Schindelin, Aug 31, 2016
  38. Dennis KaarsemakerSep 1, 2016
  39. Johannes SchindelinSep 1, 2016
  40. Dennis KaarsemakerSep 1, 2016
  41. Johannes SchindelinSep 2, 2016
  42. 24/34 sequencer (rebase -i): respect strategy/strategy_opts settingsJohannes Schindelin, Aug 31, 2016
  43. 25/34 sequencer (rebase -i): allow rescheduling commandsJohannes Schindelin, Aug 31, 2016
  44. 17/34 sequencer (rebase -i): allow fast-forwarding for edit/rewordJohannes Schindelin, Aug 31, 2016
  45. 28/34 run_command_opt(): optionally hide stderr when the command succeedsJohannes Schindelin, Aug 31, 2016
  46. 29/34 sequencer (rebase -i): show only failed `git commit`'s outputJohannes Schindelin, Aug 31, 2016
  47. 31/34 sequencer (rebase -i): suggest --edit-todo upon unknown commandJohannes Schindelin, Aug 31, 2016
  48. 32/34 sequencer (rebase -i): show the progressJohannes Schindelin, Aug 31, 2016
  49. Dennis KaarsemakerSep 1, 2016
  50. Johannes SchindelinSep 1, 2016
  51. 33/34 sequencer (rebase -i): write the progress into filesJohannes Schindelin, Aug 31, 2016
  52. 30/34 sequencer (rebase -i): show only failed cherry-picks' outputJohannes Schindelin, Aug 31, 2016
  53. 34/34 sequencer (rebase -i): write out the final messageJohannes Schindelin, Aug 31, 2016
  54. 15/34 sequencer (rebase -i): leave a patch upon errorJohannes Schindelin, Aug 31, 2016
  55. Dennis KaarsemakerAug 31, 2016
  56. Johannes SchindelinSep 1, 2016
  57. 06/34 sequencer (rebase -i): write the 'done' fileJohannes Schindelin, Aug 31, 2016
  58. Dennis KaarsemakerAug 31, 2016
  59. Johannes SchindelinSep 1, 2016
  60. 14/34 sequencer (rebase -i): update refs after a successful rebaseJohannes Schindelin, Aug 31, 2016
  61. Dennis KaarsemakerAug 31, 2016
  62. Johannes SchindelinSep 1, 2016
  63. 00/34 Teach the sequencer to act as rebase -i's backendJohannes Schindelin, Dec 13, 2016
  64. 04/34 sequencer (rebase -i): implement the 'exec' commandJohannes Schindelin, Dec 13, 2016
  65. Junio C HamanoDec 13, 2016
  66. Johannes SchindelinDec 19, 2016
  67. 03/34 sequencer (rebase -i): implement the 'edit' commandJohannes Schindelin, Dec 13, 2016
  68. Junio C HamanoDec 13, 2016
  69. Johannes SchindelinDec 19, 2016
  70. Junio C HamanoDec 19, 2016
  71. Junio C HamanoDec 19, 2016
  72. 12/34 sequencer (rebase -i): skip some revert/cherry-pick specific code pathJohannes Schindelin, Dec 13, 2016
  73. 14/34 sequencer (rebase -i): update refs after a successful rebaseJohannes Schindelin, Dec 13, 2016
  74. Junio C HamanoDec 16, 2016
  75. Johannes SchindelinDec 19, 2016
  76. 27/34 sequencer (rebase -i): differentiate between comments and 'noop'Johannes Schindelin, Dec 13, 2016
  77. Junio C HamanoDec 19, 2016
  78. 06/34 sequencer (rebase -i): write the 'done' fileJohannes Schindelin, Dec 13, 2016
  79. Junio C HamanoDec 13, 2016
  80. 05/34 sequencer (rebase -i): learn about the 'verbose' modeJohannes Schindelin, Dec 13, 2016
  81. Junio C HamanoDec 13, 2016
  82. Junio C HamanoDec 14, 2016
  83. Johannes SchindelinJan 2, 2017
  84. Junio C HamanoJan 7, 2017
  85. Junio C HamanoJan 8, 2017
  86. 07/34 sequencer (rebase -i): add support for the 'fixup' and 'squash' commandsJohannes Schindelin, Dec 13, 2016
  87. Junio C HamanoDec 15, 2016
  88. Jeff KingDec 15, 2016
  89. Johannes SchindelinDec 19, 2016
  90. Jeff KingDec 19, 2016
  91. Johannes SchindelinDec 19, 2016
  92. Jeff KingDec 15, 2016
  93. Stefan BellerDec 15, 2016
  94. Jeff KingDec 15, 2016
  95. Stefan BellerDec 15, 2016
  96. Johannes SchindelinDec 19, 2016
  97. 13/34 sequencer (rebase -i): the todo can be empty when continuingJohannes Schindelin, Dec 13, 2016
  98. 28/34 run_command_opt(): optionally hide stderr when the command succeedsJohannes Schindelin, Dec 13, 2016
  99. Johannes SixtDec 14, 2016
  100. Jeff KingDec 14, 2016
  101. Jeff KingDec 14, 2016
  102. Johannes SixtDec 14, 2016
  103. Johannes SchindelinJan 2, 2017
  104. 26/34 sequencer (rebase -i): implement the 'drop' commandJohannes Schindelin, Dec 13, 2016
  105. 15/34 sequencer (rebase -i): leave a patch upon errorJohannes Schindelin, Dec 13, 2016
  106. Junio C HamanoDec 16, 2016
  107. 25/34 sequencer (rebase -i): allow rescheduling commandsJohannes Schindelin, Dec 13, 2016
  108. 24/34 sequencer (rebase -i): respect strategy/strategy_opts settingsJohannes Schindelin, Dec 13, 2016
  109. Junio C HamanoDec 19, 2016
  110. 20/34 sequencer (rebase -i): copy commit notes at endJohannes Schindelin, Dec 13, 2016
  111. Junio C HamanoDec 16, 2016
  112. Johannes SchindelinJan 2, 2017
  113. 23/34 sequencer (rebase -i): respect the rebase.autostash settingJohannes Schindelin, Dec 13, 2016
  114. 22/34 sequencer (rebase -i): run the post-rewrite hook, if neededJohannes Schindelin, Dec 13, 2016
  115. 19/34 sequencer (rebase -i): set the reflog message consistentlyJohannes Schindelin, Dec 13, 2016
  116. 21/34 sequencer (rebase -i): record interrupted commits in rewritten, tooJohannes Schindelin, Dec 13, 2016
  117. 18/34 sequencer (rebase -i): refactor setting the reflog messageJohannes Schindelin, Dec 13, 2016
  118. Junio C HamanoDec 16, 2016
  119. 17/34 sequencer (rebase -i): allow fast-forwarding for edit/rewordJohannes Schindelin, Dec 13, 2016
  120. 16/34 sequencer (rebase -i): implement the 'reword' commandJohannes Schindelin, Dec 13, 2016
  121. 32/34 sequencer (rebase -i): show the progressJohannes Schindelin, Dec 13, 2016
  122. Junio C HamanoDec 19, 2016
  123. 33/34 sequencer (rebase -i): write the progress into filesJohannes Schindelin, Dec 13, 2016
  124. 34/34 sequencer (rebase -i): write out the final messageJohannes Schindelin, Dec 13, 2016
  125. 31/34 sequencer (rebase -i): suggest --edit-todo upon unknown commandJohannes Schindelin, Dec 13, 2016
  126. 01/34 sequencer: support a new action: 'interactive rebase'Johannes Schindelin, Dec 13, 2016
  127. Junio C HamanoDec 13, 2016
  128. Johannes SchindelinDec 19, 2016
  129. Junio C HamanoDec 14, 2016
  130. Stephan BeyerDec 17, 2016
  131. Johannes SchindelinDec 19, 2016
  132. Stephan BeyerDec 19, 2016
  133. 02/34 sequencer (rebase -i): implement the 'noop' commandJohannes Schindelin, Dec 13, 2016
  134. Junio C HamanoDec 13, 2016
  135. Linus TorvaldsDec 13, 2016
  136. Junio C HamanoDec 13, 2016
  137. Johannes SchindelinDec 19, 2016
  138. Junio C HamanoDec 19, 2016
  139. Johannes SchindelinDec 19, 2016
  140. 08/34 sequencer (rebase -i): implement the short commandsJohannes Schindelin, Dec 13, 2016
  141. Junio C HamanoDec 15, 2016
  142. 09/34 sequencer (rebase -i): write an author-script fileJohannes Schindelin, Dec 13, 2016
  143. Junio C HamanoDec 15, 2016
  144. Johannes SchindelinDec 19, 2016
  145. Junio C HamanoDec 20, 2016
  146. Junio C HamanoDec 20, 2016
  147. 10/34 sequencer (rebase -i): allow continuing with staged changesJohannes Schindelin, Dec 13, 2016
  148. Junio C HamanoDec 15, 2016
  149. 11/34 sequencer (rebase -i): remove CHERRY_PICK_HEAD when no longer neededJohannes Schindelin, Dec 13, 2016
  150. Junio C HamanoDec 16, 2016
  151. Johannes SchindelinDec 19, 2016
  152. 30/34 sequencer (rebase -i): show only failed cherry-picks' outputJohannes Schindelin, Dec 13, 2016
  153. 29/34 sequencer (rebase -i): show only failed `git commit`'s outputJohannes Schindelin, Dec 13, 2016
  154. Junio C HamanoDec 13, 2016
  155. Johannes SchindelinDec 19, 2016
  156. Johannes SixtDec 14, 2016
  157. Johannes SchindelinDec 19, 2016
  158. 00/38 Teach the sequencer to act as rebase -i's backendJohannes Schindelin, Jan 2, 2017
  159. 02/38 sequencer: move "else" keyword onto the same line as preceding braceJohannes Schindelin, Jan 2, 2017
  160. Junio C HamanoJan 12, 2017
  161. 01/38 sequencer: avoid unnecessary curly bracesJohannes Schindelin, Jan 2, 2017
  162. Junio C HamanoJan 12, 2017
  163. Johannes SchindelinJan 14, 2017
  164. Jeff KingJan 14, 2017
  165. Jacob KellerJan 16, 2017
  166. 03/38 sequencer: use a helper to find the commit messageJohannes Schindelin, Jan 2, 2017
  167. Junio C HamanoJan 12, 2017
  168. 04/38 sequencer: support a new action: 'interactive rebase'Johannes Schindelin, Jan 2, 2017
  169. 05/38 sequencer (rebase -i): implement the 'noop' commandJohannes Schindelin, Jan 2, 2017
  170. 06/38 sequencer (rebase -i): implement the 'edit' commandJohannes Schindelin, Jan 2, 2017
  171. Junio C HamanoJan 12, 2017
  172. Johannes SchindelinJan 14, 2017
  173. 07/38 sequencer (rebase -i): implement the 'exec' commandJohannes Schindelin, Jan 2, 2017
  174. 08/38 sequencer (rebase -i): learn about the 'verbose' modeJohannes Schindelin, Jan 2, 2017
  175. 09/38 sequencer (rebase -i): write the 'done' fileJohannes Schindelin, Jan 2, 2017
  176. 11/38 sequencer (rebase -i): implement the short commandsJohannes Schindelin, Jan 2, 2017
  177. 10/38 sequencer (rebase -i): add support for the 'fixup' and 'squash' commandsJohannes Schindelin, Jan 2, 2017
  178. 12/38 sequencer (rebase -i): write an author-script fileJohannes Schindelin, Jan 2, 2017
  179. 15/38 sequencer (rebase -i): skip some revert/cherry-pick specific code pathJohannes Schindelin, Jan 2, 2017
  180. 14/38 sequencer (rebase -i): remove CHERRY_PICK_HEAD when no longer neededJohannes Schindelin, Jan 2, 2017
  181. 13/38 sequencer (rebase -i): allow continuing with staged changesJohannes Schindelin, Jan 2, 2017
  182. 16/38 sequencer (rebase -i): the todo can be empty when continuingJohannes Schindelin, Jan 2, 2017
  183. 18/38 sequencer (rebase -i): leave a patch upon errorJohannes Schindelin, Jan 2, 2017
  184. 17/38 sequencer (rebase -i): update refs after a successful rebaseJohannes Schindelin, Jan 2, 2017
  185. 19/38 sequencer (rebase -i): implement the 'reword' commandJohannes Schindelin, Jan 2, 2017
  186. 21/38 sequencer (rebase -i): refactor setting the reflog messageJohannes Schindelin, Jan 2, 2017
  187. 23/38 sequencer (rebase -i): copy commit notes at endJohannes Schindelin, Jan 2, 2017
  188. 20/38 sequencer (rebase -i): allow fast-forwarding for edit/rewordJohannes Schindelin, Jan 2, 2017
  189. 24/38 sequencer (rebase -i): record interrupted commits in rewritten, tooJohannes Schindelin, Jan 2, 2017
  190. 25/38 sequencer (rebase -i): run the post-rewrite hook, if neededJohannes Schindelin, Jan 2, 2017
  191. 22/38 sequencer (rebase -i): set the reflog message consistentlyJohannes Schindelin, Jan 2, 2017
  192. 26/38 sequencer (rebase -i): respect the rebase.autostash settingJohannes Schindelin, Jan 2, 2017
  193. 27/38 sequencer (rebase -i): respect strategy/strategy_opts settingsJohannes Schindelin, Jan 2, 2017
  194. 28/38 sequencer (rebase -i): allow rescheduling commandsJohannes Schindelin, Jan 2, 2017
  195. 29/38 sequencer (rebase -i): implement the 'drop' commandJohannes Schindelin, Jan 2, 2017
  196. 30/38 sequencer (rebase -i): differentiate between comments and 'noop'Johannes Schindelin, Jan 2, 2017
  197. 32/38 sequencer: use run_command() directlyJohannes Schindelin, Jan 2, 2017
  198. 33/38 sequencer (rebase -i): show only failed `git commit`'s outputJohannes Schindelin, Jan 2, 2017
  199. 31/38 sequencer: make reading author-script more elegantJohannes Schindelin, Jan 2, 2017
  200. 34/38 sequencer (rebase -i): show only failed cherry-picks' outputJohannes Schindelin, Jan 2, 2017
  201. 35/38 sequencer (rebase -i): suggest --edit-todo upon unknown commandJohannes Schindelin, Jan 2, 2017
  202. 36/38 sequencer (rebase -i): show the progressJohannes Schindelin, Jan 2, 2017
  203. 37/38 sequencer (rebase -i): write the progress into filesJohannes Schindelin, Jan 2, 2017
  204. 38/38 sequencer (rebase -i): write out the final messageJohannes Schindelin, Jan 2, 2017
  205. Junio C HamanoJan 9, 2017
  206. Junio C HamanoJan 9, 2017
  207. Johannes SchindelinJan 14, 2017
  208. Junio C HamanoJan 15, 2017
  209. Johannes SchindelinJan 14, 2017
  210. Junio C HamanoJan 15, 2017
  211. Johannes SchindelinJan 16, 2017
  212. Junio C HamanoJan 17, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.