Skip to main content



      Home
Home » Eclipse Projects » EGit / JGit » 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
Eclipse UserFriend
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] by 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
Eclipse UserFriend
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 23 13:33:59 EDT 2025

Powered by FUDForum. Page generated in 0.07001 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top