Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jgit-dev] jgit NIO

Hello,

I made a branch from 5.2 where I got rid of java.io.File.
I haven't removed public methods with File(s) marking them as deprecated.

The motivation to make a fork was basically desire to use in-memory file system, something like:

FileSystem fs = Jimfs.newFileSystem(Configuration.unix());
Path path = Files.createDirectory(fs.getPath("/myrepo"));
CloneCommand clone = Git.cloneRepository();
clone.setURI(MY_GIT);
clone.setDirectory(path);
clone.setCloneAllBranches(true);
clone.setBranch("refs/heads/master");
Git git = clone.call();
Files.walk(path).forEach(System.out::println);

There are many possible pitfalls and I definitely need a lot of tests:
1. java io rises FileNotFoundException, while nio NoSuchFileException - need to check old (deprecated) APIs because they would rise NoSuchFile. 2. there is a code that run external process from the git directory. for jomfs path.toFile() will fail.
3. double check all attributes - hidden, readonly etc...
4. in many places (locking) jgit uses force() to synchronize with file system. I tried to change it to SYNC, but it's not the same.
5. there is no delete on exit in nio.
6. in the original too many hand parsing with replace('\\', '/') - manual paths parsing... sure this can be done simplier...

Any comments, ideas... code :-) are welcome

Dmitry



Back to the top