lib/utils/git.js
function resolveGitRoot(filepath) {
    var relativeToGit, repoId;

    // No git repo cloned, or file is not in a git repository
    if (!GIT_TMP || !pathUtil.isInRoot(GIT_TMP, filepath)) return null;

    // Extract first directory (is the repo id)
    relativeToGit = path.relative(GIT_TMP, filepath);
    repoId = _.first(relativeToGit.split(path.sep));
    if (!repoId) return;

    // Return an absolute file
    return path.resolve(GIT_TMP, repoId);
}
function resolveGitRoot(filepath) {
    var relativeToGit, repoId;

    // No git repo cloned, or file is not in a git repository
    if (!GIT_TMP || !pathUtil.isInRoot(GIT_TMP, filepath)) return null;

    // Extract first directory (is the repo id)
    relativeToGit = path.relative(GIT_TMP, filepath);
    repoId = _.first(relativeToGit.split(path.sep));
    if (!repoId) return;

    // Return an absolute file
    return path.resolve(GIT_TMP, repoId);
}
function resolveGitRoot ( filepath ) { var relativeToGit , repoId ; // No git repo cloned, or file is not in a git repository if ( ! GIT_TMP || ! pathUtil . isInRoot ( GIT_TMP , filepath ) ) return null ; // Extract first directory (is the repo id) relativeToGit = path . relative ( GIT_TMP , filepath ) ; repoId = _ . first ( relativeToGit . split ( path . sep ) ) ; if ( ! repoId ) return ; // Return an absolute file return path . resolve ( GIT_TMP , repoId ) ; }
Return root of git repo from a filepath
Return root of git repo from a filepath