File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ var gitHosts = module.exports = {
2323 'domain' : 'gitlab.com' ,
2424 'treepath' : 'tree' ,
2525 'bugstemplate' : 'https://{domain}/{user}/{project}/issues' ,
26+ 'httpstemplate' : 'git+https://{auth@}{domain}/{user}/{projectPath}.git{#committish}' ,
2627 'tarballtemplate' : 'https://{domain}/{user}/{project}/repository/archive.tar.gz?ref={committish}'
2728 } ,
2829 gist : {
Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ GitHost.prototype._fill = function (template, opts) {
3636 var rawcommittish = vars . committish
3737 var rawFragment = vars . fragment
3838 var rawPath = vars . path
39+ var rawProject = vars . project
3940 Object . keys ( vars ) . forEach ( function ( key ) {
4041 vars [ key ] = encodeURIComponent ( vars [ key ] )
4142 } )
@@ -44,6 +45,7 @@ GitHost.prototype._fill = function (template, opts) {
4445 vars . fragment = vars . fragment ? vars . fragment : ''
4546 vars [ '#path' ] = rawPath ? '#' + this . hashformat ( rawPath ) : ''
4647 vars [ '/path' ] = vars . path ? '/' + vars . path : ''
48+ vars . projectPath = rawProject . split ( '/' ) . map ( encodeURIComponent ) . join ( '/' )
4749 if ( opts . noCommittish ) {
4850 vars [ '#committish' ] = ''
4951 vars [ '/tree/committish' ] = ''
Original file line number Diff line number Diff line change @@ -23,5 +23,11 @@ test('fromUrl(gitlab url)', function (t) {
2323 require ( './lib/standard-tests' ) ( verify , 'gitlab.com' , 'gitlab' )
2424 require ( './lib/standard-tests' ) ( verify , 'www.gitlab.com' , 'gitlab' )
2525
26+ t . is (
27+ HostedGit . fromUrl ( 'gitlab:group/sub group1/subgroup2/repo' ) . https ( ) ,
28+ 'git+https://gitlab.com/group/sub%20group1/subgroup2/repo.git' ,
29+ 'subgroups are delimited with slashes and url encoded (shortcut -> https)'
30+ )
31+
2632 t . end ( )
2733} )
You can’t perform that action at this time.
0 commit comments