Fix checkout of refspec
Change-Id: I75491b5e74cb06683b993291478a7245fce9fd52
Related-Prod: PRODX-3456
diff --git a/src/com/mirantis/mcp/Git.groovy b/src/com/mirantis/mcp/Git.groovy
index 4231016..53efa09 100644
--- a/src/com/mirantis/mcp/Git.groovy
+++ b/src/com/mirantis/mcp/Git.groovy
@@ -79,7 +79,7 @@
def credentialsId = config.get('credentialsId', '')
def protocol = config.get('protocol', 'ssh')
def refspec = config.get('refspec', null)
- String branch = config.get('branch', 'FETCH_HEAD')
+ String branch = refspec ? 'FETCH_HEAD' : "*/${config.get('branch')}"
Integer depth = config.get('depth', 0)
Integer timeout = config.get('timeout', 0)