0

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..?

stephane K
  • 21
  • 4

1 Answers1

2

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.

Robin Green
  • 32,079
  • 16
  • 104
  • 187
  • i'm trying to figure out how to call this git fast-export. should i first have to install JGit ? or i can call it without ? can you please provide me a short example assuming for example that i whant to fetch info from https://code.google.com/p/gitblit/ Thanks in advance.. – stephane K Nov 30 '13 at 15:52
  • `git fast-export` is part of the Git suite; it is nothing to do with JGit. So yes, you can call it without it. To do it in Java you can use `ProcessBuilder`; alternatively, to do it in a bash shell script you can just write `git clone` *repository-url* `; cd` *repository* `; git fast-export` – Robin Green Nov 30 '13 at 16:01