File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed
Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change 11'use strict' ;
22
33const path = require ( 'path' ) ;
4+ const { URL } = require ( 'url' ) ;
45
56const {
67 runAsync, runSync, forceRunAsync, exit
@@ -14,6 +15,33 @@ class LandingSession extends Session {
1415 super ( dir , prid , config ) ;
1516 this . cli = cli ;
1617 this . req = req ;
18+ const { upstream } = this ;
19+ const upstreamHref = runSync ( 'git' , [ 'config' , '--get' ,
20+ `remote.${ upstream } .url` ] ) ;
21+ let warned = false ;
22+ try {
23+ const { hostname, pathname } = new URL ( upstreamHref ) ;
24+ if ( hostname !== 'github.com' ) {
25+ warned = true ;
26+ cli . warn ( 'Remote repository URL does not point to the expected ' +
27+ 'host "github.com"' ) ;
28+ }
29+ if ( / ^ \/ n o d e j s \/ n o d e (?: \. g i t ) ? $ / . test ( pathname ) !== true ) {
30+ warned = true ;
31+ cli . warn ( 'Remote repository URL does not point to the expected ' +
32+ 'repository "/nodejs/node"' ) ;
33+ }
34+ } catch ( e ) {
35+ warned = true ;
36+ cli . warn ( 'Could not parse remote repository URL %j, this might be ' +
37+ 'because it is not a HTTPS URL' , upstreamHref ) ;
38+ }
39+ if ( warned ) {
40+ cli . warn ( 'You might want to change the remote repository URL with ' +
41+ `\`git remote set-url ${
42+ upstream
43+ } "https://github.com/nodejs/node.git"\``) ;
44+ }
1745 }
1846
1947 async start ( metadata ) {
You can’t perform that action at this time.
0 commit comments