Skip to contentSkip to conversation

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

PATCH New Michal Sieron 1 participant 1 message Jan 22

lore
Share & tools
lore
#0 lore raw

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

Comment at the beginning of the download method says:

Quoted 3 lines

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.

---
 lib/bb/fetch2/git.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/bb/fetch2/git.py +1 -1
index 0fcdb19df..9e95d8c4c 100644
@@ -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
Signature · 1 line
2.43.0