All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ai.digital.integration.server.common.util.GitUtil.kt Maven / Gradle / Ivy

There is a newer version: 23.3.0-1025.941
Show newest version
package ai.digital.integration.server.common.util

import java.nio.file.Path
import java.nio.file.Paths

class GitUtil {
    companion object {
        fun checkout(repo: String, destinationPath: Path, branch: String? = null): Path {
            val dest = Paths.get(destinationPath.toAbsolutePath().toString(), repo)

            val branchClone = if (branch != null) "-b $branch" else ""
            ProcessUtil.executeCommand(
                    "rm -fr \"${dest.toAbsolutePath()}\"; git clone [email protected]:xebialabs/$repo.git \"${dest.toAbsolutePath()}\" $branchClone")
            return dest
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy