var Q      = require('q');
var _      = require('lodash');
var spawn  = require('child_process').spawn;

module.exports = function(args, options) {
  var deferred = Q.defer();

  options = options || {};

  var defaults = {
    cwd:     process.cwd(),
    verbose: false
  };

  options = _.extend({}, defaults, options);

  var child = spawn('git', args, _.omit(options, 'verbose'));

  child.on('exit', function(code) {
    if (code === 128) {
      deferred.reject("git did not exit cleanly");
    } else {
      deferred.resolve(code);
    }
  });

  child.stdout.on('data', function(data) {
    deferred.notify(data.toString());
  });

  child.stderr.on('data', function(data) {
    deferred.reject(data.toString());
  });

  return deferred.promise;
};

@@ -626,32 +626,108 @@
 ring());%0A  %7D);%0A%0A
+  // TODO: Why does this return non-error output?%0A  // i.e. Cloning into...%0A
   child.stderr.o
@@ -766,22 +766,22 @@
 eferred.
-reject
+notify
 (data.to

Fix early cache resolve bug