| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -574,6 +574,9 @@ def _handle_diff_line(lines_bytes: bytes, repo: "Repo", index: DiffIndex) -> Non | |||
| 574 | 574 | _, _, lines = lines.partition(":") | |
| 575 | 575 | ||
| 576 | 576 | for line in lines.split("\x00:"): | |
| 577 | + if not line: | ||
| 578 | + # The line data is empty, skip | ||
| 579 | + continue | ||
| 577 | 580 | meta, _, path = line.partition("\x00") | |
| 578 | 581 | path = path.rstrip("\x00") | |
| 579 | 582 | a_blob_id: Optional[str] | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -240,6 +240,12 @@ def test_diff_file_with_colon(self): | |||
| 240 | 240 | output = fixture("diff_file_with_colon") | |
| 241 | 241 | res = [] | |
| 242 | 242 | Diff._handle_diff_line(output, None, res) | |
| 243 | + self.assertEqual(len(res), 3) | ||
| 244 | + | ||
| 245 | + def test_empty_diff(self): | ||
| 246 | + res = [] | ||
| 247 | + Diff._handle_diff_line(b"", None, res) | ||
| 248 | + self.assertEqual(res, []) | ||
| 243 | 249 | ||
| 244 | 250 | def test_diff_initial_commit(self): | |
| 245 | 251 | initial_commit = self.rorepo.commit("33ebe7acec14b25c5f84f35a664803fcab2f7781") | |
| Back | FazBrowse Home | New Git URL |
0 commit comments