Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fixup! chore(git-node): avoid dealing with patch files for landing
  • Loading branch information
addaleax committed Sep 7, 2020
commit 947ec984d4166b1691d0f576cee504a1c655fd9c
18 changes: 10 additions & 8 deletions lib/landing_session.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,14 @@ class LandingSession extends Session {
await runAsync('git', [
'fetch', `https://github.com/${owner}/${repo}.git`,
`refs/pull/${prid}/merge`]);
const [base, head] = (await runAsync('git', [
'rev-parse', 'FETCH_HEAD^1', 'FETCH_HEAD^2'], { captureStdout: true }))
.split('\n');
const commitShas = (await runAsync('git', [
'rev-list', `${base}..${head}`], { captureStdout: true }))
.trim().split('\n');
// We fetched the commit that would result if we used `git merge`.
// ^1 and ^2 refer to the PR base and the PR head, respectively.
const [base, head] = await runAsync('git',
['rev-parse', 'FETCH_HEAD^1', 'FETCH_HEAD^2'],
{ captureStdout: 'lines' });
const commitShas = await runAsync('git',
['rev-list', `${base}..${head}`],
{ captureStdout: 'lines' });
cli.stopSpinner(`Fetched commits as ${shortSha(base)}..${shortSha(head)}`);
cli.separator();

Expand Down Expand Up @@ -188,9 +190,9 @@ class LandingSession extends Session {

async tryCompleteLanding(commitInfo) {
const { cli } = this;
const subjects = (await runAsync('git',
const subjects = await runAsync('git',
['log', '--pretty=format:%s', `${commitInfo.base}..${commitInfo.head}`],
{ captureStdout: true })).trim().split('\n');
{ captureStdout: 'lines' });

if (commitInfo.shas.length === 1) {
const shouldAmend = await cli.prompt(
Expand Down
4 changes: 4 additions & 0 deletions lib/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ function runAsyncBase(cmd, args, {
err.messageOnly = true;
return reject(err);
}
if (captureStdout === 'lines') {
stdout = stdout.split(/\r?\n/g);
if (stdout[stdout.length - 1] === '') stdout.pop();
}
return resolve(stdout);
});
});
Expand Down