| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 6074f47 commit 5d6c86a
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -155,7 +155,6 @@ def diff( | |||
| 155 | 155 | ||
| 156 | 156 | if create_patch: | |
| 157 | 157 | args.append("-p") | |
| 158 | - # we expect the default diff driver | ||
| 159 | 158 | args.append("--no-ext-diff") | |
| 160 | 159 | else: | |
| 161 | 160 | args.append("--raw") | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -473,3 +473,45 @@ def test_rename_override(self, rw_dir): | |||
| 473 | 473 | self.assertEqual(True, diff.renamed_file) | |
| 474 | 474 | self.assertEqual("file_a.txt", diff.rename_from) | |
| 475 | 475 | self.assertEqual("file_b.txt", diff.rename_to) | |
| 476 | + | ||
| 477 | + @with_rw_directory | ||
| 478 | + def test_diff_patch_with_external_engine(self, rw_dir): | ||
| 479 | + repo = Repo.init(rw_dir) | ||
| 480 | + gitignore = osp.join(rw_dir, ".gitignore") | ||
| 481 | + | ||
| 482 | + # First commit | ||
| 483 | + with open(gitignore, "w") as f: | ||
| 484 | + f.write("first_line\n") | ||
| 485 | + repo.git.add(".gitignore") | ||
| 486 | + repo.index.commit("first commit") | ||
| 487 | + | ||
| 488 | + # Adding second line and committing | ||
| 489 | + with open(gitignore, "a") as f: | ||
| 490 | + f.write("second_line\n") | ||
| 491 | + repo.git.add(".gitignore") | ||
| 492 | + repo.index.commit("second commit") | ||
| 493 | + | ||
| 494 | + # Adding third line and staging | ||
| 495 | + with open(gitignore, "a") as f: | ||
| 496 | + f.write("third_line\n") | ||
| 497 | + repo.git.add(".gitignore") | ||
| 498 | + | ||
| 499 | + # Adding fourth line | ||
| 500 | + with open(gitignore, "a") as f: | ||
| 501 | + f.write("fourth_line\n") | ||
| 502 | + | ||
| 503 | + # Set the external diff engine | ||
| 504 | + with repo.config_writer(config_level="repository") as writer: | ||
| 505 | + writer.set_value("diff", "external", "bogus_diff_engine") | ||
| 506 | + | ||
| 507 | + head_against_head = repo.head.commit.diff("HEAD^", create_patch=True) | ||
| 508 | + self.assertEqual(len(head_against_head), 1) | ||
| 509 | + head_against_index = repo.head.commit.diff(create_patch=True) | ||
| 510 | + self.assertEqual(len(head_against_index), 1) | ||
| 511 | + head_against_working_tree = repo.head.commit.diff(None, create_patch=True) | ||
| 512 | + self.assertEqual(len(head_against_working_tree), 1) | ||
| 513 | + | ||
| 514 | + index_against_head = repo.index.diff("HEAD", create_patch=True) | ||
| 515 | + self.assertEqual(len(index_against_head), 1) | ||
| 516 | + index_against_working_tree = repo.index.diff(None, create_patch=True) | ||
| 517 | + self.assertEqual(len(index_against_working_tree), 1) | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments