From: Yaroslav Halchenko <debian@onerussian.com>
Subject: Pass exc value to be re-raised 

Origin: https://github.com/gitpython-developers/GitPython/pull/598
        https://github.com/gitpython-developers/GitPython/pull/603
Bug-Debian: http://bugs.debian.org/
Bug-Ubuntu: https://launchpad.net/bugs/
Applied-Upstream: https://github.com/gitpython-developers/GitPython/commit/9ce2a4b235d2ebc38c3e081c1036e39bde9be036
Last-Update: 2017-03-08

diff --git a/git/compat.py b/git/compat.py
index a2403d6..b804585 100644
--- a/git/compat.py
+++ b/git/compat.py
@@ -177,7 +177,7 @@ def surrogateescape_handler(exc):
             # exception anyway after this function is called, even though I think
             # it's doing what it should. It seems that the strict encoder is called
             # to encode the unicode string that this function returns ...
-            decoded = replace_surrogate_encode(mystring)
+            decoded = replace_surrogate_encode(mystring, exc)
         else:
             raise exc
     except NotASurrogateError:
@@ -189,7 +189,7 @@ class NotASurrogateError(Exception):
     pass
 
 
-def replace_surrogate_encode(mystring):
+def replace_surrogate_encode(mystring, exc):
     """
     Returns a (unicode) string, not the more logical bytes, because the codecs
     register_error functionality expects this.
