You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ag...@apache.org on 2013/06/25 21:25:45 UTC

git commit: Don't use --short flag for symbolic-ref command.

Updated Branches:
  refs/heads/master 9da76568f -> 50c780dde


Don't use --short flag for symbolic-ref command.

Make it (hopefully) work with older git versions.


Project: http://git-wip-us.apache.org/repos/asf/cordova-coho/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-coho/commit/50c780dd
Tree: http://git-wip-us.apache.org/repos/asf/cordova-coho/tree/50c780dd
Diff: http://git-wip-us.apache.org/repos/asf/cordova-coho/diff/50c780dd

Branch: refs/heads/master
Commit: 50c780ddebcb94c58df30e0205dc5669263949f8
Parents: 9da7656
Author: Andrew Grieve <ag...@chromium.org>
Authored: Tue Jun 25 15:25:07 2013 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Tue Jun 25 15:25:07 2013 -0400

----------------------------------------------------------------------
 coho | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-coho/blob/50c780dd/coho
----------------------------------------------------------------------
diff --git a/coho b/coho
index 7d7c9c7..771948c 100755
--- a/coho
+++ b/coho
@@ -571,15 +571,15 @@ function remoteBranchExists(repo, name) {
 }
 
 function retrieveCurrentBranchName() {
-    try {
-        var ret = execHelper('git symbolic-ref --short HEAD', true, true);
-    } catch (e) {
-        ret = execHelper('git symbolic-ref --short HEAD', true, true);
-    }
-    if (!ret) {
+    var ref = execHelper('git symbolic-ref HEAD', true, true);
+    if (!ref) {
         throw new Error('Aborted due to repo ' + shjs.pwd() + ' not being on a named branch');
     }
-    return ret;
+    var match = /refs\/heads\/(.*)/.exec(ref);
+    if (!match) {
+        throw new Error('Could not parse branch name from: ' + ref);
+    }
+    return match[1];
 }
 
 function retrieveCurrentTagName() {