You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by st...@apache.org on 2014/08/30 01:59:03 UTC

[5/7] js commit: CB-7219 made sure compute commit id is run from cordova-js repo. Set cwd to cordova-js

CB-7219 made sure compute commit id is run from cordova-js repo. Set cwd to cordova-js


Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/6e7d6458
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/6e7d6458
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/6e7d6458

Branch: refs/heads/cb-7219
Commit: 6e7d6458852630c595a2e73c8e99da9b18fe8794
Parents: d1e0a91
Author: Steven Gill <st...@gmail.com>
Authored: Tue Aug 12 17:37:29 2014 -0700
Committer: Steven Gill <st...@gmail.com>
Committed: Mon Aug 18 17:09:09 2014 -0700

----------------------------------------------------------------------
 tasks/lib/compute-commit-id.js | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/6e7d6458/tasks/lib/compute-commit-id.js
----------------------------------------------------------------------
diff --git a/tasks/lib/compute-commit-id.js b/tasks/lib/compute-commit-id.js
index 794ebd9..a4c4765 100644
--- a/tasks/lib/compute-commit-id.js
+++ b/tasks/lib/compute-commit-id.js
@@ -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') + '"';
@@ -51,6 +54,7 @@ module.exports = function computeCommitId(callback, cachedGitVersion) {
             }
         });
     } else {
+        console.log('no git');
         done('???');
     }