diff options
Diffstat (limited to 'bitbake/lib/bb/tests')
| -rw-r--r-- | bitbake/lib/bb/tests/fetch.py | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/bitbake/lib/bb/tests/fetch.py b/bitbake/lib/bb/tests/fetch.py index 3e2ce53056..2a9019b05f 100644 --- a/bitbake/lib/bb/tests/fetch.py +++ b/bitbake/lib/bb/tests/fetch.py | |||
| @@ -1027,12 +1027,14 @@ class GitShallowTest(FetcherTest): | |||
| 1027 | cwd = self.gitdir | 1027 | cwd = self.gitdir |
| 1028 | return bb.process.run(cmd, cwd=cwd)[0] | 1028 | return bb.process.run(cmd, cwd=cwd)[0] |
| 1029 | 1029 | ||
| 1030 | def add_empty_file(self, path, msg=None): | 1030 | def add_empty_file(self, path, cwd=None, msg=None): |
| 1031 | if msg is None: | 1031 | if msg is None: |
| 1032 | msg = path | 1032 | msg = path |
| 1033 | open(os.path.join(self.srcdir, path), 'w').close() | 1033 | if cwd is None: |
| 1034 | self.git(['add', path], self.srcdir) | 1034 | cwd = self.srcdir |
| 1035 | self.git(['commit', '-m', msg, path], self.srcdir) | 1035 | open(os.path.join(cwd, path), 'w').close() |
| 1036 | self.git(['add', path], cwd) | ||
| 1037 | self.git(['commit', '-m', msg, path], cwd) | ||
| 1036 | 1038 | ||
| 1037 | def fetch(self, uri=None): | 1039 | def fetch(self, uri=None): |
| 1038 | if uri is None: | 1040 | if uri is None: |
| @@ -1211,6 +1213,27 @@ class GitShallowTest(FetcherTest): | |||
| 1211 | self.assertRefs(['master', 'origin/master']) | 1213 | self.assertRefs(['master', 'origin/master']) |
| 1212 | self.assertRevCount(1) | 1214 | self.assertRevCount(1) |
| 1213 | 1215 | ||
| 1216 | def test_shallow_submodules(self): | ||
| 1217 | self.add_empty_file('a') | ||
| 1218 | self.add_empty_file('b') | ||
| 1219 | |||
| 1220 | smdir = os.path.join(self.tempdir, 'gitsubmodule') | ||
| 1221 | bb.utils.mkdirhier(smdir) | ||
| 1222 | self.git('init', cwd=smdir) | ||
| 1223 | self.add_empty_file('asub', cwd=smdir) | ||
| 1224 | |||
| 1225 | self.git('submodule init', cwd=self.srcdir) | ||
| 1226 | self.git('submodule add file://%s' % smdir, cwd=self.srcdir) | ||
| 1227 | self.git('submodule update', cwd=self.srcdir) | ||
| 1228 | self.git('commit -m submodule -a', cwd=self.srcdir) | ||
| 1229 | |||
| 1230 | uri = 'gitsm://%s;protocol=file;subdir=${S}' % self.srcdir | ||
| 1231 | fetcher, ud = self.fetch_shallow(uri) | ||
| 1232 | |||
| 1233 | self.assertRevCount(1) | ||
| 1234 | assert './.git/modules/' in bb.process.run('tar -tzf %s' % os.path.join(self.dldir, ud.mirrortarballs[0]))[0] | ||
| 1235 | assert os.listdir(os.path.join(self.gitdir, 'gitsubmodule')) | ||
| 1236 | |||
| 1214 | def test_shallow_multi_one_uri(self): | 1237 | def test_shallow_multi_one_uri(self): |
| 1215 | # Create initial git repo | 1238 | # Create initial git repo |
| 1216 | self.add_empty_file('a') | 1239 | self.add_empty_file('a') |
