var chp = require('child_process');

var Git = {
	stageFile: function(modulePath, file, callback) {
		if (file.status === 'deleted') {
			this._exec(modulePath, 'rm', [file.name], callback);
		} else {
			if (file.type === 'submodule') this.exec(modulePath, 'submodule add', [file.name], callback);
			else this._exec(modulePath, 'add', [file.name], callback);
		}
	},
	
	unstageFile: function(modulePath, file, callback) {
		this._exec(modulePath, 'reset HEAD', [file.name], callback);
	},
	
	commit: function(modulePath, message, callback) {
		this._exec(modulePath, 'commit -m', [message], callback);
	},
	
	push: function(modulePath, callback) {
		this._exec(modulePath, 'push', [], callback);
	},
	
	_exec: function(modulePath, cmd, args, callback) {
		var escapedArgs = args.map(function(arg) {
			return '"' + arg.replace(/["\\]/g, '\\$1') + '"';
		}).join(' ');
		cmd = 'git ' + cmd + ' ' + escapedArgs;
		chp.exec(cmd, {cwd: modulePath}, function(err, stdout, stderr) {
			if (err) console.error(err, stdout, stderr);
			callback(null, stdout);
		});
	}
};

module.exports = Git;

var chp = require('child_process');

var Git = {
	stageFile: function(modulePath, file, callback) {
		if (file.status === 'deleted') {
			this._exec(modulePath, 'rm', [file.name], callback);
		} else {
			if (file.type === 'submodule') this._exec(modulePath, 'submodule add', ['.' + require('path').sep +  file.name], callback);
			else this._exec(modulePath, 'add', [file.name], callback);
		}
	},
	
	unstageFile: function(modulePath, file, callback) {
		this._exec(modulePath, 'reset HEAD', [file.name], callback);
	},
	
	commit: function(modulePath, message, callback) {
		this._exec(modulePath, 'commit -m', [message], callback);
	},
	
	push: function(modulePath, callback) {
		this._exec(modulePath, 'push', [], callback);
	},
	
	_exec: function(modulePath, cmd, args, callback) {
		var escapedArgs = args.map(function(arg) {
			return '"' + arg.replace(/["\\]/g, '\\$1') + '"';
		}).join(' ');
		cmd = 'git ' + cmd + ' ' + escapedArgs;
		chp.exec(cmd, {cwd: modulePath}, function(err, stdout, stderr) {
			if (err) console.error(err, stdout, stderr);
			callback(null, stdout);
		});
	}
};

module.exports = Git;

Fix typo and file path
Fix typo and file path
