Skip to content

Commit

Permalink
CB-7219 made sure compute commit id is run from cordova-js repo. Set …
Browse files Browse the repository at this point in the history
…cwd to cordova-js
  • Loading branch information
stevengill committed Sep 24, 2014
1 parent 03f88ba commit 75c00aa
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions tasks/lib/compute-commit-id.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,14 @@ module.exports = function computeCommitId(callback, cachedGitVersion) {
callback(cachedGitVersion);
return;
}

if (fs.existsSync('.git')) {

var cordovaJSDir = path.join(__dirname, '../../');

//make sure .git directory exists in cordova.js repo
if (fs.existsSync(path.join(__dirname, '../../.git'))) {
var gitPath = 'git';
var args = 'rev-list HEAD --max-count=1';
childProcess.exec(gitPath + ' ' + args, function(err, stdout, stderr) {
childProcess.exec(gitPath + ' ' + args, {cwd:cordovaJSDir}, function(err, stdout, stderr) {
var isWindows = process.platform.slice(0, 3) == 'win';
if (err && isWindows) {
gitPath = '"' + path.join(process.env['ProgramFiles'], 'Git', 'bin', 'git.exe') + '"';
Expand All @@ -51,6 +54,7 @@ module.exports = function computeCommitId(callback, cachedGitVersion) {
}
});
} else {
console.log('no git');
done('???');
}

Expand Down

0 comments on commit 75c00aa

Please sign in to comment.