JGit checkout below project root [message #1842411] |
Thu, 17 June 2021 21:26  |
Eclipse User |
|
|
|
I have a repository that has a RELEASE directory that has code in the very constrained format used by the app it's being incorporated into. I can't fix the restriction, so I'm trying to come up with a JGit solution to use.
The app, which currently uses SVN, is running into some issues with github's SVN proxy, so it's a great time to just stop using SVN to check out git-based projects from GitHub.
svn (should) be able to take the URL (svn checkout https://github.com/Loathing-Associates-Scripting-Society/autoscend/branches/master/RELEASE/) and create a local copy starting at the RELEASE directory.
All I need to do is clone the project, but only
So my first problem is that I don't know how to do that in git. I think it's tied to the --filter command.
And my second is that I don't know how to do that in JGit. Can --filter options be applied to the porcelain "clone" command prior to .call()?
The sample-code-based code I'm using is:
String REMOTE_URL = params;
// should be: "https://github.com/Loathing-Associates-Scripting-Society/autoscend/branches/master/RELEASE/";
if ( !localPath.delete() )
{
// throw new IOException( "Could not delete temporary file " + localPath );
}
// then clone
System.out.println( "Cloning from " + REMOTE_URL + " to " + localPath );
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!
System.out.println( "Having repository: " + result.getRepository().getDirectory() );
}
Thanks for any help or pointers to documentation!
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04556 seconds