[bitbake-devel,3/3] git.py: Use the correct branch to check if the repository has LFS objects.

Submitted by Mauro Queirós on May 28, 2020, 2:18 p.m. | Patch ID: 172930

Details

Message ID 20200528141853.213890-3-maurofrqueiros@gmail.com
State Master Next
Commit 7a059e2b45263439555513f082ecb5901c1c1088
Headers show

Commit Message

Mauro Queirós May 28, 2020, 2:18 p.m.
Function "contains_lfs" was only looking at the master branch when searching for LFS
content. LFS may be configured in specific branches only, so we need to use the
correct branch.

Signed-off-by: Mauro Queiros <maurofrqueiros@gmail.com>
---
 lib/bb/fetch2/git.py | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/lib/bb/fetch2/git.py b/lib/bb/fetch2/git.py
index eab76a10..b7841c43 100644
--- a/lib/bb/fetch2/git.py
+++ b/lib/bb/fetch2/git.py
@@ -566,8 +566,15 @@  class Git(FetchMethod):
         """
         Check if the repository has 'lfs' (large file) content
         """
-        cmd = "%s grep lfs HEAD:.gitattributes | wc -l" % (
-                ud.basecmd)
+
+        if not ud.nobranch:
+            branchname = ud.branches[ud.names[0]]
+        else:
+            branchname = "master"
+
+        cmd = "%s show %s:.lfsconfig" % (
+                ud.basecmd, branchname)
+
         try:
             output = runfetchcmd(cmd, d, quiet=True, workdir=wd)
             if int(output) > 0: