diff --git a/lib/core/package.js b/lib/core/package.js index e9a6ce985..c25485b62 100644 --- a/lib/core/package.js +++ b/lib/core/package.js @@ -364,7 +364,7 @@ Package.prototype.exists = function (callback) { Package.prototype.clone = function () { template('action', { name: 'cloning', shizzle: this.gitUrl }).on('data', this.emit.bind(this, 'data')); - this.path = path.resolve(config.cache, this.name, this.resourceId); + this.path = path.resolve(config.cache, this.name, this.resourceId); this.once('cache', function () { this.once('loadJSON', this.copy.bind(this)).checkout(); }.bind(this)).cache(); @@ -402,7 +402,7 @@ Package.prototype.cache = function () { var cp = spawn('git', ['clone', url, this.path]); cp.on('close', function (code) { - if (code > 0) return this.emit('error', new Error('Git status: ' + code)); + if (code) return this.emit('error', new Error('Git status: ' + code)); this.emit('cache'); }.bind(this)); }.bind(this)); @@ -445,10 +445,10 @@ Package.prototype.checkout = function () { // Checkout the tag spawn('git', [ 'checkout', this.tag, '-f'], { cwd: this.path }).on('close', function (code) { - if (code > 0) return this.emit('error', new Error('Git status: ' + code)); + if (code) return this.emit('error', new Error('Git status: ' + code)); // Ensure that checkout the tag as it is, removing all untracked files spawn('git', ['clean', '-f', '-d'], { cwd: this.path }).on('close', function (code) { - if (code > 0) return this.emit('error', new Error('Git status: ' + code)); + if (code) return this.emit('error', new Error('Git status: ' + code)); this.emit('checkout'); this.loadJSON(); }.bind(this)); @@ -469,7 +469,7 @@ Package.prototype.describeTag = function () { cp.on('close', function (code) { if (code == 128) tag = 'unspecified'.grey; // not a git repo - else if (code > 0) return this.emit('error', new Error('Git status: ' + code)); + else if (code) return this.emit('error', new Error('Git status: ' + code)); this.emit('describeTag', tag.replace(/\n$/, '')); }.bind(this)); }; @@ -516,10 +516,10 @@ Package.prototype.versions = function () { Package.prototype.fetch = function () { var cp = spawn('git', ['fetch'], { cwd: path.resolve(config.cache, this.name, this.resourceId) }); cp.on('close', function (code) { - if (code > 0) return this.emit('error', new Error('Git status: ' + code)); + if (code) return this.emit('error', new Error('Git status: ' + code)); cp = spawn('git', ['reset', '--hard', 'origin/HEAD'], { cwd: path.resolve(config.cache, this.name, this.resourceId) }); cp.on('close', function (code) { - if (code > 0) return this.emit('error', new Error('Git status: ' + code)); + if (code) return this.emit('error', new Error('Git status: ' + code)); this.emit('fetch'); }.bind(this)); }.bind(this));