Skip to content
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

Merged
merged 1 commit into from
Oct 16, 2016
Merged

Add support for git submodules. Addresses issue #54. #55

merged 1 commit into from
Oct 16, 2016

Conversation

balos1
Copy link
Contributor

@balos1 balos1 commented Oct 10, 2016

No description provided.

if (stat.isDirectory()) {
return true;
if (stat.isDirectory()) return true;
else {
Copy link
Owner

@mixu mixu Oct 11, 2016

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('/');
Copy link
Owner

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;
Copy link
Owner

@mixu mixu Oct 11, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: needs curly braces

@balos1
Copy link
Contributor Author

balos1 commented Oct 15, 2016

@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.

@mixu mixu merged commit 56d6578 into mixu:master Oct 16, 2016
@mixu
Copy link
Owner

mixu commented Oct 16, 2016

👍 thanks for making these changes and for the PR! Merged!

@mixu
Copy link
Owner

mixu commented Oct 16, 2016

published as v0.5.2

@balos1
Copy link
Contributor Author

balos1 commented Oct 16, 2016

@mixu you're welcome, thanks for the great tool!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants