File tree Expand file tree Collapse file tree 2 files changed +3
-2
lines changed Expand file tree Collapse file tree 2 files changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ var fs = require('fs');
77 * Given a full path to a single file, iterate upwards through the filesystem
88 * to find a directory with a .git file indicating that it is a git repository
99 * @param {string } filename any file within a repository
10- * @returns {string } repository path
10+ * @returns {string|undefined } repository path
1111 */
1212function findGit ( filename ) {
1313 var paths = filename . split ( path . sep ) ;
Original file line number Diff line number Diff line change @@ -12,7 +12,8 @@ var getGithubURLPrefix = require('../lib/git/url_prefix');
1212 * @return {Object } comment with github inferred
1313 */
1414module . exports = function ( comment ) {
15- var root = path . dirname ( findGit ( comment . context . file ) ) ;
15+ var repoPath = findGit ( comment . context . file ) ;
16+ var root = repoPath ? path . dirname ( repoPath ) : '.' ;
1617 var urlPrefix = getGithubURLPrefix ( root ) ;
1718 var fileRelativePath = comment . context . file . replace ( root + path . sep , '' )
1819 . split ( path . sep )
You can’t perform that action at this time.
0 commit comments