import java.util.Map;
import static java.lang.String.format;
public class CheckoutCommands {
public static ShellCommands get(Map<String, String> dotCiEnvVars) {
GitUrl gitRepoUrl = new GitUrl(dotCiEnvVars.get("GIT_URL"));
String gitUrl = gitRepoUrl.getHttpsUrl();
String checkoutLocation = format("/var/%s",gitRepoUrl.getFullRepoName());
ShellCommands shellCommands = new ShellCommands();
if(dotCiEnvVars.get("DOTCI_PULL_REQUEST") != null){
shellCommands.add(format("git clone --depth=50 %s %s",gitUrl,checkoutLocation));
shellCommands.add("cd " + checkoutLocation);
shellCommands.add(format("git fetch origin \"+refs/pull/%s/merge:\"", dotCiEnvVars.get("DOTCI_PULL_REQUEST")));