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

Commitc877794

Browse files
committed
Merge pull request#398 from gitprime/master
Split diff line by '\t' for metadata and path
2 parentsb297148 +e328ffd commitc877794

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

‎git/diff.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,8 @@ def _index_from_raw_format(cls, repo, stream):
365365
ifnotline.startswith(":"):
366366
continue
367367
# END its not a valid diff line
368-
old_mode,new_mode,a_blob_id,b_blob_id,change_type,path=line[1:].split(None,5)
368+
meta,_,path=line[1:].partition('\t')
369+
old_mode,new_mode,a_blob_id,b_blob_id,change_type=meta.split(None,4)
369370
path=path.strip()
370371
a_path=path
371372
b_path=path

‎git/test/fixtures/diff_index_raw

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
:100644 000000 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0000000000000000000000000000000000000000 D

‎git/test/test_diff.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,12 @@ def test_diff_index(self):
122122
dr=res[3]
123123
assertdr.diff.endswith(b"+Binary files a/rps and b/rps differ\n")
124124

125+
deftest_diff_index_raw_format(self):
126+
output=StringProcessAdapter(fixture('diff_index_raw'))
127+
res=Diff._index_from_raw_format(None,output.stdout)
128+
assertres[0].deleted_file
129+
assertres[0].b_path==''
130+
125131
deftest_diff_patch_format(self):
126132
# test all of the 'old' format diffs for completness - it should at least
127133
# be able to deal with it

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp