|
33 | 33 | )
|
34 | 34 | from git.repo.fun import touch
|
35 | 35 | from git.util import join_path_native
|
36 |
| -from git.exc import BadObject |
| 36 | +from git.exc import ( |
| 37 | + BadObject, |
| 38 | + WorkTreeRepositoryUnsupported |
| 39 | +) |
37 | 40 | from gitdb.util import bin_to_hex
|
38 | 41 | from git.compat import string_types
|
39 | 42 | from gitdb.test.lib import with_rw_directory
|
|
45 | 48 | import itertools
|
46 | 49 | from io import BytesIO
|
47 | 50 |
|
| 51 | +from nose import SkipTest |
| 52 | + |
48 | 53 |
|
49 | 54 | class TestRepo(TestBase):
|
50 | 55 |
|
@@ -779,3 +784,16 @@ def test_is_ancestor(self):
|
779 | 784 | self.assertFalse(repo.is_ancestor("master", c1))
|
780 | 785 | for i, j in itertools.permutations([c1, 'ffffff', ''], r=2):
|
781 | 786 | self.assertRaises(GitCommandError, repo.is_ancestor, i, j)
|
| 787 | + |
| 788 | + @with_rw_directory |
| 789 | + def test_work_tree_unsupported(self, rw_dir): |
| 790 | + git = Git(rw_dir) |
| 791 | + if git.version_info[:3] < (2, 5, 1): |
| 792 | + raise SkipTest("worktree feature unsupported") |
| 793 | + |
| 794 | + rw_master = self.rorepo.clone(join_path_native(rw_dir, 'master_repo')) |
| 795 | + rw_master.git.checkout('HEAD~10') |
| 796 | + worktree_path = join_path_native(rw_dir, 'worktree_repo') |
| 797 | + rw_master.git.worktree('add', worktree_path, 'master') |
| 798 | + |
| 799 | + self.failUnlessRaises(WorkTreeRepositoryUnsupported, Repo, worktree_path) |
0 commit comments