commit: 8c4e4facd64d48653d348749982615d78a2fbb77 Author: Michał Górny <mgorny <AT> gentoo <DOT> org> AuthorDate: Sat Jan 17 12:24:11 2015 +0000 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> CommitDate: Sun Jan 18 18:04:25 2015 +0000 URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=8c4e4fac
git sync: replace 'git rev-parse' with safer '.git' check The 'git rev-parse' could succeed if one of the parent directories contained a git repository, and it also had unwanted error output. Instead, just check whether the '.git' directory exists. --- pym/portage/sync/modules/git/git.py | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/pym/portage/sync/modules/git/git.py b/pym/portage/sync/modules/git/git.py index d4f2cc1..c5c569e 100644 --- a/pym/portage/sync/modules/git/git.py +++ b/pym/portage/sync/modules/git/git.py @@ -29,19 +29,7 @@ class GitSync(SyncBase): def exists(self, **kwargs): '''Tests whether the repo actually exists''' - if kwargs: - self._kwargs(kwargs) - elif not self.repo: - return False - - if not os.path.exists(self.repo.location): - return False - exitcode = portage.process.spawn_bash("cd %s ; git rev-parse" %\ - (portage._shell_quote(self.repo.location),), - **portage._native_kwargs(self.spawn_kwargs)) - if exitcode == 128: - return False - return True + return os.path.exists(os.path.join(self.repo.location, '.git')) def new(self, **kwargs):