| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -10,6 +10,7 @@ | |||
| 10 | 10 | parse_actor_and_date | |
| 11 | 11 | ) | |
| 12 | 12 | from gitdb.util import hex_to_bin | |
| 13 | + from git.compat import defenc | ||
| 13 | 14 | ||
| 14 | 15 | __all__ = ("TagObject", ) | |
| 15 | 16 | ||
@@ -52,11 +53,12 @@ def _set_cache_(self, attr): | |||
| 52 | 53 | """Cache all our attributes at once""" | |
| 53 | 54 | if attr in TagObject.__slots__: | |
| 54 | 55 | ostream = self.repo.odb.stream(self.binsha) | |
| 55 | - lines = ostream.read().splitlines() | ||
| 56 | + lines = ostream.read().decode(defenc).splitlines() | ||
| 56 | 57 | ||
| 57 | 58 | obj, hexsha = lines[0].split(" ") # object <hexsha> | |
| 58 | 59 | type_token, type_name = lines[1].split(" ") # type <type_name> | |
| 59 | - self.object = get_object_type_by_name(type_name)(self.repo, hex_to_bin(hexsha)) | ||
| 60 | + self.object = \ | ||
| 61 | + get_object_type_by_name(type_name.encode('ascii'))(self.repo, hex_to_bin(hexsha)) | ||
| 60 | 62 | ||
| 61 | 63 | self.tag = lines[2][4:] # tag <tag name> | |
| 62 | 64 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -21,6 +21,7 @@ | |||
| 21 | 21 | ) | |
| 22 | 22 | from git.compat import ( | |
| 23 | 23 | string_types, | |
| 24 | + defenc | ||
| 24 | 25 | ) | |
| 25 | 26 | ||
| 26 | 27 | from .log import RefLog | |
@@ -429,6 +430,7 @@ def delete(cls, repo, path): | |||
| 429 | 430 | # in the line | |
| 430 | 431 | # If we deleted the last line and this one is a tag-reference object, | |
| 431 | 432 | # we drop it as well | |
| 433 | + line = line.decode(defenc) | ||
| 432 | 434 | if (line.startswith('#') or full_ref_path not in line) and \ | |
| 433 | 435 | (not dropped_last_line or dropped_last_line and not line.startswith('^')): | |
| 434 | 436 | new_lines.append(line) | |
@@ -446,7 +448,7 @@ def delete(cls, repo, path): | |||
| 446 | 448 | if made_change: | |
| 447 | 449 | # write-binary is required, otherwise windows will | |
| 448 | 450 | # open the file in text mode and change LF to CRLF ! | |
| 449 | - open(pack_file_path, 'wb').writelines(new_lines) | ||
| 451 | + open(pack_file_path, 'wb').writelines(l.encode(defenc) for l in new_lines) | ||
| 450 | 452 | # END write out file | |
| 451 | 453 | # END open exception handling | |
| 452 | 454 | # END handle deletion | |
@@ -478,7 +480,7 @@ def _create(cls, repo, path, resolve, reference, force, logmsg=None): | |||
| 478 | 480 | target_data = target.path | |
| 479 | 481 | if not resolve: | |
| 480 | 482 | target_data = "ref: " + target_data | |
| 481 | - existing_data = open(abs_ref_path, 'rb').read().strip() | ||
| 483 | + existing_data = open(abs_ref_path, 'rb').read().decode(defenc).strip() | ||
| 482 | 484 | if existing_data != target_data: | |
| 483 | 485 | raise OSError("Reference at %r does already exist, pointing to %r, requested was %r" % | |
| 484 | 486 | (full_ref_path, existing_data, target_data)) | |
| Back | FazBrowse Home | New Git URL |
0 commit comments