0

I have an implementation of getting lists with the latest 500 commits of a specific Gerrit repository using https://github.com/uwolfer/gerrit-rest-java-client which uses Gerrits REST API to acquire all necessary information from the repository by using specific query searches, assuming you have the correct repository URL and proper authentication.

I know that you can acquire commits from a Gerrit repository if you have it cloned locally on your machine. But what I'm interested in is:

  1. Can you acquire the same information without actually cloning the repository to your machine using JGit?
  2. If yes on 1. Can you receive the commit logs directly from the Gerrit repository using this JGit implementation or are you limited to Gerrits REST API?

I'm going to use the method to store commit logs and compile the data into statistics to get some overview of the different repositories that I have access to.

Rüdiger Herrmann
  • 20,512
  • 11
  • 62
  • 79
Noccz
  • 23
  • 7

2 Answers2

0

1) Yes, you don't need to clone the repository to acquire information from Gerrit using any available REST endpoint.

2) Yes, you can receive commit information using the Get Commit endpoint. The available commit information is showed here.

  • But this uses the Gerrit REST API which I already have an implementation for. Can you use these GET requests with jgit? From what I've seen, they use different methods to acquire the same information. – Noccz Jun 22 '17 at 11:28
  • Updated the questions to be more clear in what I'm wondering. – Noccz Jun 22 '17 at 11:31
0

With JGit you can't access the commit history without cloning the repository. It's not just JGit that needs a local repository, Git itself requires a local repository.

With Git itself you could create a shallow clone - if applicable in your case - to limit the length of the history and save some bandwidth. However, JGit does not yet support shallow clones: Shallow clone with JGIT

Rüdiger Herrmann
  • 20,512
  • 11
  • 62
  • 79