Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit » Creating a new commit entirely from memory, programmatically(Creating a new commit entirely from memory, programmatically)
Creating a new commit entirely from memory, programmatically [message #1220803] Fri, 13 December 2013 12:27 Go to next message
Laurent Petit is currently offline Laurent Petit
Messages: 21
Registered: December 2010
Junior Member
Hello,

We are basing our web application persistence on JGit.

We are already walking Commits and Trees programmatically to provide read-only views without a working copy on disk.

We'd also like to provide "save" transactions in our application by creating new commits based off the previous ones programmatically, and without working copy on disk either.

If you can give me some guidance on how to do that, that would be very welcome.

Right now I'm aware that I can resolve the HEAD commit object id, from them get the Tree, go down to the Blob, modify the blob, and then recreate new Blob & new Tree up to a new root Tree, and then create a commit.

I've seen some utility classes like DirCacheBuilder / DirCacheEditor, but they seem to touch the filesystem at some times, unless I'm mistaken ?

Are there any utility methods inside JGit (or provided by third-party libraries ?) to manipulate Trees and create new commits without filesystem working copy ?

Cheers,

--
Laurent Petit

[Updated on: Fri, 13 December 2013 12:28]

Report message to a moderator

Re: Creating a new commit entirely from memory, programmatically [message #1220870 is a reply to message #1220803] Sat, 14 December 2013 17:38 Go to previous message
Matthias Sohn is currently offline Matthias Sohn
Messages: 546
Registered: July 2009
Senior Member
Have a look at Gerrit's VersionedMetaData class
https://gerrit.googlesource.com/gerrit/+/82d69e1f80cbea9888ab12b375b13069e2a4a712/gerrit-server/src/main/java/com/google/gerrit/server/git/VersionedMetaData.java
I think it's doing something similar to what you want to achieve.
It's using DirCache.newInCore() to create an in-memory DirCache
Previous Topic:How can I install EGIT offline?
Next Topic:eGit URL http://download.eclipse.org/egit/updates doesn't have any repository.
Goto Forum:
  


Current Time: Wed Jul 30 05:22:03 EDT 2014

Powered by FUDForum. Page generated in 0.01850 seconds