You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: rev_news/drafts/edition-20.md
+102-2Lines changed: 102 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -21,9 +21,109 @@ This edition covers what happened during the month of September 2016.
21
21
### General
22
22
-->
23
23
24
-
<!---
24
+
25
25
### Reviews
26
-
-->
26
+
27
+
*[Prepare the sequencer for the upcoming rebase -i patches](http://public-inbox.org/git/[email protected]/)
28
+
29
+
Johannes Schindelin, alias Dscho, is the maintainer of Git for
30
+
Windows. He is working for Microsoft and, on top of his maintainer
31
+
role, he has been working whenever time allowed since February this
32
+
year to speed up interactive rebase (`git rebase -i`).
33
+
34
+
Since when it was created in 2005, the `git rebase` command has been
35
+
implemented using shell scripts that are calling other git commands.
36
+
37
+
The interactive rebase that Dscho implemented in 2007 calls different
38
+
commands than the regular, non interactive, rebase. The regular rebase
39
+
uses `git format-patch` to create a patch series from some commits,
40
+
and then `git am` to apply this patch series on top of a different
41
+
commit, while the interactive rebase calls `git cherry-pick`
42
+
repeatedly for the same purpose.
43
+
44
+
Neither of these approaches has been very efficient though, and the
45
+
main reason behind that is that repeatedly calling a git command has a
46
+
significant overhead. Even the regular `git rebase` would do that as
47
+
`git am` had been implemented by launching `git apply` on each of the
48
+
patches.
49
+
50
+
The overhead is especially big on Windows were creating a new process
51
+
is quite slow, but even on other OSes it requires setting up
52
+
everything from scratch, then reading the index from disk, and then,
53
+
after performing some changes, writing the index back to the disk.
54
+
55
+
In case of the regular rebase,
56
+
[a patch series has been merged recently](https://github.com/git/git/commit/81358dc238372793b1590efa149cc1581d1fbd98)
57
+
to the 'master' branch that makes `git am` call `git apply`'s internal
58
+
functions without spawning the latter as a separate process. So the
59
+
regular rebase will be significantly faster especially on Windows and
60
+
for big repositories in the next Git feature release.
61
+
62
+
Dscho's work achieves the same kind of results for the interactive
63
+
rebase. The work, which has been distilled to the mailing list has a
64
+
series of patch series, greatly improves and then uses a mechanism
65
+
called the sequencer.
66
+
67
+
The sequencer had been from it's beginning
68
+
[in 2008 as a GSoC (Google Summer of Code) project](https://git.wiki.kernel.org/index.php/SoC2008Ideas#Implement_git-sequencer)
69
+
envisioned as a low-level patch-application engine written in C that
70
+
would "take the 'todo' file format used by git-rebase -i and extend it
71
+
to also support applying patches split out of mbox files", so that
72
+
"frontends like git-am, git-rebase, etc. can then setup the 'todo'
73
+
script and pass it to git-sequencer, which does the actual patch
74
+
application, editing, etc."
75
+
76
+
Of course it was a too much ambitious project for a GSoC project, so
77
+
the work that Stephan Beyer, the GSoC student at that time, did to
78
+
implement it was not merged. A lot of great related work by Stephan
79
+
had been merged though, and the sequencer idea as well as Stephan's
80
+
code were still considered valuable, so that in 2011
81
+
[another GSoC project was attempted](https://git.wiki.kernel.org/index.php/SoC2011Ideas#git_cherry-pick_--continue.2F--abort.2F--skip_and_git_sequencer)
82
+
to further the idea and Stephan's code. This time the goal was to
83
+
first use the sequencer to improve cherry-picking, and reverting, many
84
+
commits, and Ramkumar Ramachandra, alias Ram, succeeded. The sequencer
85
+
code got merged and it was now possible to "continue", "abort" or
86
+
"skip" when cherry-picking or reverting many commits.
87
+
88
+
Despite this success, Dscho has had to improve a lot of things to make
89
+
it possible to reuse the sequencer in the interactive rebase. For
90
+
example he had to create a git-rebase--helper in C that ported a lot
91
+
of the functionality from the git-rebase--interactive.sh shell
92
+
script.
93
+
94
+
As Dscho explains [in an answer to a question by Jakub Narębski](http://public-inbox.org/git/alpine.DEB.2.20.1609021432070.129229@virtualbox/),
95
+
who asked about the status of the patch series, 10 of his patch series
96
+
had already been accepted, 5 were in flight and 1 had not yet been
97
+
submitted at the beginning of September.
98
+
99
+
These patch series, will speed up the interactive rebase, but are not
100
+
enough to fully replace the rebase implementation in shell by one in
101
+
C. According to Dscho such a result is "*far, far, far* in the future":
102
+
103
+
> ...my hope is that the rebase--helper work is only an initial step,
104
+
> opening the door for other contributors to tackle independent parts
105
+
> of making git-rebase a builtin
106
+
107
+
Though the patch series have been reviewed by a large number of
108
+
experienced Git developers like Junio Hamano, Johannes Sixt, Torsten
109
+
Bögershausen, Jeff King, Jakub Narębski, Dennis Kaarsemaker, Eric
110
+
Sunshine, Kevin Daudt and Stefan Beller, they are not fully merged
111
+
into Git yet. But Dscho already "integrated the whole shebang into Git
112
+
for Windows 2.10.0 and 2.10.1" that were released recently, and "it
113
+
has been running without complaints (and some quite positive
114
+
feedback)".
115
+
116
+
About the performance improvements, Dscho wrote:
117
+
118
+
> The end game of this patch series is a git-rebase--helper that makes
119
+
> rebase -i 5x faster on Windows (according to t/perf/p3404). Travis says
120
+
> that even MacOS X and Linux benefit (4x and 3x, respectively).
121
+
122
+
Such performance improvements as well as the code consolidations
123
+
around the sequencer are of course very nice. It is interesting and
124
+
satisfying to see that they are the result of building on top of
125
+
previous work over the years by GSoC students, mentors and reviewers.
0 commit comments