overleaf/git-revision.js
2016-05-02 23:53:49 +00:00

22 lines
504 B
JavaScript

var simple = require('simple-git');
var services = require('./sharelatex/config/services');
const fs = require('fs');
function print_latest(repoDir) {
git = simple(repoDir);
opt = [];
opt['max-count'] = 1;
git.log(opt, function(err, log) {
if (!err) {
console.log(repoDir + ',' + log.latest.hash);
}
})
}
for (id in services) {
service = services[id];
dirPath = __dirname + '/sharelatex/'+service.name;
if (fs.existsSync(dirPath)) {
print_latest(dirPath);
}
}