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
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
22 changes: 18 additions & 4 deletions lib/command-requirements.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var fs = require('fs');
var fs = require('fs'),
path = require('path');

module.exports = {
git: function(req) {
Expand All @@ -8,9 +9,22 @@ module.exports = {
if (stat.isDirectory()) {
return true;
}
} catch (e) { }
} catch (e) {
// check if the directory is a submodule
// addresses https://github.com/mixu/gr/issues/54
if (e.code === 'ENOTDIR' || e.code === 'ENOENT')
{
var parentPath = path.dirname(req.path);
try {
stat = fs.statSync(parentPath + '/.gitmodules');
if (stat.isFile()) {
return true;
}
} catch (e) { }
}
}
if (req.format === 'human') {
console.log('Skipped ' + req.path + ' as it does not have a .git subdirectory.');
console.log('Skipped ' + req.path + ' as it does not have a .git subdirectory and is not a submodule.');
}
return false;
},
Expand All @@ -19,10 +33,10 @@ module.exports = {
try {
stat = fs.statSync(req.path + '/Makefile');
if (stat.isFile()) {
return true;
}
} catch (e) { }
if (req.format === 'human') {
return true;
console.log('Skipped ' + req.path + ' as it does not have a ./Makefile file.');
}
return false;
Expand Down