Thread (54 messages) read the whole thread 54 messages, 5 authors, 2019-12-07
STALE2429d

[PATCH v2 2/3] FIX: cast as unicode fails when a value is already unicode

From: Ben Keene via GitGitGadget <hidden>
Date: 2019-11-15 14:39:23
Subsystem: the rest · Maintainer: Linus Torvalds

From: Ben Keene <redacted>

Signed-off-by: Ben Keene <redacted>
---
 git-p4.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/git-p4.py b/git-p4.py
index 6e8b3a26cd..b088095b15 100755
--- a/git-p4.py
+++ b/git-p4.py
@@ -39,6 +39,8 @@
     isunicode = True
     def ustring(text):
         """Returns the byte string as a unicode string"""
+        if isinstance(text, unicode):
+            return text
         if text == '' or text == b'':
             return ''
         return unicode(text, "utf-8")
@@ -813,7 +815,7 @@ def gitConfig(key, typeSpecifier=None):
         cmd += [ key ]
         s = read_pipe(cmd, ignore_error=True)
         _gitConfig[key] = s.strip()
-    return ustring(_gitConfig[key])
+    return _gitConfig[key]
 
 def gitConfigBool(key):
     """Return a bool, using git config --bool.  It is True only if the
-- 
gitgitgadget
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help