Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e328ffd

Browse files
committed
Add test and fixture for diff index from raw format
This tests the edge case of doing a diff against a single whitespace filename and returns the proper change type. All other normal usage of this diff classmethod should remain unchanged.
1 parent 25f27c8 commit e328ffd

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

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
assert dr.diff.endswith(b"+Binary files a/rps and b/rps differ\n")
124124

125+
def test_diff_index_raw_format(self):
126+
output = StringProcessAdapter(fixture('diff_index_raw'))
127+
res = Diff._index_from_raw_format(None, output.stdout)
128+
assert res[0].deleted_file
129+
assert res[0].b_path == ''
130+
125131
def test_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)