From: Tomas Vondra Date: Thu, 11 Aug 2016 00:08:06 +0000 (+0200) Subject: Fix CWD when running 'git pull', fix parameters. X-Git-Url: http://git.postgresql.org/gitweb/static/connections.php?a=commitdiff_plain;h=acb9f222d3a6242b0286b08e92648a1124100d9e;p=pgperffarm.git Fix CWD when running 'git pull', fix parameters. When refreshing a reporitory clone, running 'git pull $dir' does not do the trick - it assumes the CWD is the clone, and imports data from repository at $dir. So we need to set CWD properly and do just 'git pull'. Also, prefix class members with 'self'. --- diff --git a/client/utils/git.py b/client/utils/git.py index dcd74af..11b00c1 100644 --- a/client/utils/git.py +++ b/client/utils/git.py @@ -26,10 +26,10 @@ class GitRepository(object): def _clone(self): '' - log("cloning repository '%s' to '%s'" % (url, path)) + log("cloning repository '%s' to '%s'" % (self._url, self._path)) with TemporaryFile() as strout: - call(['git', 'clone', url, path], stdout=strout, stderr=STDOUT) + call(['git', 'clone', self._url, self._path], stdout=strout, stderr=STDOUT) def _update(self): @@ -40,7 +40,7 @@ class GitRepository(object): # simply call git-pull and redirect stdout/stderr # FIXME should verify that the repository uses the proper upstream url with TemporaryFile() as strout: - call(['git', 'pull', self._path], stdout=strout, stderr=STDOUT) + call(['git', 'pull'], cwd=self._path, stdout=strout, stderr=STDOUT) def current_commit(self):