@@ -12,8 +12,6 @@ def __init__(self, git_dir):
1212 super (Git , self ).__init__ ()
1313 self .git_dir = git_dir
1414
15- git_binary = "/usr/bin/env git"
16-
1715 @property
1816 def get_dir (self ):
1917 return self .git_dir
@@ -26,12 +24,14 @@ def execute(self, command):
2624 ``command``
2725 The command to execute
2826 """
29- print command
27+ print ' ' . join ( command )
3028 proc = subprocess .Popen (command ,
31- shell = True ,
29+ cwd = self . git_dir ,
3230 stdout = subprocess .PIPE
3331 )
34- stdout_value = proc .communicate ()[0 ]
32+ proc .wait ()
33+ stdout_value = proc .stdout .read ()
34+ proc .stdout .close ()
3535 return stdout_value
3636
3737 def transform_kwargs (self , ** kwargs ):
@@ -44,12 +44,13 @@ def transform_kwargs(self, **kwargs):
4444 if v is True :
4545 args .append ("-%s" % k )
4646 else :
47- args .append ("-%s %r" % (k , v ))
47+ args .append ("-%s" % k )
48+ args .append (v )
4849 else :
4950 if v is True :
5051 args .append ("--%s" % dashify (k ))
5152 else :
52- args .append ("--%s=%r " % (dashify (k ), v ))
53+ args .append ("--%s=%s " % (dashify (k ), v ))
5354 return args
5455
5556 def method_missing (self , method , * args , ** kwargs ):
@@ -73,9 +74,10 @@ def method_missing(self, method, *args, **kwargs):
7374 str
7475 """
7576 opt_args = self .transform_kwargs (** kwargs )
76- ext_args = map (lambda a : (a == '--' ) and a or "%s" % shell_escape ( a ) , args )
77+ ext_args = map (lambda a : (a == '--' ) and a or "%s" % a , args )
7778 args = opt_args + ext_args
7879
79- call = "%s --git-dir=%s %s %s" % (self .git_binary , self .git_dir , dashify (method ), ' ' .join (args ))
80+ call = ['git-' + dashify (method )]
81+ call .extend (args )
8082 stdout_value = self .execute (call )
8183 return stdout_value
0 commit comments