Skip to content

Commit 8746db3

Browse files
authored
fix(git-node): clarify remote configuration error message (#1001)
1 parent caee3c5 commit 8746db3

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

lib/session.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -382,10 +382,14 @@ export default class Session {
382382
cli.setExitCode(1);
383383
}
384384
if (!upstream) {
385-
cli.warn('You need to configure the remote repository for Node.js core.');
385+
cli.warn('You have not told git-node what remote name you are trying to land commits on.');
386386
cli.separator();
387-
cli.info(
388-
'1. First, add the Node.js core repository as a remote (if not already added):\n' +
387+
const remoteName = runSync('git', ['remote', '-v'])
388+
.match(/^(\S+)\s+(?:https:\/\/github\.com\/|git@github\.com:)nodejs\/node\.git \(\S+\)\r?$/m)?.[1];
389+
cli.info(remoteName
390+
? `You likely want to run the following:\n\n $ ncu-config set upstream ${remoteName}`
391+
: 'The expected repository does not seem to appear in your local config.\n' +
392+
'1. First, add the Node.js core repository as a remote:\n' +
389393
' $ git remote add upstream https://github.com/nodejs/node.git\n\n' +
390394
'2. Then, tell git-node to use this remote for syncing:\n' +
391395
' $ ncu-config set upstream upstream\n\n' +

0 commit comments

Comments
 (0)