diff mbox series

[v2,4/4] tests/fetch: Add additional test cases to check whether the fast fetch is shallow

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

Commit Message

Stefan Koch Feb. 14, 2025, 3:50 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 2891cf9e5..a1d9f4e61 100644
--- a/lib/bb/tests/fetch.py
+++ b/lib/bb/tests/fetch.py
@@ -2350,6 +2350,18 @@  class GitShallowFastTest(GitShallowBaseTest, FetcherTest):
     def test_shallow_clone_preferred_over_shallow(self):
         super().test_shallow_clone_preferred_over_shallow(fast=True)
 
+    def test_shallow_fast_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 GitLfsTest(FetcherTest):
     def skipIfNoGitLFS():
         import shutil