diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index 253ffee..b386a9a 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -75,7 +75,23 @@ def String checkouttoreporoot(String gitURL) { return reporootsubfolder } +def checkgitlfsinstall() { + if (isUnix()) { + sh """ + git lfs install + if [ \$? -ne 0 ]; then exit 1; fi + """ + + } else { + bat """ + git lfs install + if errorlevel 1 EXIT /b 1 + """ + } +} + def gitCheckout(String gitURL, String revision, String targetDir, String repoRootSuffix = "", int cloneDepth = 1, boolean shallowClone = true, ArrayList sparseitemlist = new ArrayList()) { + checkgitlfsinstall() def reporootpath = checkouttoreporoot(gitURL) checkout([ $class: 'GitSCM', @@ -99,33 +115,33 @@ def gitCheckout(String gitURL, String revision, String targetDir, String repoRoo } String getSHAFromVersion(String versionFolder) { - dir (versionFolder) { + dir (versionFolder) { srcRevision = readFile("gitrevision.txt").trim() - } - return srcRevision + } + return srcRevision } boolean checkAllVersionsAgree(java.util.LinkedHashMap versions) { def keys = versions.keySet() - if (keys.size() < 1) { - return false - } - if (keys.size() == 1) { - return true - } + if (keys.size() < 1) { + return false + } + if (keys.size() == 1) { + return true + } else { - version = "" - for (key in keys) { - nextversion = versions.get(key) - if (version == "") { - version = nextversion - } - if (nextversion != version) { - return false - } - } - } - return true + version = "" + for (key in keys) { + nextversion = versions.get(key) + if (version == "") { + version = nextversion + } + if (nextversion != version) { + return false + } + } + } + return true } def stripgithistory(String rootfolder) {