File tree 2 files changed +3
-2
lines changed
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');
7
7
* Given a full path to a single file, iterate upwards through the filesystem
8
8
* to find a directory with a .git file indicating that it is a git repository
9
9
* @param {string } filename any file within a repository
10
- * @returns {string } repository path
10
+ * @returns {string|undefined } repository path
11
11
*/
12
12
function findGit ( filename ) {
13
13
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');
12
12
* @return {Object } comment with github inferred
13
13
*/
14
14
module . 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 ) : '.' ;
16
17
var urlPrefix = getGithubURLPrefix ( root ) ;
17
18
var fileRelativePath = comment . context . file . replace ( root + path . sep , '' )
18
19
. split ( path . sep )
You can’t perform that action at this time.
0 commit comments