My Existing Code
//clone repo
File localPath = File.createTempFile("TestGitRepository", "");
localPath.delete();
private Repository repo;
Git git = Git.cloneRepository()
.setCredentialsProvider(credentials)
.setURI(url)
.setBranch(branch)
.setDirectory(localPath)
.call();
repo = git.getRepository();
//get commit by using cloned repo
try (Git git = new Git(repo)) {
Iterable<RevCommit> logs = git.log().call();
for (RevCommit rev : logs) {
System.out.println("Commit: " + rev + ", name: " + rev.getName() + ", id: " + rev.getId().getName());
}
} catch (Exception e) {
System.out.println("Exception: {}"+e);
}
Im able to get list of commits by cloning the repository, i want to avoid cloning of repository. Please share me some links if there is a way to do this and also suggest me additional library if needed.