lib/utils/git.js
function parseGitUrl(giturl) {
    var ref, uri, fileParts, filepath;

    if (!checkGitUrl(giturl)) return null;
    giturl = giturl.slice(GIT_PREFIX.length);

    uri = new URI(giturl);
    ref = uri.fragment() || 'master';
    uri.fragment(null);

    // Extract file inside the repo (after the .git)
    fileParts =uri.path().split('.git');
    filepath = fileParts.length > 1? fileParts.slice(1).join('.git') : '';
    if (filepath[0] == '/') filepath = filepath.slice(1);

    // Recreate pathname without the real filename
    uri.path(_.first(fileParts)+'.git');

    return {
        host: uri.toString(),
        ref: ref || 'master',
        filepath: filepath
    };
}
function parseGitUrl(giturl) {
    var ref, uri, fileParts, filepath;

    if (!checkGitUrl(giturl)) return null;
    giturl = giturl.slice(GIT_PREFIX.length);

    uri = new URI(giturl);
    ref = uri.fragment() || 'master';
    uri.fragment(null);

    // Extract file inside the repo (after the .git)
    fileParts =uri.path().split('.git');
    filepath = fileParts.length > 1? fileParts.slice(1).join('.git') : '';
    if (filepath[0] == '/') filepath = filepath.slice(1);

    // Recreate pathname without the real filename
    uri.path(_.first(fileParts)+'.git');

    return {
        host: uri.toString(),
        ref: ref || 'master',
        filepath: filepath
    };
}
function parseGitUrl ( giturl ) { var ref , uri , fileParts , filepath ; if ( ! checkGitUrl ( giturl ) ) return null ; giturl = giturl . slice ( GIT_PREFIX . length ) ; uri = new URI ( giturl ) ; ref = uri . fragment ( ) || 'master' ; uri . fragment ( null ) ; // Extract file inside the repo (after the .git) fileParts = uri . path ( ) . split ( '.git' ) ; filepath = fileParts . length > 1 ? fileParts . slice ( 1 ) . join ( '.git' ) : '' ; if ( filepath [ 0 ] == '/' ) filepath = filepath . slice ( 1 ) ; // Recreate pathname without the real filename uri . path ( _ . first ( fileParts ) + '.git' ) ; return { host : uri . toString ( ) , ref : ref || 'master' , filepath : filepath } ; }
Parse and extract infos
Parse and extract infos