Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jgit-dev] commit to bare from DirCache.newInCore
  • From: Max Gärber <max@xxxxxxxxxxx>
  • Date: Sat, 22 Dec 2018 14:32:46 +0100
  • Autocrypt: addr=max@xxxxxxxxxxx; keydata= xsBNBFtQWvwBCACf2mUZNBAaBhthIGJ9qtiCBRUtjk9guo6cMT6xuRN6dnzzG5gzmlCxMCAN LJ4MTcxtoYyYvDXMAfmZDhamEru4LE2LSoMlr5swU4OKOx0UVhBY+VqhEAjwz5+dzIrKlvrp mJ/4Hf5dCv9F1TOorDq4lecDdoHMgbmL6uZVYQsUDrublV/8mKLt6aPneCjQ9r3qwfh6Byf2 DNkLPeHDv5Dm4DUZ68Y/p5FJDboGvkxVlquStD03TREpHxemppjsp4m+SAcFe+0FoTMbVGQg vI3aEF5jesFp+Of2ezVgDwwZGPgrAaSgyqAGhHJEvwQ+kkhVXo1dofVwGWq6+sLyXahVABEB AAHNIE1heCBHw6RyYmVyIDxnYWVyYmVyQGF4eGVwdGEuZGU+wsCUBBMBCAA+FiEEIOGd2dV6 3CbhLlSIR3dmnBxEeykFAltQWv4CGwMFCQHhM4AFCwkIBwIGFQoJCAsCBBYCAwECHgECF4AA CgkQR3dmnBxEeyk0KQf/cC/AbuT3wHylCmGl2gLFUFRyznOG0d/X1DHFzSCIFM68Vt7rt2Pr illfifuMeLc1/bCO11Ny+Dv7cyBlG+0jUsGK4G5svMfKP86ayDCd22M61oVsWTEowQOzgu2K rJtEHKwB7xSu9OblkUs587Jljp1AN+t0p81a4zM9aELTeTPEocENIwWultf+RN0hOglAw1Om NB/BCYurphSMKMmt4Ymrd0M2MTT8gh+d1t47/bgsJTLxniMjQi/uIxfRkisLF+oFmPyOayVg ROXL+crcl9+6FN9arbmGqCzWTIF0QDTq7qN/uQOqcIOIQ8ZzBZHnAPYKTvr2dLy2ElUeJD2V xM7ATQRbUFr8AQgA0D8zZ2/tN5ZvK0WjJKgRYtbHBy15wQlzDexMXAKDWduq3Mb5JVOBPyzy D5EKk3vzZ7zP6p+2nY2LCfGuSUmYJn84NjcS4NzSFJ1aO/bHdCHKOftFVLT6MJOxtSBkbX92 dfGi0Eu879vD4HlGLlqZeeiHNve1IuoDsAcMiSCvbM1lHl+A5iimwc56tcl+ZSTb4oiku6gt 5/DKjQfhdLhOsxTY0cXbhZmeFpeq5/tvLaLrhNcsoCsjShMyQOlD5jPgkYTiRQnVOGi+QZEA 4IIgJb+kOZkS8Jle6D7fqFyhGA3f5lwpNn+DI2JBylxN2TOOlGaY87omML6tZ40TORioVQAR AQABwsB8BBgBCAAmFiEEIOGd2dV63CbhLlSIR3dmnBxEeykFAltQWvwCGwwFCQHhM4AACgkQ R3dmnBxEeykQKAgAllaBjzuilS9mX9Ze09PVSucQ6nuhXpnlV96P6wCyHGA1EIL7KtEHmU8y 9MMCreQ6Eg6poifspnQzZBiIikLeFTVBqU1ay/fu1YocU4QJbe7e8PY/etBRU+Yx3aNmKw4b sFwXkRVz9xaemGQHYN0zdUhR9PdUcus15iLqv90oG9L+LzCpNNG/z6W6W1RAQoHb4giM2kmB tnOo2D2zbAIZ+riT9rUYDVUFsguixoJEZTI6sM4+OPQrvjv2UkiSIRRRcUc7xrHAUmsj9G+D 6LDceeNem36Hq5AqAqtXgtUTZqQ3wIiUMA0e2GHUrAaeGVFdNP1GjRGT5csGKMc7f9YTXA==
  • Delivered-to: jgit-dev@xxxxxxxxxxx
  • List-archive: <https://www.eclipse.org/mailman/private/jgit-dev>
  • List-help: <mailto:jgit-dev-request@eclipse.org?subject=help>
  • List-subscribe: <https://www.eclipse.org/mailman/listinfo/jgit-dev>, <mailto:jgit-dev-request@eclipse.org?subject=subscribe>
  • List-unsubscribe: <https://www.eclipse.org/mailman/options/jgit-dev>, <mailto:jgit-dev-request@eclipse.org?subject=unsubscribe>
  • Openpgp: preference=signencrypt
  • User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1

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


Back to the top