commit: 1327daa7c32ee093b58b52bfa66c3ffdcaf1e1c6 Author: Zac Medico <zmedico <AT> gentoo <DOT> org> AuthorDate: Sat Mar 17 21:23:52 2018 +0000 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> CommitDate: Wed Mar 21 18:25:54 2018 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=1327daa7
GitSync: abort early for missing git command (bug 650754) Bug: https://bugs.gentoo.org/650754 pym/portage/sync/modules/git/git.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pym/portage/sync/modules/git/git.py b/pym/portage/sync/modules/git/git.py index cec760d00..160137a6d 100644 --- a/pym/portage/sync/modules/git/git.py +++ b/pym/portage/sync/modules/git/git.py @@ -44,6 +44,8 @@ class GitSync(NewBase): '''Do the initial clone of the repository''' if kwargs: self._kwargs(kwargs) + if not self.has_bin: + return (1, False) try: if not os.path.exists(self.repo.location): os.makedirs(self.repo.location) @@ -104,7 +106,8 @@ class GitSync(NewBase): that he/she wants updated. We'll let the user manage branches with git directly. ''' - + if not self.has_bin: + return (1, False) git_cmd_opts = "" if self.repo.module_specific_options.get('sync-git-env'): shlexed_env = shlex_split(self.repo.module_specific_options['sync-git-env']) @@ -218,6 +221,9 @@ class GitSync(NewBase): '''Get information about the head commit''' if kwargs: self._kwargs(kwargs) + if self.bin_command is None: + # return quietly so that we don't pollute emerge --info output + return (1, False) rev_cmd = [self.bin_command, "rev-list", "--max-count=1", "HEAD"] try: ret = (os.EX_OK,
