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 2016/03/19 01:41:29 UTC

cordova-coho git commit: CB-9911 update-release-notes now handles prefixed tags

Repository: cordova-coho
Updated Branches:
  refs/heads/master 611f3af5b -> 532f027c6


CB-9911 update-release-notes now handles prefixed tags


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

Branch: refs/heads/master
Commit: 532f027c65f7bb93d3b97a204c4bdd3727249e5b
Parents: 611f3af
Author: Steve Gill <st...@gmail.com>
Authored: Fri Mar 18 17:41:23 2016 -0700
Committer: Steve Gill <st...@gmail.com>
Committed: Fri Mar 18 17:41:23 2016 -0700

----------------------------------------------------------------------
 src/gitutil.js | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-coho/blob/532f027c/src/gitutil.js
----------------------------------------------------------------------
diff --git a/src/gitutil.js b/src/gitutil.js
index 3c1851c..5aae6f2 100644
--- a/src/gitutil.js
+++ b/src/gitutil.js
@@ -31,14 +31,14 @@ var semver = require('semver');
  */
 exports.findMostRecentTag = function*(prefix) {
     prefix = prefix && prefix + "-";
+    var finalBest;
 
     return (yield executil.execHelper(executil.ARGS('git tag --list'), true)).split(/\s+/)
         .reduce(function (curBest, value) {
             var modifiedCurBest, modifiedValue;
-            //console.log('curBest: ', curBest, ' value: ', value)
             if (prefix) {
                 // Ignore values that don't start with prefix, and strip prefix from the value we're going to test
-                if (value.indexOf(prefix) !== 0) {
+                if (value.indexOf(prefix) !== 0 ) {
                     modifiedValue = null;
                     modifiedCurBest = null;
                 } else {
@@ -52,9 +52,13 @@ exports.findMostRecentTag = function*(prefix) {
             }
 
             if (semver.valid(modifiedValue)) {
+                //use finalBest to hold onto reference outside of reduce function
+                finalBest = !curBest ? value : semver.gt(modifiedCurBest, modifiedValue) ? finalBest : value;
                 return !curBest ? value : semver.gt(modifiedCurBest, modifiedValue) ? curBest : value;
             } else if (curBest && semver.valid(modifiedCurBest)) {
                 return curBest;
+            } else if(finalBest) {
+                return finalBest;
             }
             return null;
         });


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org