Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [egit-dev] Fwd: Integration with Git

On Tue, Aug 4, 2020 at 3:42 PM khayati ohri <khayati.ohri@xxxxxxxxx> wrote:
Hi Matthias

Please find my replies to your questions below.

please avoid top posting which makes it very hard to follow the conversation

---------- Forwarded message ---------
From: khayati ohri <khayati.ohri@xxxxxxxxx>
Date: Wed, Jul 29, 2020 at 11:48 PM
Subject: Re: [egit-dev] Integration with Git
To: Matthias Sohn <matthias.sohn@xxxxxxxxx>
Cc: EGit developer discussion <egit-dev@xxxxxxxxxxx>

Hi Matthias

Thanks for the prompt reply. Please find my replies to your questions below :-
  • We have the following Git API through which we can fetch commit details. We don't have its alternative in EGit or JGit you mean ?
I don't know what you mean by "the following Git API".
JGit is the Java implementation of git this means it of course can do all the git commands available but most of them work on
your local clone of the repository similar like native git does that. If you are looking for a remote API to do this then you are
at the mercy of proprietary APIs of your Git server (e.g. GitHub or GitLab REST API). AFAIK there  is no standard remote
API for commands like give me diff between this and that commit. And the reason is that git is a distributed versioning
system which means you have to first get a copy of the repository by cloning it before you can use most of the commands
on the local clone.
  • Yes you are absolutely right but what I am aiming is to actually fetch the latest and latest - 1 version of all the files in a commit by using/integrating with Git libraries so that the same can be populated in my tool .
clone the repository and use JGit to access whatever version you are interested in 
  • Yes I was actually referring to this But I  believe this is just a small part of Egit plugin and you are pointing to use Jgit dierctly on which Egit is based upon to gain maximum functionality ? Though I did see various services provided by org.eclipse.egit.github.core but I couldn't find any service which can extract the history of files or compare 2 commits of a file for me.
JGit and EGit are about handling standard git repositories.
o.e.e.github.core is about handling proprietary GitHub REST APIs. 
  • Thanks for acknowledging  but can you tell me a general idea as what these limits would be for a Git server ?
this depends on which Git server you use 
  • I believe it means we cannot see others uncommitted changes unless and until they are pushed to Git server and that probably why as of today GitHUb allows to provide Pull request in committed changes only ?
Git's way to share changes is creating commits and sending them around via any
of the supported protocols (git, http, https, ssh, ftp, git bundles).
All the review tools are built on top of that and manage commits which are in review
by referencing them using some custom refs (e.g. refs/changes/00/100000 for Gerrit Code Review)
which are not standard branches. As soon as a commit is accepted it's merged into e.g. the master branch.

Once again thanks alot for your cooperation


On Tue, Jul 28, 2020 at 6:05 PM Matthias Sohn <matthias.sohn@xxxxxxxxx> wrote:
On Tue, Jul 28, 2020 at 11:45 AM khayati ohri <khayati.ohri@xxxxxxxxx> wrote:
I am looking forward to integrate Git with my tool. Following are the operations I am looking forward.
  • We will be using Commit ID to fetch the commit details .

git servers typically do not allow to fetch based on commitId for security reasons. Normally they only allow to fetch based on refs (branches, tags) 
  • Once we get the list of files from previous point we want to fetch the latest file content (n version) as well as (n-1 version). 

I don't understand this  question. Git is a distributed versioning system this means you typically  have a clone of the repository
which contains the complete history of the project. Hence there is no need to fetch again to access file content. 
  • Can we use Git SDK to programmatically access n and n-1 file contents in a commit ?

I don't  know which SDK you are referring to. EGit is based on JGit API [1]. 
  • What are the max size lengths for GIT repo URL, COMMIT ID and COMMIT MESSAGE ?

 JGit and EGit do not limit the size of url and commit message but your git server may have limits.
So far commitIds are fixed size SHA1 hashes. This may change when the migration to SHA-256 [2] lands in native git. 
  • Also we wanted to know if we could enable reviewing of GIT changes before they are committed by picking them from the local author workspace. In RTC this was possible as the users outgoing changesets could be read from the users repository workspace on the server even if it was not delivered. We do not find a way to achieve this in GIT. Do you have any suggestions on this?

Again git is a distributed versioning system where you don't have access to the local workspace of an author.
The usual way to implement code review with git is to create a commit in a user's local clone and share it via
git transport to another git repository (or send it via email as linux does) most often this repository is a server
which is always available but also peer to peer scenarios should be possible if you can establish a connection.
Examples for code review on commits in a central git repository are github, gitlab, gerrit code review.
Will I be able to achieve all the desired Git functionalities from

no, this is a github API supporting the  proprietary Github REST API which isn't supported by other git server implementations.
Typically such tasks are implemented on a local clone of the repository you are interested in. Since  git is a distributed and not
a centralized versioning system.  If you want to do this in Java use JGit.

egit-dev mailing list
To unsubscribe from this list, visit

Back to the top