mirror of
https://github.com/bower/bower.git
synced 2026-02-11 14:34:58 -05:00
Remove fetch origin in the GitFsResolver.
This commit is contained in:
@@ -22,11 +22,11 @@ mout.object.mixIn(GitFsResolver, GitResolver);
|
||||
// -----------------
|
||||
|
||||
GitFsResolver.prototype._resolveSelf = function () {
|
||||
this._sourcePath = this._tempDir;
|
||||
|
||||
return this._copy()
|
||||
.then(this._fetch.bind(this))
|
||||
.then(GitResolver.prototype._resolveSelf.bind(this));
|
||||
return this._findResolution()
|
||||
.then(this._copy.bind(this))
|
||||
.then(function () {
|
||||
return this._checkout(this._resolution);
|
||||
}.bind(this));
|
||||
};
|
||||
|
||||
// -----------------
|
||||
@@ -45,21 +45,6 @@ GitFsResolver.prototype._copy = function () {
|
||||
}.bind(this));
|
||||
};
|
||||
|
||||
GitFsResolver.prototype._fetch = function () {
|
||||
var dir = this._tempDir;
|
||||
|
||||
// Check if there is at least one remote
|
||||
return cmd('git', ['remote'], { cwd: dir })
|
||||
.then(function (stdout) {
|
||||
var hasRemote = !!stdout.trim().length;
|
||||
|
||||
// If so, do a fetch to grab the new tags and refs
|
||||
if (hasRemote) {
|
||||
return cmd('git', ['fetch']);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// Override the checkout function to work with the local copy
|
||||
GitFsResolver.prototype._checkout = function (resolution) {
|
||||
var dir = this._tempDir;
|
||||
|
||||
@@ -7,11 +7,6 @@ var createError = require('../../util/createError');
|
||||
|
||||
var GitResolver = function (source, options) {
|
||||
Resolver.call(this, source, options);
|
||||
|
||||
// Set the source path to be the same as the original source by default
|
||||
// The source path is the real location of the repository since it
|
||||
// can be infered from the source or simply a different one
|
||||
this._sourcePath = this._source;
|
||||
};
|
||||
|
||||
util.inherits(GitResolver, Resolver);
|
||||
@@ -59,7 +54,7 @@ GitResolver.prototype._findResolution = function (target) {
|
||||
|
||||
// Target is a range/version
|
||||
if (semver.valid(target) != null || semver.validRange(target) != null) {
|
||||
return self.fetchVersions(this._sourcePath)
|
||||
return self.fetchVersions(this._source)
|
||||
.then(function (versions) {
|
||||
// If there are no tags and target is *,
|
||||
// fallback to the latest commit on master
|
||||
@@ -80,18 +75,19 @@ GitResolver.prototype._findResolution = function (target) {
|
||||
});
|
||||
}
|
||||
|
||||
return { type: 'tag', tag: version };
|
||||
return this._resolution = { type: 'tag', tag: version };
|
||||
}.bind(this));
|
||||
}
|
||||
|
||||
// Target is a commit, so it's a stale target (not a moving target)
|
||||
// There's nothing to do in this case
|
||||
if ((/^[a-f0-9]{40}$/).test(target)) {
|
||||
return Q.resolve({ type: 'commit', commit: target });
|
||||
this._resolution = { type: 'commit', commit: target };
|
||||
return Q.resolve(this._resolution);
|
||||
}
|
||||
|
||||
// Otherwise, assume target is a branch
|
||||
return self.fetchHeads(this._sourcePath)
|
||||
return self.fetchHeads(this._source)
|
||||
.then(function (heads) {
|
||||
if (!heads[target]) {
|
||||
branches = Object.keys(heads);
|
||||
@@ -102,7 +98,7 @@ GitResolver.prototype._findResolution = function (target) {
|
||||
});
|
||||
}
|
||||
|
||||
return { type: 'branch', branch: target, commit: heads[target] };
|
||||
return this._resolution = { type: 'branch', branch: target, commit: heads[target] };
|
||||
}.bind(this));
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user