Skip to content

Commit 169c847

Browse files
committed
rebase
1 parent e7fc8c5 commit 169c847

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

git/diff.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -474,12 +474,13 @@ def handle_diff_line(line):
474474
return
475475

476476
meta, _, path = line[1:].partition('\t')
477-
old_mode, new_mode, a_blob_id, b_blob_id, change_type = meta.split(None, 4)
477+
old_mode, new_mode, a_blob_id, b_blob_id, _change_type = meta.split(None, 4)
478478
# Change type can be R100
479479
# R: status letter
480480
# 100: score (in case of copy and rename)
481-
change_type = change_type[0]
482-
score = ''.join(change_type[1:]) or None
481+
change_type = _change_type[0]
482+
score_str = ''.join(_change_type[1:])
483+
score = int(score_str) if score_str.isdigit() else None
483484
path = path.strip()
484485
a_path = path.encode(defenc)
485486
b_path = path.encode(defenc)

git/test/test_diff.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ def test_diff_with_rename(self):
109109
self.assertEqual(diff.rename_from, 'this')
110110
self.assertEqual(diff.rename_to, 'that')
111111
self.assertEqual(diff.change_type, 'R')
112+
self.assertEqual(diff.score, 100)
112113
self.assertEqual(len(list(diffs.iter_change_type('R'))), 1)
113114

114115
def test_diff_with_change_in_type(self):

0 commit comments

Comments
 (0)