def run(self, paths = []):
		for item in SideBarSelection(paths).getSelectedItems():
			object = Object()
			object.item = item
			object.command = ['git', 'status', '--untracked-files=all', '--ignored', '--', item.forCwdSystemName()]
			object.title = 'Status: '+item.name()
			object.syntax_file = 'Packages/Git/Git Graph.tmLanguage'
			SideBarGit().run(object)
	def run(self, paths = []):
		for item in SideBarSelection(paths).getSelectedItems():
			object = Object()
			object.item = item
			object.command = ['git', 'reflog', '--no-color', '--', item.forCwdSystemName()]
			object.title = 'Reflog: '+item.name()
			object.syntax_file = 'Packages/Git/Git Graph.tmLanguage'
			SideBarGit().run(object)
	def run(self, paths = []):
		for item in SideBarSelection(paths).getSelectedItems():
			object = Object()
			object.item = item
			object.command = ['git', 'blame', '--no-color', '--', item.forCwdSystemName()]
			object.title = 'Blame: '+item.name()
			object.syntax_file = 'Packages/Git/Git Blame.tmLanguage'
			object.word_wrap = False
			SideBarGit().run(object)
	def run(self, paths = []):
		for item in SideBarSelection(paths).getSelectedItems():
			object = Object()
			object.item = item
			object.command = ['git', 'log', '--stat', '--graph', '--decorate', '--no-color', '--', item.forCwdSystemName()]
			object.title = 'Log: '+item.name()
			object.no_results = 'No log to show'
			object.syntax_file = 'Packages/Git/Git Graph.tmLanguage'
			SideBarGit().run(object)
	def run(self, paths = []):
		for item in SideBarSelection(paths).getSelectedItems():
			object = Object()
			object.item = item
			object.command = ['git', 'diff', '--no-color', 'origin/master..', '--', item.forCwdSystemName()]
			object.title = 'Diff: '+item.name()+'.diff'
			object.no_results = 'No differences to show'
			object.syntax_file = 'Packages/Diff/Diff.tmLanguage'
			object.word_wrap = False
			SideBarGit().run(object)
	def run(self, paths = []):
		import sys
		for item in SideBarSelection(paths).getSelectedItems():
			object = Object()
			object.item = item
			object.command = ['git', 'log', '-n', '50', '--pretty=format:%h %s'.encode(sys.getfilesystemencoding()), '--no-color', '--', item.forCwdSystemName()]
			object.title = 'Log: '+item.name()
			object.no_results = 'No log to show'
			object.syntax_file = 'Packages/Git/Git Graph.tmLanguage'
			SideBarGit().run(object)
	def run(self, paths = [], input = False, content = ''):
		if input == False:
			SideBarGit().prompt('[SideBarGit@SublimeText ./]:', 'git ', self.run, paths)
		elif content != '':
			import sys
			for item in SideBarSelection(paths).getSelectedDirectoriesOrDirnames():
				object = Object()
				object.item = item
				object.command = content.encode(sys.getfilesystemencoding()).split(' ')
				object.title = content
				object.no_results = 'No output'
				object.syntax_file = 'Packages/Diff/Diff.tmLanguage'
				SideBarGit().run(object)
	def run(
					self,
					object,
					modal = False,
					background = False,
					
					refresh_funct_view = False,
					refresh_funct_command = False,
					refresh_funct_item = False,
					refresh_funct_to_status_bar = False,
					refresh_funct_title = False,
					refresh_funct_no_results = False,
					refresh_funct_syntax_file = False
					):

		if not refresh_funct_view:
			pass
		else:
			object = Object()
			object.command = refresh_funct_command
			object.item = SideBarItem(refresh_funct_item, os.path.isdir(refresh_funct_item))
			object.to_status_bar = refresh_funct_to_status_bar
			object.title = refresh_funct_title
			object.no_results = refresh_funct_no_results
			object.syntax_file = refresh_funct_syntax_file

		debug = False
		if debug:
			print '----------------------------------------------------------'
			print 'GIT:'
			print object.command
			print 'CWD:'
			print object.item.forCwdSystemPath()
			print 'PATH:'
			print object.item.forCwdSystemName()

		failed = False

		import sys
		if sys.platform == 'win32':
			object.command = map(self.escapeCMDWindows, object.command)

		cwd = object.item.forCwdSystemPath()

		try:
			if not modal :
				process = subprocess.Popen(
																	object.command,
																	cwd=cwd,
																	stdout=subprocess.PIPE,
																	stderr=subprocess.STDOUT,
																	shell= sys.platform == 'win32',
																	universal_newlines=True)
			else:
				if sys.platform == 'win32':
					process = subprocess.Popen(
																		#" ".join(object.command),
																		object.command,
																		cwd=cwd,
																		stdout=subprocess.PIPE,
																		stderr=subprocess.STDOUT,
																		shell=True,
																		universal_newlines=True)
				else:
					process = subprocess.Popen(
																		object.command,
																		cwd=cwd,
																		stdout=subprocess.PIPE,
																		stderr=subprocess.STDOUT,
																		shell=False,
																		universal_newlines=True)

			if background:
				if debug:
					print 'SUCCESS'
					print '----------------------------------------------------------'
				return True

			stdout, stderr = process.communicate()
			SideBarGit.last_stdout = str(stdout).rstrip()
			self.last_stdout = str(stdout).rstrip()

			stdout = stdout.strip()

			if stdout.find('fatal:') == 0 or stdout.find('error:') == 0 or stdout.find('Permission denied') == 0 or stderr:
				print 'FAILED'
				failed = True
			else:
				if debug:
					print 'SUCCESS'
			if stdout:
				if debug:
					print 'STDOUT'
					print stdout
			if stderr:
				print 'STDERR'
				print stderr
		except OSError as (errno, strerror):
			print 'FAILED'
			failed = True
			print errno
			print strerror
			SideBarGit.last_stdout = ''
			self.last_stdout = ''