Fix parallel usage of .versions in the git resolver.

This commit is contained in:
André Cruz
2013-07-03 14:31:15 +01:00
parent f58fb3e556
commit 552fd52bd5
2 changed files with 75 additions and 4 deletions

View File

@@ -95,7 +95,7 @@ GitResolver.prototype._findResolution = function (target) {
}
// Target is a range/version
if (semver.valid(target) != null || semver.validRange(target) != null) {
if (semver.validRange(target)) {
return self.versions(this._source, true)
.then(function (versions) {
// If there are no tags and target is *,
@@ -214,7 +214,9 @@ GitResolver.versions = function (source, extra) {
if (value) {
return Q.resolve(value)
.then(function (versions) {
.then(function () {
var versions = this._cache.versions.get(source);
// If no extra information was requested,
// resolve simply with the versions
if (!extra) {
@@ -224,14 +226,14 @@ GitResolver.versions = function (source, extra) {
}
return versions;
});
}.bind(this));
}
value = this.tags(source)
.then(function (tags) {
var versions = [];
var tag;
var version;
var versions = [];
// For each tag
for (tag in tags) {