lib/git.js
function executeGit( args, options ) {
	options = options || {};
	return new Promise( function( resolve, reject ) {
		var stdo = '';
		var proc = doSpawn( 'git', args, { cwd: options.cwd ? options.cwd : process.cwd(), stdio: [ 'ignore', 'pipe', 'ignore' ] } );

		function unpipe() {
		}

		if ( options.captureStdout ) {
			proc.stdout.on( 'data', function onStdout( data ) {
                       		stdo += data.toString();
                	} );
		}
		proc.on( 'error', function( err ) {
			unpipe();
			if ( options.ignoreError ) {
				resolve( { out: stdo, code: 0 } );
			} else {
				printError( err, args );
				reject( err );
			}
		} );
		proc.on( 'exit', function( code ) {
			unpipe();
		} );
		proc.on( 'close', function( code ) {
			unpipe();
			if ( code !== 0 && !options.ignoreError ) {
				if ( !options.quiet ) {
					printError( '', args );
				}
				reject( new Error( "Error running git" ) );
			} else {
				resolve( { out: stdo, code: code } );
			}
		} );
	} );
}
function executeGit( args, options ) {
	options = options || {};
	return new Promise( function( resolve, reject ) {
		var stdo = '';
		var proc = doSpawn( 'git', args, { cwd: options.cwd ? options.cwd : process.cwd(), stdio: [ 'ignore', 'pipe', 'ignore' ] } );

		function unpipe() {
		}

		if ( options.captureStdout ) {
			proc.stdout.on( 'data', function onStdout( data ) {
                       		stdo += data.toString();
                	} );
		}
		proc.on( 'error', function( err ) {
			unpipe();
			if ( options.ignoreError ) {
				resolve( { out: stdo, code: 0 } );
			} else {
				printError( err, args );
				reject( err );
			}
		} );
		proc.on( 'exit', function( code ) {
			unpipe();
		} );
		proc.on( 'close', function( code ) {
			unpipe();
			if ( code !== 0 && !options.ignoreError ) {
				if ( !options.quiet ) {
					printError( '', args );
				}
				reject( new Error( "Error running git" ) );
			} else {
				resolve( { out: stdo, code: code } );
			}
		} );
	} );
}
function executeGit ( args , options ) { options = options || { } ; return new Promise ( function ( resolve , reject ) { var stdo = '' ; var proc = doSpawn ( 'git' , args , { cwd : options . cwd ? options . cwd : process . cwd ( ) , stdio : [ 'ignore' , 'pipe' , 'ignore' ] } ) ; function unpipe ( ) { } if ( options . captureStdout ) { proc . stdout . on ( 'data' , function onStdout ( data ) { stdo += data . toString ( ) ; } ) ; } proc . on ( 'error' , function ( err ) { unpipe ( ) ; if ( options . ignoreError ) { resolve ( { out : stdo , code : 0 } ) ; } else { printError ( err , args ) ; reject ( err ) ; } } ) ; proc . on ( 'exit' , function ( code ) { unpipe ( ) ; } ) ; proc . on ( 'close' , function ( code ) { unpipe ( ) ; if ( code !== 0 && ! options . ignoreError ) { if ( ! options . quiet ) { printError ( '' , args ) ; } reject ( new Error ( "Error running git" ) ) ; } else { resolve ( { out : stdo , code : code } ) ; } } ) ; } ) ; }
used if the git library doesn't support what we need to do
used if the git library doesn t support what we need to do