[PATCH 00/16] Subtree clone proof of concept
- From
Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
- Date
- Jul 31, 2010, 16:18 UTC
- Message-ID
- <1280593105-22015-1-git-send-email-pclouds@gmail.com>
Something to play with so we can evaluate which is the best strategy for non-full clone (or whatever you call it).
The idea is the same: pack only enough to access a subtree, rewrite commits at client side, rewrite again when pushing. However I put git-replace into the mix, so at least commit SHA-1 looks as same as from upstream. git-subtree is not needed (although it's still an option)
With this, I can clone Documentaion/ from git.git, update and push. I haven't tested it further. Space consumption is 24MB (58MB for full repo). Not really impressive, but if one truely cares about disk space, he/she should also use shallow clone.
Performance is impacted, due to bulk commit replacement. There is a split second delay for every command. It's the price of replacing 24k commits every time. I think the delay could be improved a little bit (caching or mmap..)
Rewriting commits at clone takes time too. Doing individual object writing takes lots of space and time. I put all new objects directly to a pack now. Rewriting time now becomes quite acceptable (a few seconds). Although deep subtree/repo may take longer. Rewriting on demand can be considered in such cases.
Repo-care commands like fsck, repack, gc are left out for now.
Finally, it's more of a hack just to see how far I can go. It will break things.
Nguyễn Thái Ngọc Duy (16):
Add core.subtree
list-objects: limit traversing within the given subtree if
core.subtree is set
parse_object: keep sha1 even when parsing replaced one
Allow to invalidate a commit in in-memory object store
Hook up replace-object to allow bulk commit replacement
upload-pack: use a separate variable to control whether internal
rev-list is used
upload-pack: support subtree pack
fetch-pack: support --subtree
subtree: rewrite incoming commits
clone: support subtree clone with parameter --subtree
pack-objects: add --subtree (for pushing)
subtree: rewriting outgoing commits
Update commit_tree() interface to take base tree too
commit_tree(): rewriting/replacing new commits
commit: rewrite outgoing commits
do not use thin packs and subtree together (just a bad feeling about
this)Makefile | 2 + builtin/clone.c | 10 + builtin/commit-tree.c | 2 +- builtin/commit.c | 4 +- builtin/fetch-pack.c | 8 + builtin/merge.c | 4 +- builtin/notes.c | 2 +- builtin/pack-objects.c | 4 + builtin/send-pack.c | 2 + cache.h | 1 + commit.c | 25 +++- commit.h | 4 +- config.c | 3 + environment.c | 2 + list-objects.c | 23 ++- notes-cache.c | 2 +- object.c | 2 +- replace_object.c | 5 + subtree.c | 534 ++++++++++++++++++++++++++++++++++++++++++++++++ subtree.h | 4 + upload-pack.c | 28 ++- 21 files changed, 651 insertions(+), 20 deletions(-) create mode 100644 subtree.c create mode 100644 subtree.h