Add bat variant of git commands

This commit is contained in:
Dan Hawkins 2018-12-03 08:37:23 +00:00
commit bf616a38a1

View file

@ -32,11 +32,23 @@ class ProductInfo extends GISJsonSerialised {
void set(String productname, String subcomponentname, String jirakey) {
// Make sure the fields can be used in git tags
def int pstatus = script.sh(script: "git check-ref-format --normalize \"refs/tags/${productname}\" >/dev/null 2>/dev/null", , returnStatus: true)
def int pstatus = 0
if (script.isUnix()) {
pstatus = script.sh(script: "git check-ref-format --normalize \"refs/tags/${productname}\" >/dev/null 2>/dev/null", , returnStatus: true)
}
else {
pstatus = script.bat(script: "@git check-ref-format --normalize \"refs/tags/${productname}\" > NUL 2> NUL", , returnStatus: true)
}
if (pstatus > 0) {
script.error("The product name: ${productname} needs to be renamed as it cannot be used in a git tag name")
}
def int sstatus = script.sh(script: "git check-ref-format --normalize \"refs/tags/${subcomponentname}\" >/dev/null 2>/dev/null", , returnStatus: true)
def int sstatus = 0
if (script.isUnix()) {
sstatus = script.sh(script: "git check-ref-format --normalize \"refs/tags/${subcomponentname}\" >/dev/null 2>/dev/null", , returnStatus: true)
}
else {
sstatus = script.bat(script: "@git check-ref-format --normalize \"refs/tags/${subcomponentname}\" > NUL 2> NUL", , returnStatus: true)
}
if (sstatus > 0) {
script.error("The subcomponent name: ${subcomponentname} needs to be renamed as it cannot be used in a git tag name")
}