from git_python.stats import Stats
from git_python.tag import Tag
from git_python.tree import Tree
-from git_python.utils import shell_escape, dashify, touch
+from git_python.utils import dashify, touch
__all__ = [ name for name, obj in locals().items()
if not (name.startswith('_') or inspect.ismodule(obj)) ]
super(Git, self).__init__()
self.git_dir = git_dir
- git_binary = "/usr/bin/env git"
-
@property
def get_dir(self):
return self.git_dir
``command``
The command to execute
"""
- print command
+ print ' '.join(command)
proc = subprocess.Popen(command,
- shell=True,
+ cwd = self.git_dir,
stdout=subprocess.PIPE
)
- stdout_value = proc.communicate()[0]
+ proc.wait()
+ stdout_value = proc.stdout.read()
+ proc.stdout.close()
return stdout_value
def transform_kwargs(self, **kwargs):
if v is True:
args.append("-%s" % k)
else:
- args.append("-%s %r" % (k, v))
+ args.append("-%s" % k)
+ args.append(v)
else:
if v is True:
args.append("--%s" % dashify(k))
else:
- args.append("--%s=%r" % (dashify(k), v))
+ args.append("--%s=%s" % (dashify(k), v))
return args
def method_missing(self, method, *args, **kwargs):
str
"""
opt_args = self.transform_kwargs(**kwargs)
- ext_args = map(lambda a: (a == '--') and a or "%s" % shell_escape(a), args)
+ ext_args = map(lambda a: (a == '--') and a or "%s" % a, args)
args = opt_args + ext_args
- call = "%s --git-dir=%s %s %s" % (self.git_binary, self.git_dir, dashify(method), ' '.join(args))
+ call = ['git-'+dashify(method)]
+ call.extend(args)
stdout_value = self.execute(call)
return stdout_value