Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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