Hi,
thanks, I will have a look!
Original question see below
Br, Max
I am using a strategy taken from Gitblit [1] to commit to a bare
repo.
Essentially, this involves creating the blob object directly and
combining it with existing tree objects [2].
This works fine but I'd like to avoid re-creating the DirCache
for every new insertion. Could I just keep the DirCache and modify
it with DirCacheEditor?
If yes, how would the PathEdit object(s) look like for "insert or
replace"?
Br, Max
[1]
https://github.com/gitblit/gitblit/blob/a13f07850fccfb67c14737f1e09942e31023da66/src/main/java/com/gitblit/tickets/BranchTicketService.java#L309
[2]
DirCache newIndex = DirCache.newInCore();
DirCacheBuilder builder = newIndex.builder();
...
DirCacheEntry idIndexEntry = new DirCacheEntry(file)
idIndexEntry.setObjectId(
//create blob object from file to be referenced by the index
inserter.insert(org.eclipse.jgit.lib.Constants.OBJ_BLOB, content.getBytes("UTF-8")));
builder.add(idIndexEntry);
...
for (DirCacheEntry entry : JGitUtils.getTreeEntries(db, "refs/heads/master", ignorePaths)) {
builder.add(entry);
}
...
ObjectInserter odi = db.newObjectInserter();
ObjectId indexTreeId = index.writeTree(odi);
Am 16.12.2018 um 22:46 schrieb 35V LG84
(eclipse):
Hi Max,
I don't have your original post because I just subscribed, but
there was an question how to commit to bare repository and re-use
dircache or avoiding re-reading it.
There is a prototype of object storage with git, which tries to do
something like that. It borrows ideas from Gerrit.
Prototype in question can be found here:
https://gitlab.com/e257/proto/gitdb
Actual code:
https://gitlab.com/e257/proto/gitdb/blob/master/src/main/java/GitDB.java
All logic is done in Java, but there is scala wrapper around it. I
would like to very much hear what would be the most efficient and
sensible way to write to the bare repositories.
Best regards,
35V LG84
_______________________________________________
jgit-dev mailing list
jgit-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or
unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/jgit-dev