summaryrefslogtreecommitdiff
path: root/git
diff options
context:
space:
mode:
Diffstat (limited to 'git')
-rw-r--r--git/repo/base.py3
-rw-r--r--git/test/test_docs.py2
-rw-r--r--git/test/test_git.py23
3 files changed, 21 insertions, 7 deletions
diff --git a/git/repo/base.py b/git/repo/base.py
index 61352a9a..b7a9e29d 100644
--- a/git/repo/base.py
+++ b/git/repo/base.py
@@ -75,7 +75,6 @@ def _expand_path(p):
class Repo(object):
-
"""Represents a git repository and allows you to query references,
gather commit information, generate diffs, create and clone repositories query
the log.
@@ -758,7 +757,7 @@ class Repo(object):
# git command automatically chdir into the directory
git = Git(path)
git.init(**kwargs)
- return Repo(path)
+ return cls(path)
@classmethod
def _clone(cls, git, url, path, odb_default_type, progress, **kwargs):
diff --git a/git/test/test_docs.py b/git/test/test_docs.py
index 965d10fb..175e728a 100644
--- a/git/test/test_docs.py
+++ b/git/test/test_docs.py
@@ -440,7 +440,7 @@ class Tutorials(TestBase):
# [32-test_references_and_objects]
private_key_file = os.path.join(rw_dir, 'id_rsa_deployment_key')
with repo.git.sshkey(private_key_file):
- # Note that we don't actually make the call here, as our test-setup doesn't permit it to
+ # Note that we don't actually make the call here, as our test-setup doesn't permit it to
# succeed.
# It will in your case :)
repo.remotes.origin.fetch
diff --git a/git/test/test_git.py b/git/test/test_git.py
index 990f4cd0..18acd77e 100644
--- a/git/test/test_git.py
+++ b/git/test/test_git.py
@@ -181,11 +181,26 @@ class TestGit(TestBase):
assert new_env == {'VARKEY': 'VARVALUE'}
assert self.git.environment() == {}
- rw_repo = Repo.init(os.path.join(rw_dir, 'repo'))
+ class TestRepo(Repo):
+ class GitCommandWrapperType(Git):
+ def _sshkey_script_path(self):
+ path = os.path.join(rw_dir, 'failing-script.sh')
+ stream = open(path, 'wt')
+ stream.write("#!/usr/bin/env sh\n" +
+ "echo FOO\n")
+ stream.close()
+ os.chmod(path, 0o555)
+ return path
+ # end Git
+ # end Repo
+
+ rw_repo = TestRepo.init(os.path.join(rw_dir, 'repo'))
remote = rw_repo.create_remote('ssh-origin', "ssh://git@server/foo")
with rw_repo.git.sshkey('doesntexist.key'):
- remote.fetch()
+ try:
+ remote.fetch()
+ except GitCommandError as err:
+ assert 'FOO' in str(err)
+ # end
# end
-
-