summaryrefslogtreecommitdiff
path: root/git/objects/fun.py
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2014-11-15 16:19:24 +0100
committerSebastian Thiel <byronimo@gmail.com>2014-11-15 16:21:37 +0100
commitff13922f6cfb11128b7651ddfcbbd5cad67e477f (patch)
tree9d999b14a7817b1ceeb23ddd1cded446ace9255c /git/objects/fun.py
parent9c39afa1f85f3293ad2ccef684ff62bf0a36e73c (diff)
parentf7ed51ba4c8416888f5744ddb84726316c461051 (diff)
downloadgitpython-ff13922f6cfb11128b7651ddfcbbd5cad67e477f.tar.gz
Merge branch 'sf-master' of https://github.com/johnsca/GitPython into johnsca-sf-master
Conflicts: git/cmd.py git/objects/commit.py git/objects/fun.py git/objects/util.py git/remote.py git/repo/base.py git/test/lib/helper.py git/test/test_commit.py git/test/test_fun.py git/util.py
Diffstat (limited to 'git/objects/fun.py')
-rw-r--r--git/objects/fun.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/git/objects/fun.py b/git/objects/fun.py
index f73be542..66b7998e 100644
--- a/git/objects/fun.py
+++ b/git/objects/fun.py
@@ -70,9 +70,13 @@ def tree_entries_from_data(data):
# default encoding for strings in git is utf8
# Only use the respective unicode object if the byte stream was encoded
name = data[ns:i]
- name_enc = name.decode("utf-8")
- if len(name) > len(name_enc):
- name = name_enc
+ try:
+ name_enc = name.decode("utf-8")
+ except UnicodeDecodeError:
+ pass
+ else:
+ if len(name) > len(name_enc):
+ name = name_enc
# END handle encoding
# byte is NULL, get next 20
@@ -84,6 +88,7 @@ def tree_entries_from_data(data):
return out
+
def _find_by_name(tree_data, name, is_dir, start_at):
"""return data entry matching the given name and tree mode
or None.