Skip to content

Instantly share code, notes, and snippets.

@Stormwind99
Created July 6, 2017 21:09
Show Gist options
  • Save Stormwind99/468366bda4cbca911dcf9577ce499a89 to your computer and use it in GitHub Desktop.
Save Stormwind99/468366bda4cbca911dcf9577ce499a89 to your computer and use it in GitHub Desktop.
[root@build-master source]# diff -u git.py.orig git.py
--- git.py.orig 2017-07-06 20:06:48.390197772 +0000
+++ git.py 2017-07-06 21:06:35.925050332 +0000
@@ -76,11 +76,11 @@
""" Class for Git with all the smarts """
name = 'git'
renderables = ["repourl", "reference", "branch",
- "codebase", "mode", "method", "origin"]
+ "codebase", "mode", "method", "origin", "lfs"]
def __init__(self, repourl=None, branch='HEAD', mode='incremental', method=None,
reference=None, submodules=False, shallow=False, progress=False, retryFetch=False,
- clobberOnFailure=False, getDescription=False, config=None, origin=None, **kwargs):
+ clobberOnFailure=False, getDescription=False, config=None, origin=None, lfs=False, **kwargs):
"""
@type repourl: string
@param repourl: the URL which points at the git repository
@@ -104,6 +104,7 @@
@type reference: string
@param reference: If available use a reference repo.
Uses `--reference` in git command. Refer `git clone --help`
+
@type progress: boolean
@param progress: Pass the --progress option when fetching. This
can solve long fetches getting killed due to
@@ -121,6 +122,9 @@
@type origin: string
@param origin: The name to give the remote when cloning (default None)
+ @type lfs: boolean
+ @param lfs: Use GitLFS
+
@type config: dict
@param config: Git configuration options to enable when running git
"""
@@ -143,6 +147,7 @@
self.supportsSubmoduleCheckout = True
self.srcdir = 'source'
self.origin = origin
+ self.lfs = lfs
Source.__init__(self, **kwargs)
if not self.repourl:
bbconfig.error("Git: must provide repourl.")
@@ -446,7 +451,11 @@
def _clone(self, shallowClone):
"""Retry if clone failed"""
- command = ['clone']
+ command = []
+ if self.lfs:
+ command += ['lfs', 'clone']
+ else:
+ command += ['clone']
switchToBranch = False
if self.supportsBranch and self.branch != 'HEAD':
if self.branch.startswith('refs/'):
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment