Skip to content

Commit 96d2b66

Browse files
committed
fix: use git apply not system apply
1 parent 75abd3a commit 96d2b66

File tree

2 files changed

+16
-15
lines changed

2 files changed

+16
-15
lines changed

components/git/v8.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,14 @@ function main(argv) {
8282
options.v8Dir = path.resolve(options.v8Dir);
8383
}
8484

85-
options.execGitNode = function execGitNode(...args) {
86-
return execa('git', args, { cwd: options.nodeDir });
85+
options.execGitNode = function execGitNode(cmd, args, input) {
86+
args.unshift(cmd)
87+
return execa('git', args, {
88+
cwd: options.nodeDir,
89+
...input && { input }
90+
});
8791
};
92+
8893
options.execGitV8 = function execGitV8(...args) {
8994
return execa('git', args, { cwd: options.v8Dir });
9095
};

lib/update-v8/backport.js

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
const path = require('path');
44

5-
const execa = require('execa');
65
const fs = require('fs-extra');
76
const inquirer = require('inquirer');
87
const Listr = require('listr');
@@ -74,8 +73,8 @@ function commitSquashedBackport() {
7473
messageBody += formatted + '\n\n';
7574
}
7675
}
77-
await ctx.execGitNode('add', 'deps/v8');
78-
await ctx.execGitNode('commit', '-m', messageTitle, '-m', messageBody);
76+
await ctx.execGitNode('add', ['deps/v8']);
77+
await ctx.execGitNode('commit', ['-m', messageTitle, '-m', messageBody]);
7978
}
8079
};
8180
};
@@ -86,8 +85,8 @@ function commitPatch(patch) {
8685
task: async(ctx) => {
8786
const messageTitle = formatMessageTitle([patch]);
8887
const messageBody = formatMessageBody(patch, false);
89-
await ctx.execGitNode('add', 'deps/v8');
90-
await ctx.execGitNode('commit', '-m', messageTitle, '-m', messageBody);
88+
await ctx.execGitNode('add', ['deps/v8']);
89+
await ctx.execGitNode('commit', ['-m', messageTitle, '-m', messageBody]);
9190
}
9291
};
9392
}
@@ -200,13 +199,10 @@ function applyPatchTask(patch) {
200199

201200
async function applyPatch(ctx, patch) {
202201
try {
203-
await execa(
204-
'patch',
205-
['-p1', '--merge', '--no-backup-if-mismatch', '--directory=deps/v8'],
206-
{
207-
cwd: ctx.nodeDir,
208-
input: patch.data
209-
}
202+
await ctx.execGitNode(
203+
'apply',
204+
['-p1', '--3way', '--directory=deps/v8'],
205+
patch.data /* input */
210206
);
211207
} catch (e) {
212208
patch.hadConflicts = true;
@@ -246,7 +242,7 @@ function incrementEmbedderVersion() {
246242
commonGypiPath,
247243
commonGypi.replace(embedderRegex, embedderString)
248244
);
249-
await ctx.execGitNode('add', 'common.gypi');
245+
await ctx.execGitNode('add', ['common.gypi']);
250246
}
251247
};
252248
}

0 commit comments

Comments
 (0)