| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -75,7 +75,6 @@ def _expand_path(p): | |||
| 75 | 75 | ||
| 76 | 76 | ||
| 77 | 77 | class Repo(object): | |
| 78 | - | ||
| 79 | 78 | """Represents a git repository and allows you to query references, | |
| 80 | 79 | gather commit information, generate diffs, create and clone repositories query | |
| 81 | 80 | the log. | |
@@ -758,7 +757,7 @@ def init(cls, path=None, mkdir=True, **kwargs): | |||
| 758 | 757 | # git command automatically chdir into the directory | |
| 759 | 758 | git = Git(path) | |
| 760 | 759 | git.init(**kwargs) | |
| 761 | - return Repo(path) | ||
| 760 | + return cls(path) | ||
| 762 | 761 | ||
| 763 | 762 | @classmethod | |
| 764 | 763 | def _clone(cls, git, url, path, odb_default_type, progress, **kwargs): | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -440,7 +440,7 @@ def test_references_and_objects(self, rw_dir): | |||
| 440 | 440 | # [32-test_references_and_objects] | |
| 441 | 441 | private_key_file = os.path.join(rw_dir, 'id_rsa_deployment_key') | |
| 442 | 442 | with repo.git.sshkey(private_key_file): | |
| 443 | - # Note that we don't actually make the call here, as our test-setup doesn't permit it to | ||
| 443 | + # Note that we don't actually make the call here, as our test-setup doesn't permit it to | ||
| 444 | 444 | # succeed. | |
| 445 | 445 | # It will in your case :) | |
| 446 | 446 | repo.remotes.origin.fetch | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -181,11 +181,26 @@ def test_environment(self, rw_dir): | |||
| 181 | 181 | assert new_env == {'VARKEY': 'VARVALUE'} | |
| 182 | 182 | assert self.git.environment() == {} | |
| 183 | 183 | ||
| 184 | - rw_repo = Repo.init(os.path.join(rw_dir, 'repo')) | ||
| 184 | + class TestRepo(Repo): | ||
| 185 | + class GitCommandWrapperType(Git): | ||
| 186 | + def _sshkey_script_path(self): | ||
| 187 | + path = os.path.join(rw_dir, 'failing-script.sh') | ||
| 188 | + stream = open(path, 'wt') | ||
| 189 | + stream.write("#!/usr/bin/env sh\n" + | ||
| 190 | + "echo FOO\n") | ||
| 191 | + stream.close() | ||
| 192 | + os.chmod(path, 0o555) | ||
| 193 | + return path | ||
| 194 | + # end Git | ||
| 195 | + # end Repo | ||
| 196 | + | ||
| 197 | + rw_repo = TestRepo.init(os.path.join(rw_dir, 'repo')) | ||
| 185 | 198 | remote = rw_repo.create_remote('ssh-origin', "ssh://git@server/foo") | |
| 186 | 199 | ||
| 187 | 200 | with rw_repo.git.sshkey('doesntexist.key'): | |
| 188 | - remote.fetch() | ||
| 201 | + try: | ||
| 202 | + remote.fetch() | ||
| 203 | + except GitCommandError as err: | ||
| 204 | + assert 'FOO' in str(err) | ||
| 205 | + # end | ||
| 189 | 206 | # end | |
| 190 | - | ||
| 191 | - | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments