So, based on this thread about an issue with some GitHub repositories and SVN, I made an off-hand comment about implementing JGit.
People responded, so I tried it.
It turns out it's pretty easy, but also complex.
I added the latest version of eclipse JGit and dependencies (sfl4j, ugh), and it worked! or sort of.
I have one problem and a few design questions:
People responded, so I tried it.
It turns out it's pretty easy, but also complex.
I added the latest version of eclipse JGit and dependencies (sfl4j, ugh), and it worked! or sort of.
Java:
try ( Git result = Git.cloneRepository()
.setURI( REMOTE_URL )
.setDirectory( localPath )
//.setProgressMonitor( new SimpleProgressMonitor() )
.call() )
{
// Note: the call() returns an opened repository already which needs to be closed to avoid file handle leaks!
// I assume that try with resources will solve that...
System.out.println( "Created repository: " + result.getRepository().getDirectory() );
}
catch (GitAPIException ex )
{
System.out.println("Error" + ex );
}
I have one problem and a few design questions:
- (problem): git does not honor subdirectory matches. I can see documentation for various command line GIT clients on how to set parameters around depth and filters and sparseness, but I don't know what I'm doing and don't even really speak the lingo. Some expert help would be, err, helpful.
- (question): What commands do we need? I only implemented "clone". delete probably doesn't call JGit at all, but the equivalents of list and update are required, I assume.
- (question): Do we follow the same SVN checkout/sync model we are doing in SVN? Or do we use this to experiment with some of the other design patterns we've talked about?
- (question): Do we put these scripts into the ScriptManager, or maybe later, or no?