Skip to content

Commit

Permalink
Using a function reference instead of calling directly from constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
nwinkler committed Mar 24, 2015
1 parent 4ad5ed6 commit a352d51
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
4 changes: 3 additions & 1 deletion lib/core/resolvers/GitHubResolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ function GitHubResolver(decEndpoint, config, logger) {
}

// Enable shallow clones for GitHub repos
this._shallowClone = Q.resolve(true);
this._shallowClone = function() {
return Q.resolve(true);
};
}

util.inherits(GitHubResolver, GitRemoteResolver);
Expand Down
4 changes: 2 additions & 2 deletions lib/core/resolvers/GitRemoteResolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function GitRemoteResolver(decEndpoint, config, logger) {
this._remote = url.parse(this._source);

// Verify whether the server supports shallow cloning
this._shallowClone = this._supportsShallowCloning();
this._shallowClone = this._supportsShallowCloning;
}

util.inherits(GitRemoteResolver, GitResolver);
Expand Down Expand Up @@ -117,7 +117,7 @@ GitRemoteResolver.prototype._fastClone = function (resolution) {
branch = resolution.tag || resolution.branch;
args = ['clone', this._source, '-b', branch, '--progress', '.'];

return this._shallowClone.then(function (shallowCloningSupported) {
return this._shallowClone().then(function (shallowCloningSupported) {
// If the host does not support shallow clones, we don't use --depth=1
if (shallowCloningSupported && !GitRemoteResolver._noShallow.get(this._host)) {
args.push('--depth', 1);
Expand Down
6 changes: 3 additions & 3 deletions test/core/resolvers/gitRemoteResolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ describe('GitRemoteResolver', function () {

var resolver = new MyGitRemoteResolver({ source: testSource }, defaultConfig(), logger);

resolver._shallowClone.then(function (shallowCloningSupported) {
resolver._shallowClone().then(function (shallowCloningSupported) {
expect(shallowCloningSupported).to.be(false);

next();
Expand All @@ -307,7 +307,7 @@ describe('GitRemoteResolver', function () {

var resolver = new MyGitRemoteResolver({ source: testSource }, defaultConfig(), logger);

resolver._shallowClone.then(function (shallowCloningSupported) {
resolver._shallowClone().then(function (shallowCloningSupported) {
expect(shallowCloningSupported).to.be(false);

next();
Expand All @@ -327,7 +327,7 @@ describe('GitRemoteResolver', function () {

var resolver = new MyGitRemoteResolver({ source: testSource }, defaultConfig(), logger);

resolver._shallowClone.then(function (shallowCloningSupported) {
resolver._shallowClone().then(function (shallowCloningSupported) {
expect(shallowCloningSupported).to.be(true);

next();
Expand Down

0 comments on commit a352d51

Please sign in to comment.