src/gitftw.js
function spawnGit(args) {
  //don't bother with throws, they are catched by promises
  gitCmd = gitCmd || which('git');
  assert.ok(args, 'arguments to git is mandatory');

  executionCount++;
  if (executionPromise) {
    executionPromise = executionPromise.then(
        createGitCmdPromise.bind(null, args),
        createGitCmdPromise.bind(null, args)
    );
  } else {
    executionPromise = createGitCmdPromise(args);
  }

  return executionPromise.finally(function() {
    if (--executionCount === 0) {
      executionPromise = null;
    }
  });
}
function spawnGit(args) {
  //don't bother with throws, they are catched by promises
  gitCmd = gitCmd || which('git');
  assert.ok(args, 'arguments to git is mandatory');

  executionCount++;
  if (executionPromise) {
    executionPromise = executionPromise.then(
        createGitCmdPromise.bind(null, args),
        createGitCmdPromise.bind(null, args)
    );
  } else {
    executionPromise = createGitCmdPromise(args);
  }

  return executionPromise.finally(function() {
    if (--executionCount === 0) {
      executionPromise = null;
    }
  });
}
function spawnGit ( args ) { //don't bother with throws, they are catched by promises gitCmd = gitCmd || which ( 'git' ) ; assert . ok ( args , 'arguments to git is mandatory' ) ; executionCount ++ ; if ( executionPromise ) { executionPromise = executionPromise . then ( createGitCmdPromise . bind ( null , args ) , createGitCmdPromise . bind ( null , args ) ) ; } else { executionPromise = createGitCmdPromise ( args ) ; } return executionPromise . finally ( function ( ) { if ( -- executionCount === 0 ) { executionPromise = null ; } } ) ; }
Spawns a git process with the provider arguments
This function is called when you call directly the require of `gitftw`

If you provide a second parameter

DISCLAIMER: I've not found any way to document this in jsdoc and this
template in a proper way. Sorry for the possible missunderstanding

@example
var git = require('gitftw');

//executes a `git version`
git(['version'], function(err, data) { console.log(data);});
//or
git(['version']).then(console.log);

@fires command the git command executed
@fires result the result from the command line

@param {Resolvable|Array<String|null>} args The arguments to pass to git command
@param {callback} [cb] The execution callback result
@returns {Promise} Promise Resolves with the git output
Rejects with an invalid/not found git cmd
Rejects with an error with the git cmd spawn
Rejects with git exits with an error
Spawns a git process with the provider arguments This function is called when you call directly the require of gitftw