diff options
Diffstat (limited to 'bitbake/lib/bb/fetch2/git.py')
-rw-r--r-- | bitbake/lib/bb/fetch2/git.py | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py index df9538a60d..c514c36812 100644 --- a/bitbake/lib/bb/fetch2/git.py +++ b/bitbake/lib/bb/fetch2/git.py | |||
@@ -384,6 +384,10 @@ class Git(FetchMethod): | |||
384 | if missing_rev: | 384 | if missing_rev: |
385 | raise bb.fetch2.FetchError("Unable to find revision %s even from upstream" % missing_rev) | 385 | raise bb.fetch2.FetchError("Unable to find revision %s even from upstream" % missing_rev) |
386 | 386 | ||
387 | if self._contains_lfs(ud, d, ud.clonedir) and self._need_lfs(ud): | ||
388 | for name in ud.names: | ||
389 | runfetchcmd("git-lfs fetch origin %s" % ud.revisions[name], d, workdir=ud.clonedir) | ||
390 | |||
387 | def build_mirror_data(self, ud, d): | 391 | def build_mirror_data(self, ud, d): |
388 | if ud.shallow and ud.write_shallow_tarballs: | 392 | if ud.shallow and ud.write_shallow_tarballs: |
389 | if not os.path.exists(ud.fullshallow): | 393 | if not os.path.exists(ud.fullshallow): |
@@ -479,7 +483,7 @@ class Git(FetchMethod): | |||
479 | if os.path.exists(destdir): | 483 | if os.path.exists(destdir): |
480 | bb.utils.prunedir(destdir) | 484 | bb.utils.prunedir(destdir) |
481 | 485 | ||
482 | need_lfs = ud.parm.get("lfs", "1") == "1" | 486 | need_lfs = self._need_lfs(ud) |
483 | 487 | ||
484 | if not need_lfs: | 488 | if not need_lfs: |
485 | ud.basecmd = "GIT_LFS_SKIP_SMUDGE=1 " + ud.basecmd | 489 | ud.basecmd = "GIT_LFS_SKIP_SMUDGE=1 " + ud.basecmd |
@@ -568,6 +572,9 @@ class Git(FetchMethod): | |||
568 | raise bb.fetch2.FetchError("The command '%s' gave output with more then 1 line unexpectedly, output: '%s'" % (cmd, output)) | 572 | raise bb.fetch2.FetchError("The command '%s' gave output with more then 1 line unexpectedly, output: '%s'" % (cmd, output)) |
569 | return output.split()[0] != "0" | 573 | return output.split()[0] != "0" |
570 | 574 | ||
575 | def _need_lfs(self, ud): | ||
576 | return ud.parm.get("lfs", "1") == "1" | ||
577 | |||
571 | def _contains_lfs(self, ud, d, wd): | 578 | def _contains_lfs(self, ud, d, wd): |
572 | """ | 579 | """ |
573 | Check if the repository has 'lfs' (large file) content | 580 | Check if the repository has 'lfs' (large file) content |
@@ -578,8 +585,14 @@ class Git(FetchMethod): | |||
578 | else: | 585 | else: |
579 | branchname = "master" | 586 | branchname = "master" |
580 | 587 | ||
581 | cmd = "%s grep lfs origin/%s:.gitattributes | wc -l" % ( | 588 | # The bare clonedir doesn't use the remote names; it has the branch immediately. |
582 | ud.basecmd, ud.branches[ud.names[0]]) | 589 | if wd == ud.clonedir: |
590 | refname = ud.branches[ud.names[0]] | ||
591 | else: | ||
592 | refname = "origin/%s" % ud.branches[ud.names[0]] | ||
593 | |||
594 | cmd = "%s grep lfs %s:.gitattributes | wc -l" % ( | ||
595 | ud.basecmd, refname) | ||
583 | 596 | ||
584 | try: | 597 | try: |
585 | output = runfetchcmd(cmd, d, quiet=True, workdir=wd) | 598 | output = runfetchcmd(cmd, d, quiet=True, workdir=wd) |