@Test public void testCheckingOutFileFromAnotherBranch() throws JavaGitException, IOException { GitCheckoutOptions options = new GitCheckoutOptions(); Ref branch1 = Ref.createBranchRef("testBranch01"); options.setOptB(branch1); Ref branch = Ref.createBranchRef("master"); gitCheckout.checkout(repositoryDirectory, options, branch); File file3 = new File( repositoryDirectory.getPath() + File.separator + "foobar03"); file3.createNewFile(); gitAdd.add(repositoryDirectory, null, new File("foobar03")); gitCommit.commit(repositoryDirectory, "Added foobar03 to the repository"); assertFileExistsInDirectory(repositoryDirectory, new File("foobar03")); Ref master = Ref.createBranchRef("master"); options = new GitCheckoutOptions(); Ref newBranch = Ref.createBranchRef("testBranch02"); options.setOptB(newBranch); gitCheckout.checkout(repositoryDirectory, options, master); assertFalse(file3.exists()); gitCheckout.checkout(repositoryDirectory, null, branch1, file3); assertFileExistsInDirectory(repositoryDirectory, new File("foobar03")); }
public GitCheckoutResponse checkout(File repositoryPath, GitCheckoutOptions options, Ref branch) throws IOException, JavaGitException { CheckUtilities.checkFileValidity(repositoryPath); CheckUtilities.validateArgumentRefType(branch, RefType.BRANCH, "Branch name"); IClient client = ClientManager.getInstance().getPreferredClient(); IGitCheckout gitCheckout = client.getGitCheckoutInstance(); return gitCheckout.checkout(repositoryPath, options, branch); }
GitCheckout { public GitCheckoutResponse checkout(File repositoryPath, GitCheckoutOptions options, Ref branch) throws IOException, JavaGitException { CheckUtilities.checkFileValidity(repositoryPath); CheckUtilities.validateArgumentRefType(branch, RefType.BRANCH, "Branch name"); IClient client = ClientManager.getInstance().getPreferredClient(); IGitCheckout gitCheckout = client.getGitCheckoutInstance(); return gitCheckout.checkout(repositoryPath, options, branch); } }
GitCheckout { public GitCheckoutResponse checkout(File repositoryPath, GitCheckoutOptions options, Ref branch) throws IOException, JavaGitException { CheckUtilities.checkFileValidity(repositoryPath); CheckUtilities.validateArgumentRefType(branch, RefType.BRANCH, "Branch name"); IClient client = ClientManager.getInstance().getPreferredClient(); IGitCheckout gitCheckout = client.getGitCheckoutInstance(); return gitCheckout.checkout(repositoryPath, options, branch); }  }
GitCheckout { public GitCheckoutResponse checkout(File repositoryPath, GitCheckoutOptions options, Ref branch) throws IOException, JavaGitException { CheckUtilities.checkFileValidity(repositoryPath); CheckUtilities.validateArgumentRefType(branch, RefType.BRANCH, "Branch name"); IClient client = ClientManager.getInstance().getPreferredClient(); IGitCheckout gitCheckout = client.getGitCheckoutInstance(); return gitCheckout.checkout(repositoryPath, options, branch); }  GitCheckoutResponse checkout(File repositoryPath, GitCheckoutOptions options, Ref branch); GitCheckoutResponse checkout(File repositoryPath, List<File> paths); GitCheckoutResponse checkout(File repositoryPath, GitCheckoutOptions options, Ref branch,
      File file); GitCheckoutResponse checkout(File repositoryPath, GitCheckoutOptions options, Ref branch,
      List<File> paths); GitCheckoutResponse checkout(File repositoryPath, Ref ref, List<File> paths); }
GitCheckout { public GitCheckoutResponse checkout(File repositoryPath, GitCheckoutOptions options, Ref branch) throws IOException, JavaGitException { CheckUtilities.checkFileValidity(repositoryPath); CheckUtilities.validateArgumentRefType(branch, RefType.BRANCH, "Branch name"); IClient client = ClientManager.getInstance().getPreferredClient(); IGitCheckout gitCheckout = client.getGitCheckoutInstance(); return gitCheckout.checkout(repositoryPath, options, branch); }  GitCheckoutResponse checkout(File repositoryPath, GitCheckoutOptions options, Ref branch); GitCheckoutResponse checkout(File repositoryPath, List<File> paths); GitCheckoutResponse checkout(File repositoryPath, GitCheckoutOptions options, Ref branch,
      File file); GitCheckoutResponse checkout(File repositoryPath, GitCheckoutOptions options, Ref branch,
      List<File> paths); GitCheckoutResponse checkout(File repositoryPath, Ref ref, List<File> paths);  }