From 09922ac75ab168867d5c71e4878a16e83a2a06ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= Date: Wed, 18 Oct 2017 13:20:29 -0700 Subject: [PATCH] feat: add Refs URL for commit backports Refs: https://github.com/nodejs/node/pull/16054 --- src/backport.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/backport.js b/src/backport.js index 8f2cb92..fecd895 100644 --- a/src/backport.js +++ b/src/backport.js @@ -31,7 +31,8 @@ exports.commitBackport = function commitBackport() { task: (ctx) => { const messageTitle = `deps: cherry-pick ${ctx.sha.substring(0, 7)} from upstream V8`; const messageBody = `Original commit message:\n\n ` + - ctx.message.replace(/\n/g, '\n '); + ctx.message.replace(/\n/g, '\n ') + + `\n\nRefs: https://github.com/v8/v8/commit/${ctx.sha}`; return execGitNode('add', 'deps/v8') .then(() => execGitNode('commit', '-m', messageTitle, '-m', messageBody)); @@ -48,8 +49,8 @@ function generatePatch() { title: 'Generate patch', task: (ctx) => { const sha = ctx.sha; - if (!sha) { - throw new Error('Commit SHA is required'); + if (!sha || sha.length !== 40) { + throw new Error('--sha option is required and must be 40 characters long'); } return Promise.all([ execGitV8('format-patch', '--stdout', `${sha}^..${sha}`),