diff options
author | Sebastian Thiel <byronimo@gmail.com> | 2015-01-06 11:14:19 +0100 |
---|---|---|
committer | Sebastian Thiel <byronimo@gmail.com> | 2015-01-06 11:14:19 +0100 |
commit | a83eee5bcee64eeb000dd413ab55aa98dcc8c7f2 (patch) | |
tree | d398652edad72594cfda817068be710fad935c08 /git | |
parent | b5a37564b6eec05b98c2efa5edcd1460a2df02aa (diff) | |
download | gitpython-a83eee5bcee64eeb000dd413ab55aa98dcc8c7f2.tar.gz |
test_refs works
Diffstat (limited to 'git')
-rw-r--r-- | git/objects/tag.py | 6 | ||||
-rw-r--r-- | git/refs/symbolic.py | 6 |
2 files changed, 8 insertions, 4 deletions
diff --git a/git/objects/tag.py b/git/objects/tag.py index 5e76e230..c8684447 100644 --- a/git/objects/tag.py +++ b/git/objects/tag.py @@ -10,6 +10,7 @@ from .util import ( parse_actor_and_date ) from gitdb.util import hex_to_bin +from git.compat import defenc __all__ = ("TagObject", ) @@ -52,11 +53,12 @@ class TagObject(base.Object): """Cache all our attributes at once""" if attr in TagObject.__slots__: ostream = self.repo.odb.stream(self.binsha) - lines = ostream.read().splitlines() + lines = ostream.read().decode(defenc).splitlines() obj, hexsha = lines[0].split(" ") # object <hexsha> type_token, type_name = lines[1].split(" ") # type <type_name> - self.object = get_object_type_by_name(type_name)(self.repo, hex_to_bin(hexsha)) + self.object = \ + get_object_type_by_name(type_name.encode('ascii'))(self.repo, hex_to_bin(hexsha)) self.tag = lines[2][4:] # tag <tag name> diff --git a/git/refs/symbolic.py b/git/refs/symbolic.py index 252462a9..45a12385 100644 --- a/git/refs/symbolic.py +++ b/git/refs/symbolic.py @@ -21,6 +21,7 @@ from gitdb.util import ( ) from git.compat import ( string_types, + defenc ) from .log import RefLog @@ -429,6 +430,7 @@ class SymbolicReference(object): # in the line # If we deleted the last line and this one is a tag-reference object, # we drop it as well + line = line.decode(defenc) if (line.startswith('#') or full_ref_path not in line) and \ (not dropped_last_line or dropped_last_line and not line.startswith('^')): new_lines.append(line) @@ -446,7 +448,7 @@ class SymbolicReference(object): if made_change: # write-binary is required, otherwise windows will # open the file in text mode and change LF to CRLF ! - open(pack_file_path, 'wb').writelines(new_lines) + open(pack_file_path, 'wb').writelines(l.encode(defenc) for l in new_lines) # END write out file # END open exception handling # END handle deletion @@ -478,7 +480,7 @@ class SymbolicReference(object): target_data = target.path if not resolve: target_data = "ref: " + target_data - existing_data = open(abs_ref_path, 'rb').read().strip() + existing_data = open(abs_ref_path, 'rb').read().decode(defenc).strip() if existing_data != target_data: raise OSError("Reference at %r does already exist, pointing to %r, requested was %r" % (full_ref_path, existing_data, target_data)) |