Try to get sparse checkout to work with lfs

This commit is contained in:
Dan Hawkins 2019-05-14 23:32:18 +01:00
commit 3686e21976

View file

@ -189,6 +189,7 @@ def gitCheckout(String gitURL, String revision, String targetDir, String repoRoo
def gitinit(String targetDir, String reporootpath) {
if (!fileExists("${targetDir}/.git")) { // Git folder does not already exist
echo "git init ${targetDir}"
if (isUnix()) {
sh """
git init "${targetDir}"
@ -198,6 +199,7 @@ def gitinit(String targetDir, String reporootpath) {
git init "${targetDir}"
"""
}
echo "Writing ${reporootpath}/.git/objects to ${targetDir}/.git/objects/info/alternates"
dir("${targetDir}/.git/objects/info") {
writeFile(file: 'alternates', text: "${reporootpath}/.git/objects")
}
@ -210,6 +212,7 @@ def setlfsfetchinclude(String targetDir, ArrayList<String> sparseitemlist) {
for (item in sparseitemlist) {
sparseitemliststring += "${item},"
}
echo "git config lfs.fetchinclude ${sparseitemliststring}"
dir(targetDir) {
if (isUnix()) {
sh """
@ -225,6 +228,7 @@ def setlfsfetchinclude(String targetDir, ArrayList<String> sparseitemlist) {
}
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"
def String reporootpath = lfsinstallandreporoot(gitURL)
showsparseitemlist(sparseitemlist)
if (!sparseitemlist.isEmpty()) {