Fix git checkout in specified paths

Change-Id: I3adc271d4962f83dfba38216b7780b605dec03c4
diff --git a/src/com/mirantis/mk/Git.groovy b/src/com/mirantis/mk/Git.groovy
index 5e89c71..3bdacca 100644
--- a/src/com/mirantis/mk/Git.groovy
+++ b/src/com/mirantis/mk/Git.groovy
@@ -17,20 +17,20 @@
  * @param timeout         Set checkout timeout (default 10)
  */
 def checkoutGitRepository(path, url, branch, credentialsId = null, poll = true, timeout = 10){
-    checkout(
-        changelog:true,
-        poll: poll,
-        scm: [
-            $class: 'GitSCM',
-            branches: [[name: "*/${branch}"]],
-        doGenerateSubmoduleConfigurations: false,
-        extensions: [
-            [$class: 'RelativeTargetDirectory', relativeTargetDir: path],
-            [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false, timeout: timeout]],
-        submoduleCfg: [],
-        userRemoteConfigs: [[url: url, credentialsId: credentialsId]]]
-    )
     dir(path) {
+        checkout(
+            changelog:true,
+            poll: poll,
+            scm: [
+                $class: 'GitSCM',
+                branches: [[name: "*/${branch}"]],
+            doGenerateSubmoduleConfigurations: false,
+            extensions: [
+                [$class: 'RelativeTargetDirectory', relativeTargetDir: path],
+                [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false, timeout: timeout]],
+            submoduleCfg: [],
+            userRemoteConfigs: [[url: url, credentialsId: credentialsId]]]
+        )
         sh(returnStdout: true, script: 'git rev-parse HEAD').trim()
     }
 }