|
24 | 24 |
|
25 | 25 |
|
26 | 26 | classTestRepo(TestBase): |
27 | | - |
28 | 27 | @raises(InvalidGitRepositoryError) |
29 | 28 | deftest_new_should_raise_on_invalid_repo_location(self): |
30 | 29 | Repo(tempfile.gettempdir()) |
@@ -615,3 +614,20 @@ def test_submodule_update(self, rwrepo): |
615 | 614 | assertisinstance(sm,Submodule) |
616 | 615 |
|
617 | 616 | # note: the rest of this functionality is tested in test_submodule |
| 617 | + |
| 618 | +@with_rw_repo('HEAD') |
| 619 | +deftest_git_file(self,rwrepo): |
| 620 | +# Move the .git directory to another location and create the .git file. |
| 621 | +real_path_abs=os.path.abspath(join_path_native(rwrepo.working_tree_dir,'.real')) |
| 622 | +os.rename(rwrepo.git_dir,real_path_abs) |
| 623 | +git_file_path=join_path_native(rwrepo.working_tree_dir,'.git') |
| 624 | +open(git_file_path,'wb').write(fixture('git_file')) |
| 625 | + |
| 626 | +# Create a repo and make sure it's pointing to the relocated .git directory. |
| 627 | +git_file_repo=Repo(rwrepo.working_tree_dir) |
| 628 | +assertos.path.abspath(git_file_repo.git_dir)==real_path_abs |
| 629 | + |
| 630 | +# Test using an absolute gitdir path in the .git file. |
| 631 | +open(git_file_path,'wb').write('gitdir: %s\n'%real_path_abs) |
| 632 | +git_file_repo=Repo(rwrepo.working_tree_dir) |
| 633 | +assertos.path.abspath(git_file_repo.git_dir)==real_path_abs |