Skip to content

Commit

Permalink
Fix github link generation for Node.js 6 (#524)
Browse files Browse the repository at this point in the history
In Node.js 6 additional assertions was added in path module:
nodejs/node#5348
  • Loading branch information
ikokostya authored and tmcw committed Sep 4, 2016
1 parent 0a97e0e commit 28d51fc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/git/find_git.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ var fs = require('fs');
* Given a full path to a single file, iterate upwards through the filesystem
* to find a directory with a .git file indicating that it is a git repository
* @param {string} filename any file within a repository
* @returns {string} repository path
* @returns {string|undefined} repository path
*/
function findGit(filename) {
var paths = filename.split(path.sep);
Expand Down
3 changes: 2 additions & 1 deletion lib/github.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ var getGithubURLPrefix = require('../lib/git/url_prefix');
* @return {Object} comment with github inferred
*/
module.exports = function (comment) {
var root = path.dirname(findGit(comment.context.file));
var repoPath = findGit(comment.context.file);
var root = repoPath ? path.dirname(repoPath) : '.';
var urlPrefix = getGithubURLPrefix(root);
var fileRelativePath = comment.context.file.replace(root + path.sep, '')
.split(path.sep)
Expand Down

0 comments on commit 28d51fc

Please sign in to comment.