summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/git/remote.py5
-rw-r--r--test/testlib/helper.py12
2 files changed, 14 insertions, 3 deletions
diff --git a/lib/git/remote.py b/lib/git/remote.py
index 9141fc3b..b1c90bd5 100644
--- a/lib/git/remote.py
+++ b/lib/git/remote.py
@@ -607,8 +607,11 @@ class Remote(LazyMixin, Iterable):
# END for each line
try:
proc.wait()
- except GitCommandError:
+ except GitCommandError,e:
# if a push has rejected items, the command has non-zero return status
+ # a return status of 128 indicates a connection error - reraise the previous one
+ if proc.poll() == 128:
+ raise
pass
# END exception handling
return output
diff --git a/test/testlib/helper.py b/test/testlib/helper.py
index 4ab7207d..27c2b3d9 100644
--- a/test/testlib/helper.py
+++ b/test/testlib/helper.py
@@ -5,7 +5,7 @@
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
import os
-from git import Repo, Remote
+from git import Repo, Remote, GitCommandError
from unittest import TestCase
import tempfile
import shutil
@@ -166,7 +166,15 @@ def with_rw_and_rw_remote_repo(working_tree_ref):
# by the user, not by us
d_remote = Remote.create(rw_repo, "daemon_origin", remote_repo_dir)
d_remote.fetch()
- d_remote.config_writer.set('url', "git://localhost%s" % remote_repo_dir)
+ remote_repo_url = "git://localhost%s" % remote_repo_dir
+ d_remote.config_writer.set('url', remote_repo_url)
+
+ # try to list remotes to diagnoes whether the server is up
+ try:
+ rw_repo.git.ls_remote(d_remote)
+ except GitCommandError,e:
+ print str(e)
+ raise AssertionError('Please start a git-daemon to run this test, execute: git-daemon "%s"'%tempfile.gettempdir())
try:
return func(self, rw_repo, rw_remote_repo)