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

Commit01f0988

Browse files
NHanserByron
authored andcommitted
Use NUL character to extract meta and path from git diff
Use NUL character instead of semicolon to extract meta and path. Avoid errors in during git diff when dealing with filenames containing semicolons
1 parentda7b5b2 commit01f0988

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

‎git/diff.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -509,9 +509,9 @@ def _index_from_patch_format(cls, repo: 'Repo', proc: Union['Popen', 'Git.AutoIn
509509
def_handle_diff_line(lines_bytes:bytes,repo:'Repo',index:DiffIndex)->None:
510510
lines=lines_bytes.decode(defenc)
511511

512-
forlineinlines.split(':')[1:]:
513-
meta,_,path=line.partition('\x00')
514-
path=path.rstrip('\x00')
512+
it=iter(lines.split('\x00'))
513+
formeta,pathinzip(it,it):
514+
meta=meta[1:]
515515
a_blob_id:Optional[str]
516516
b_blob_id:Optional[str]
517517
old_mode,new_mode,a_blob_id,b_blob_id,_change_type=meta.split(None,4)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp