AbsolutePaths: be able to read the git commit version independently on CWD

--HG--
branch : absolute-paths
This commit is contained in:
muxator 2018-10-19 18:57:56 +02:00 committed by muxator
parent 72ccb28382
commit 48b0290977

View file

@ -367,7 +367,7 @@ exports.exportAvailable = function() {
exports.getGitCommit = function() {
var version = "";
try {
var rootPath = path.resolve(npm.dir, '..');
var rootPath = exports.root;
if (fs.lstatSync(rootPath + '/.git').isFile()) {
rootPath = fs.readFileSync(rootPath + '/.git', "utf8");
rootPath = rootPath.split(' ').pop().trim();