Try to get sparse checkout to work with lfs
This commit is contained in:
parent
1aee93e121
commit
eb8a1005ec
1 changed files with 22 additions and 0 deletions
|
|
@ -227,6 +227,25 @@ def setlfsfetchinclude(String targetDir, ArrayList<String> sparseitemlist) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def gitsparserestore(String targetDir) {
|
||||||
|
echo "Clean out full fetch; Force a sparse fetch"
|
||||||
|
dir(targetDir) {
|
||||||
|
if (isUnix()) {
|
||||||
|
sh """
|
||||||
|
git rm -rf .
|
||||||
|
git clean -fxd
|
||||||
|
git reset --hard
|
||||||
|
"""
|
||||||
|
} else {
|
||||||
|
bat """
|
||||||
|
git rm -rf .
|
||||||
|
git clean -fxd
|
||||||
|
git reset --hard
|
||||||
|
"""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
def gitCheckoutAlt(String gitURL, String revision, String targetDir, String repoRootSuffix = "", int cloneDepth = 1, boolean shallowClone = true, ArrayList<String> sparseitemlist = new ArrayList<String>()) {
|
def gitCheckoutAlt(String gitURL, String revision, String targetDir, String repoRootSuffix = "", int cloneDepth = 1, boolean shallowClone = true, ArrayList<String> sparseitemlist = new ArrayList<String>()) {
|
||||||
echo "Performing alternative checkout"
|
echo "Performing alternative checkout"
|
||||||
def String reporootpath = lfsinstallandreporoot(gitURL)
|
def String reporootpath = lfsinstallandreporoot(gitURL)
|
||||||
|
|
@ -236,6 +255,9 @@ def gitCheckoutAlt(String gitURL, String revision, String targetDir, String repo
|
||||||
setlfsfetchinclude(targetDir, sparseitemlist)
|
setlfsfetchinclude(targetDir, sparseitemlist)
|
||||||
}
|
}
|
||||||
docheckout(gitURL, revision, cloneDepth, reporootpath, shallowClone, targetDir, sparseitemlist)
|
docheckout(gitURL, revision, cloneDepth, reporootpath, shallowClone, targetDir, sparseitemlist)
|
||||||
|
if (!sparseitemlist.isEmpty()) {
|
||||||
|
gitsparserestore(targetDir)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def checkRepoExists(String gitURL) {
|
def checkRepoExists(String gitURL) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue