-
Notifications
You must be signed in to change notification settings - Fork 104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for git submodules. Addresses issue #54. #55
Conversation
if (stat.isDirectory()) { | ||
return true; | ||
if (stat.isDirectory()) return true; | ||
else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I strongly prefer if
statements to always have curly braces, maybe make this a early return e.g. get rid of the else here
else { | ||
// check if the directory is a submodule | ||
// addresses https://github.com/mixu/gr/issues/54 | ||
var path = req.path.split(/(\\|\/)/).slice(0, -2).join('/'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
path.dirname(path.dirname(req.path))
?
stat = fs.statSync(path + '/.git/'); | ||
if (stat.isDirectory()) { | ||
stat = fs.statSync(path + '/.gitmodules') | ||
if (stat.isFile()) return true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: needs curly braces
@mixu I updated the code according to your suggestions, and moved it into the catch block since statSync should throw an error when trying to access a non-existent directory. |
👍 thanks for making these changes and for the PR! Merged! |
published as |
@mixu you're welcome, thanks for the great tool! |
No description provided.