diff mbox series

[v5,3/5] fetch2/gitsm: Unpack even when `ud.clonedir` is not available

Message ID 20250303134913.356778-3-stefan-koch@siemens.com
State Accepted, archived
Commit 13d76361ec37faecd84e7b81da22ada7d4e0ba90
Headers show
Series [v5,1/5] fetch2/git: Add support for fast initial shallow fetch | expand

Commit Message

Stefan Koch March 3, 2025, 1:49 p.m. UTC
Signed-off-by: Stefan Koch <stefan-koch@siemens.com>
---
 lib/bb/fetch2/gitsm.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/lib/bb/fetch2/gitsm.py b/lib/bb/fetch2/gitsm.py
index bab1bf258..1c58230ea 100644
--- a/lib/bb/fetch2/gitsm.py
+++ b/lib/bb/fetch2/gitsm.py
@@ -150,7 +150,10 @@  class GitSM(Git):
     def call_process_submodules(self, ud, d, extra_check, subfunc):
         # If we're using a shallow mirror tarball it needs to be
         # unpacked temporarily so that we can examine the .gitmodules file
-        if ud.shallow and os.path.exists(ud.fullshallow) and extra_check:
+        # Unpack even when ud.clonedir is not available,
+        # which may occur during a fast shallow clone
+        unpack = extra_check or not os.path.exists(ud.clonedir)
+        if ud.shallow and os.path.exists(ud.fullshallow) and unpack:
             tmpdir = tempfile.mkdtemp(dir=d.getVar("DL_DIR"))
             try:
                 runfetchcmd("tar -xzf %s" % ud.fullshallow, d, workdir=tmpdir)