|
1 | 1 | # This module is part of GitPython and is released under
|
2 | 2 | # the BSD License: http://www.opensource.org/licenses/bsd-license.php
|
| 3 | +import shutil |
| 4 | +import sys |
| 5 | +import os |
| 6 | + |
| 7 | +import git |
3 | 8 |
|
4 | 9 | from git.test.lib import (
|
5 | 10 | TestBase,
|
6 | 11 | with_rw_repo
|
7 | 12 | )
|
| 13 | +from gitdb.test.lib import with_rw_directory |
8 | 14 | from git.exc import InvalidGitRepositoryError
|
9 | 15 | from git.objects.submodule.base import Submodule
|
10 | 16 | from git.objects.submodule.root import RootModule, RootUpdateProgress
|
11 | 17 | from git.util import to_native_path_linux, join_path_native
|
12 | 18 | from git.compat import string_types
|
13 |
| -import shutil |
14 |
| -import git |
15 |
| -import sys |
16 |
| -import os |
17 | 19 |
|
18 | 20 | from nose import SkipTest
|
19 | 21 |
|
@@ -597,3 +599,17 @@ def test_first_submodule(self, rwrepo):
|
597 | 599 | self.failUnlessRaises(ValueError, rwrepo.create_submodule, 'fail', os.path.expanduser('~'))
|
598 | 600 | self.failUnlessRaises(ValueError, rwrepo.create_submodule, 'fail-too',
|
599 | 601 | rwrepo.working_tree_dir + os.path.sep)
|
| 602 | + |
| 603 | + @with_rw_directory |
| 604 | + def test_add_empty_repo(self, rwdir): |
| 605 | + parent_dir = os.path.join(rwdir, 'parent') |
| 606 | + os.mkdir(parent_dir) |
| 607 | + empty_repo_dir = os.path.join(rwdir, 'empty-repo') |
| 608 | + |
| 609 | + parent = git.Repo.init(parent_dir) |
| 610 | + git.Repo.init(empty_repo_dir) |
| 611 | + |
| 612 | + for checkout_mode in range(2): |
| 613 | + self.failUnlessRaises(ValueError, parent.create_submodule, 'empty', 'empty', |
| 614 | + url=empty_repo_dir, no_checkout=checkout_mode) |
| 615 | + # end for each checkout mode |
0 commit comments