Skip to content

Subtree clone proof of concept

Nguyễn Thái Ngọc Duy git 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest16 patches 16 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/16Add core.subtreecache.h config.c environment.c+6 -00 replies
2/16list-objects: limit traversing within the given subtree if core.subtree is setlist-objects.c+17 -64 replies
3/16parse_object: keep sha1 even when parsing replaced oneobject.c+1 -10 replies
4/16Allow to invalidate a commit in in-memory object storecommit.c commit.h+17 -00 replies
5/16Hook up replace-object to allow bulk commit replacementMakefile replace_object.c subtree.c +1 more+126 -02 replies
6/16upload-pack: use a separate variable to control whether internal rev-list is usedupload-pack.c+5 -41 reply
7/16upload-pack: support subtree packupload-pack.c+16 -21 reply
8/16fetch-pack: support --subtreebuiltin/fetch-pack.c+8 -00 replies
9/16subtree: rewrite incoming commitssubtree.c subtree.h+245 -01 reply
10/16clone: support subtree clone with parameter --subtreebuiltin/clone.c+10 -00 replies
11/16pack-objects: add --subtree (for pushing)builtin/pack-objects.c+4 -00 replies
12/16subtree: rewriting outgoing commitssubtree.c subtree.h+174 -01 reply
13/16Update commit_tree() interface to take base tree toobuiltin/commit-tree.c builtin/commit.c builtin/merge.c +4 more+8 -80 replies
14/16commit_tree(): rewriting/replacing new commitscommit.c+8 -00 replies
15/16commit: rewrite outgoing commitsbuiltin/commit.c+3 -10 replies
16/16do not use thin packs and subtree together (just a bad feeling about this)builtin/send-pack.c upload-pack.c+5 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 00/16] Subtree clone proof of concept

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