diff mbox series

[v4,4/4] tests/fetch: Add an additional test case to check whether the fast fetch is shallow

Message ID 20250221172602.527924-4-stefan-koch@siemens.com
State New
Headers show
Series [v4,1/4] fetch2/git: Add support for fast initial shallow fetch | expand

Commit Message

Stefan Koch Feb. 21, 2025, 5:26 p.m. UTC
Signed-off-by: Stefan Koch <stefan-koch@siemens.com>
---
 lib/bb/tests/fetch.py | 12 ++++++++++++
 1 file changed, 12 insertions(+)
diff mbox series

Patch

diff --git a/lib/bb/tests/fetch.py b/lib/bb/tests/fetch.py
index ba08cee1f..91d1c3c7d 100644
--- a/lib/bb/tests/fetch.py
+++ b/lib/bb/tests/fetch.py
@@ -2321,6 +2321,18 @@  class GitShallowTest(GitShallowBaseTest, FetcherTest):
         FetcherTest.setUp(self)
         GitShallowBaseTest.setUp(self)
 
+    def test_shallow_check_is_shallow(self):
+        self.add_empty_file('a')
+        self.add_empty_file('b')
+
+        # Fetch and unpack without the clonedir and *only* shallow tarball available
+        bb.utils.remove(self.gitdir, recurse=True)
+        fetcher, ud = self.fetch_and_unpack()
+
+        # The unpacked tree *should* be shallow
+        self.assertRevCount(1)
+        assert os.path.exists(os.path.join(self.gitdir, '.git', 'shallow'))
+
 class GitShallowSkipFastTest(GitShallowBaseTest, FetcherTest):
     """
     Test cases for use when skipping fast shallow mode.