@@ -7,8 +7,9 @@ var pathUtil = require('./path');
77var Promise = require ( './promise' ) ;
88var command = require ( './command' ) ;
99var fs = require ( './fs' ) ;
10+ var LocationUtils = require ( './location' ) ;
1011
11- var GIT_PREFIX = 'git+' ;
12+ var GIT_PREFIX = require ( '../constants/gitPrefix' ) ;
1213
1314function Git ( ) {
1415 this . tmpDir ;
@@ -65,7 +66,7 @@ Git.prototype.clone = function(host, ref) {
6566// Get file from a git repo
6667Git . prototype . resolve = function ( giturl ) {
6768 // Path to a file in a git repo?
68- if ( ! Git . isUrl ( giturl ) ) {
69+ if ( ! LocationUtils . isGitUrl ( giturl ) ) {
6970 if ( this . resolveRoot ( giturl ) ) return Promise ( giturl ) ;
7071 return Promise ( null ) ;
7172 }
@@ -97,16 +98,11 @@ Git.prototype.resolveRoot = function(filepath) {
9798 return path . resolve ( this . tmpDir , repoId ) ;
9899} ;
99100
100- // Check if an url is a git dependency url
101- Git . isUrl = function ( giturl ) {
102- return ( giturl . indexOf ( GIT_PREFIX ) === 0 ) ;
103- } ;
104-
105101// Parse and extract infos
106102Git . parseUrl = function ( giturl ) {
107103 var ref , uri , fileParts , filepath ;
108104
109- if ( ! Git . isUrl ( giturl ) ) return null ;
105+ if ( ! LocationUtils . isGitUrl ( giturl ) ) return null ;
110106 giturl = giturl . slice ( GIT_PREFIX . length ) ;
111107
112108 uri = new URI ( giturl ) ;
0 commit comments