summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bitbake/lib/bb/tests/fetch.py41
1 files changed, 41 insertions, 0 deletions
diff --git a/bitbake/lib/bb/tests/fetch.py b/bitbake/lib/bb/tests/fetch.py
index 45dc9e5d08..d0c161a7f6 100644
--- a/bitbake/lib/bb/tests/fetch.py
+++ b/bitbake/lib/bb/tests/fetch.py
@@ -1691,6 +1691,47 @@ class GitShallowTest(FetcherTest):
1691 # Verify the submodule is also shallow 1691 # Verify the submodule is also shallow
1692 self.assertRevCount(1, cwd=os.path.join(self.gitdir, 'gitsubmodule')) 1692 self.assertRevCount(1, cwd=os.path.join(self.gitdir, 'gitsubmodule'))
1693 1693
1694 def test_shallow_submodule_mirrors(self):
1695 self.add_empty_file('a')
1696 self.add_empty_file('b')
1697
1698 smdir = os.path.join(self.tempdir, 'gitsubmodule')
1699 bb.utils.mkdirhier(smdir)
1700 self.git('init', cwd=smdir)
1701 # Make this look like it was cloned from a remote...
1702 self.git('config --add remote.origin.url "%s"' % smdir, cwd=smdir)
1703 self.git('config --add remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"', cwd=smdir)
1704 self.add_empty_file('asub', cwd=smdir)
1705 self.add_empty_file('bsub', cwd=smdir)
1706
1707 self.git('submodule init', cwd=self.srcdir)
1708 self.git('submodule add file://%s' % smdir, cwd=self.srcdir)
1709 self.git('submodule update', cwd=self.srcdir)
1710 self.git('commit -m submodule -a', cwd=self.srcdir)
1711
1712 uri = 'gitsm://%s;protocol=file;subdir=${S}' % self.srcdir
1713
1714 # Fetch once to generate the shallow tarball
1715 fetcher, ud = self.fetch(uri)
1716
1717 # Set up the mirror
1718 mirrordir = os.path.join(self.tempdir, 'mirror')
1719 os.rename(self.dldir, mirrordir)
1720 self.d.setVar('PREMIRRORS', 'gitsm://.*/.* file://%s/\n' % mirrordir)
1721
1722 # Fetch from the mirror
1723 bb.utils.remove(self.dldir, recurse=True)
1724 bb.utils.remove(self.gitdir, recurse=True)
1725 self.fetch_and_unpack(uri)
1726
1727 # Verify the main repository is shallow
1728 self.assertRevCount(1)
1729
1730 # Verify the gitsubmodule directory is present
1731 assert os.listdir(os.path.join(self.gitdir, 'gitsubmodule'))
1732
1733 # Verify the submodule is also shallow
1734 self.assertRevCount(1, cwd=os.path.join(self.gitdir, 'gitsubmodule'))
1694 1735
1695 if any(os.path.exists(os.path.join(p, 'git-annex')) for p in os.environ.get('PATH').split(':')): 1736 if any(os.path.exists(os.path.join(p, 'git-annex')) for p in os.environ.get('PATH').split(':')):
1696 def test_shallow_annex(self): 1737 def test_shallow_annex(self):