diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index 24aa094..1732cff 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -12,7 +12,7 @@ def boolean isShallowClonedRepo(String gitrootpath) { isshallowclone = sh(returnStdout: true, script: "git rev-parse --is-shallow-repository").trim().toBoolean() } else { - isshallowclone = bat(returnStdout: true, script: "@git rev-parse --is-shallow-repository").trim().toBoolean() + isshallowclone = powershell(returnStdout: true, script: "@git rev-parse --is-shallow-repository").trim().toBoolean() } echo "Repo at ${gitrootpath} is shallow cloned: ${isshallowclone}" } @@ -89,9 +89,9 @@ def String checkouttoreporoot(String gitURL) { if [ \$? -ne 0 ]; then exit 1; fi """ } else { - bat """ + powershell """ git status - if errorlevel 1 EXIT /b 1 + if (\$lastexitcode -ge 1) { exit 1 } """ } } @@ -222,7 +222,7 @@ def gitinit(String targetDir, String reporootpath) { git init "${targetDir}" """ } else { - bat """ + powershell """ git init "${targetDir}" """ } @@ -246,7 +246,7 @@ def setlfsfetchinclude(String targetDir, ArrayList sparseitemlist) { git config lfs.fetchinclude "${sparseitemliststring}" """ } else { - bat """ + powershell """ git config lfs.fetchinclude "${sparseitemliststring}" """ } @@ -264,7 +264,7 @@ def gitsparserestore(String targetDir) { git reset --hard > /dev/null """ } else { - bat """ + powershell """ git rm -rf . 2> nul git clean -fxd 2> nul git reset --hard 2> nul @@ -312,7 +312,7 @@ def checkRepoExists(String gitURL) { returnStatus: true ) } else { - result = bat( script: """ + result = powershell( script: """ @git ls-remote "${gitURL}" CHECK_GIT_REMOTE_URL_REACHABILITY """, returnStatus: true