@@ 60,11 60,13 @@ class DeadSimpleSite(object):
os.rmdir(root)
def _git(self, *args):
+ if not path.exists(self.target):
+ os.makedirs(self.target)
with open(os.devnull, 'w') as devnull:
if args[0] == 'push':
# Git reads username and password from console, so don't suppress output
# Also, don't want to throw an error since most likely the user just mistyped
- subprocess.call(('git',) + args)
+ subprocess.call(('git',) + args, cwd=self.target)
else:
return subprocess.check_output(('git',) + args, stderr=subprocess.STDOUT, cwd=self.target)
@@ 189,8 191,6 @@ class DeadSimpleSite(object):
self._git('--version')
except subprocess.CalledProcessError as e:
raise GitError('No git command found. Is git installed and on the path?')
- if not path.exists(self.target):
- os.makedirs(self.target)
self._clean()
try:
gitdir = self._git('rev-parse', '--git-dir')