Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita83eee5

Browse files
committed
test_refs works
1 parentb5a3756 commita83eee5

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

‎git/objects/tag.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
parse_actor_and_date
1111
)
1212
fromgitdb.utilimporthex_to_bin
13+
fromgit.compatimportdefenc
1314

1415
__all__= ("TagObject", )
1516

@@ -52,11 +53,12 @@ def _set_cache_(self, attr):
5253
"""Cache all our attributes at once"""
5354
ifattrinTagObject.__slots__:
5455
ostream=self.repo.odb.stream(self.binsha)
55-
lines=ostream.read().splitlines()
56+
lines=ostream.read().decode(defenc).splitlines()
5657

5758
obj,hexsha=lines[0].split(" ")# object <hexsha>
5859
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))
6062

6163
self.tag=lines[2][4:]# tag <tag name>
6264

‎git/refs/symbolic.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
)
2222
fromgit.compatimport (
2323
string_types,
24+
defenc
2425
)
2526

2627
from .logimportRefLog
@@ -429,6 +430,7 @@ def delete(cls, repo, path):
429430
# in the line
430431
# If we deleted the last line and this one is a tag-reference object,
431432
# we drop it as well
433+
line=line.decode(defenc)
432434
if (line.startswith('#')orfull_ref_pathnotinline)and \
433435
(notdropped_last_lineordropped_last_lineandnotline.startswith('^')):
434436
new_lines.append(line)
@@ -446,7 +448,7 @@ def delete(cls, repo, path):
446448
ifmade_change:
447449
# write-binary is required, otherwise windows will
448450
# 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)forlinnew_lines)
450452
# END write out file
451453
# END open exception handling
452454
# END handle deletion
@@ -478,7 +480,7 @@ def _create(cls, repo, path, resolve, reference, force, logmsg=None):
478480
target_data=target.path
479481
ifnotresolve:
480482
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()
482484
ifexisting_data!=target_data:
483485
raiseOSError("Reference at %r does already exist, pointing to %r, requested was %r"%
484486
(full_ref_path,existing_data,target_data))

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp