Run Git commands and parse log History from java Program

966 views Asked by At

I am trying to write a java program that should analyse at runtime Log history information of any <<input>> given Git Repository (grab authors, date, path of files, modifications and actions on these files such as Modify Add Delete etc...). But I'm figuring out one main issue :

1: Is it possible to directly execute git commands from my java code maybe using some libraries that will avoid me first need to Clone the repository and execute a git log...?? (a kind of svnKit library for GIT ? )

Note the main goal at the end of this process is to have these Log history informations in a Xml output file - Any library to achieve this ? - Or i would need to parse and build on my own the xml file..?

1

There are 1 answers

2
Robin Green On

You can use JGit; however, JGit will still need to be told to clone the repository.


If you just want the history of a repository as a single file, there is a standard for this, and it's called the git-fast-import file format. You can produce a git-fast-import file for a git repository using the command git fast-export.