bitbake: fetch2: Simplify git LFS detection

Its unclear why this function does not operate on the desired source
revision to begin with (which really should be the decider on whether a
particular source revision uses LFS or not). Simplify the decision logic
by always checking the `.gitattributes` file of the target revision.

(Bitbake rev: b3faa0ce5c0a6945f26b5b303a7f38c00d132397)

Signed-off-by: Philip Lorenz <philip.lorenz@bmw.de>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Philip Lorenz 2025-04-29 10:11:20 +02:00 committed by Richard Purdie
parent 7642477dc8
commit 74945e4678

View File

@ -845,18 +845,8 @@ class Git(FetchMethod):
"""
Check if the repository has 'lfs' (large file) content
"""
if ud.nobranch:
# If no branch is specified, use the current git commit
refname = ud.revision
elif wd == ud.clonedir:
# The bare clonedir doesn't use the remote names; it has the branch immediately.
refname = ud.branch
else:
refname = "origin/%s" % ud.branch
cmd = "%s grep lfs %s:.gitattributes | wc -l" % (
ud.basecmd, refname)
ud.basecmd, ud.revision)
try:
output = runfetchcmd(cmd, d, quiet=True, workdir=wd)