Reputation: 949
I want to perform sparse checkout in GIT i.e. checking out a portion of working copy from repository.How can I do this by a Java code.Pls suggest.
Upvotes: 3
Views: 1747
Reputation: 16501
Based on @rüdiger-herrmann's answer:
String url = "https://github.com/renaud/solr_noLenghNormSimilarity";
String hash = "802558f58add3a1f5b33f04254194bd7cd59b27f";
String subPath = "src/org";
String dest = "myclone";
File localPath = new File(dest);
Git gitRepo = Git.cloneRepository().setURI(url).setDirectory(localPath).setNoCheckout(true).call();
gitRepo.checkout().setStartPoint(hash).addPath(subPath).call();
gitRepo.getRepository().close();
Upvotes: 2
Reputation: 24040
Currently the JGit library (as of 3.0.0) doesn't support sparse checkouts.
Upvotes: 1