diff mbox series

fetch2/git: Unpack tarball when clone needs git-lfs update

Message ID 20260122145533.86635-1-michalwsieron@gmail.com
State New
Headers show
Series fetch2/git: Unpack tarball when clone needs git-lfs update | expand

Commit Message

Michal Sieron Jan. 22, 2026, 2:55 p.m. UTC
Comment at the beginning of the download method says:
> A current clone is preferred to either tarball, a shallow tarball is
> preferred to an out of date clone, and a missing clone will use
> either tarball.
But when doing unpack, a clone will be used even when it is missing
git-lfs objects.

It is possible for a clone to not have git-lfs objects in place while
still having git objects there. Fetch won't do anything about it if
there exists a tarball for requested revision. Because current unpack
method doesn't consider git-lfs data when deciding whether to clone
or untar, this results in unpack failing with git-lfs smudge error.

Signed-off-by: Michal Sieron <michalwsieron@gmail.com>
---
 lib/bb/fetch2/git.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/lib/bb/fetch2/git.py b/lib/bb/fetch2/git.py
index 0fcdb19df..9e95d8c4c 100644
--- a/lib/bb/fetch2/git.py
+++ b/lib/bb/fetch2/git.py
@@ -693,7 +693,7 @@  class Git(FetchMethod):
         source_found = False
         source_error = []
 
-        clonedir_is_up_to_date = not self.clonedir_need_update(ud, d)
+        clonedir_is_up_to_date = not (self.lfs_need_update(ud, d) or self.clonedir_need_update(ud, d))
         if clonedir_is_up_to_date:
             runfetchcmd("%s clone %s %s/ %s" % (ud.basecmd, ud.cloneflags, ud.clonedir, destdir), d)
             source_found = True