Skip to content

Commit 9cafec9

Browse files
committed
doc: recommend git-node-v8
Per the comments in nodejs#43924, almost everyone uses `git-node-v8`. I included example steps for using `git-node-v8`.
1 parent 2fd4c01 commit 9cafec9

File tree

1 file changed

+61
-11
lines changed

1 file changed

+61
-11
lines changed

doc/contributing/maintaining-V8.md

Lines changed: 61 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,53 @@ backport the fix:
208208
Abandoned V8 branches are supported in the Node.js repository. The fix needs
209209
to be cherry-picked in the Node.js repository and V8-CI must test the change.
210210

211+
As an example for how to backport changes, consider the bug [RegExp show
212+
inconsistent result with other browsers](https://crbug.com/v8/5199). From the
213+
bug we can see that it was merged by V8 into 5.2 and 5.3, and not into V8 5.1
214+
(since it was already abandoned). Since Node.js `v6.x` uses V8 5.1, the fix
215+
needed to be backported.
216+
217+
#### Backporting with `git-node` (recommended)
218+
219+
You can use [`git-node`][] to help you backport patches. This removes
220+
some manual steps and is recommended.
221+
222+
Here are the steps for the bug mentioned above:
223+
224+
1. Install [`git-node`][] by installing [`node-core-utils`][].
225+
2. Install the prerequisites for [`git-node-v8`][].
226+
3. Find the commit hash linked-to in the issue (in this case a51f429).
227+
4. Checkout a branch off the appropriate _vY.x-staging_ branch (e.g.
228+
_v6.x-staging_ to fix an issue in V8 5.1).
229+
5. Run `git node v8 backport a51f429`. If the patch merges without any
230+
conflicts, it will look like this:
231+
```console
232+
$ git node v8 backport a51f429
233+
✔ Update local V8 clone
234+
✔ V8 commit backport
235+
```
236+
6. If there are conflicts, `git-node` will wait for you to resolve them.
237+
git-node` will prompt you to resolve them in another terminal and then
238+
enter `RESOLVED`:
239+
```console
240+
$ git node v8 backport a51f429
241+
✔ Update local V8 clone
242+
V8 commit backport
243+
✔ Get current V8 version
244+
✔ Generate patches
245+
❯ Apply and commit patches to deps/v8
246+
❯ Commit a51f429772d1
247+
⠏ Apply patch
248+
◼ Increment embedder version number
249+
◼ Commit patch
250+
251+
? Resolve merge conflicts and enter 'RESOLVED' ‣
252+
```
253+
254+
See [`git-node-v8-backport`][] for more documentation and additional options.
255+
256+
#### Backporting manually (not recommended)
257+
211258
* For each abandoned V8 branch corresponding to an LTS branch that is affected
212259
by the bug:
213260
* Checkout a branch off the appropriate _vY.x-staging_ branch (e.g.
@@ -224,14 +271,7 @@ to be cherry-picked in the Node.js repository and V8-CI must test the change.
224271
`tools/make-v8.sh` to reconstruct a git tree in the `deps/v8` directory to
225272
run V8 tests.[^2]
226273

227-
The [`git-node`][] tool can be used to simplify this task. Run
228-
`git node v8 backport <sha>` to cherry-pick a commit.
229-
230-
An example for workflow how to cherry-pick consider the bug
231-
[RegExp show inconsistent result with other browsers](https://crbug.com/v8/5199).
232-
From the bug we can see that it was merged by V8 into 5.2 and 5.3, and not into
233-
V8 5.1 (since it was already abandoned). Since Node.js `v6.x` uses V8 5.1, the
234-
fix needed to be cherry-picked. To cherry-pick, here's an example workflow:
274+
Here are the steps for the bug mentioned above:
235275

236276
* Download and apply the commit linked-to in the issue (in this case a51f429):
237277

@@ -322,6 +362,15 @@ compute the diff between these tags on the V8 repository, and then apply that
322362
patch on the copy of V8 in Node.js. This should preserve the patches/backports
323363
that Node.js may be floating (or else cause a merge conflict).
324364

365+
#### Applying minor updates with `git-node` (recommended)
366+
367+
1. Install [`git-node`][] by installing [`node-core-utils`][].
368+
2. Install the prerequisites for [`git-node-v8`][].
369+
3. Run `git node v8 minor` to apply a minor update.
370+
371+
See [`git-node-v8-minor`][] for more documentation and additional options.
372+
373+
#### Applying minor updates manually (not recommended)
325374
The rough outline of the process is:
326375

327376
```bash
@@ -340,9 +389,6 @@ curl -L https://github.com/v8/v8/compare/${V8_OLD_VERSION}...${V8_NEW_VERSION}.p
340389
V8 also keeps tags of the form _5.4-lkgr_ which point to the _Last Known Good
341390
Revision_ from the 5.4 branch that can be useful in the update process above.
342391

343-
The [`git-node`][] tool can be used to simplify this task. Run `git node v8 minor`
344-
to apply a minor update.
345-
346392
### Major updates
347393

348394
We upgrade the version of V8 in Node.js `main` whenever a V8 release goes stable
@@ -427,4 +473,8 @@ This would require some tooling to:
427473
[V8MergingPatching]: https://v8.dev/docs/merge-patch
428474
[V8TemplateMergeRequest]: https://bugs.chromium.org/p/v8/issues/entry?template=Node.js%20merge%20request
429475
[V8TemplateUpstreamBug]: https://bugs.chromium.org/p/v8/issues/entry?template=Node.js%20upstream%20bug
476+
[`git-node-v8-backport`]: https://github.com/nodejs/node-core-utils/blob/main/docs/git-node.md#git-node-v8-backport-sha
477+
[`git-node-v8-minor`]: https://github.com/nodejs/node-core-utils/blob/main/docs/git-node.md#git-node-v8-minor
478+
[`git-node-v8`]: https://github.com/nodejs/node-core-utils/blob/HEAD/docs/git-node.md#git-node-v8
430479
[`git-node`]: https://github.com/nodejs/node-core-utils/blob/HEAD/docs/git-node.md#git-node-v8
480+
[`node-core-utils`]: https://github.com/nodejs/node-core-utils#Install

0 commit comments

Comments
 (0)