Skip to content

Narrow clone v3 (was subtree clone)

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 Latest17 patches 7 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/17rev-list: do not do commit simplification if simplify_history = 0builtin/pack-objects.c revision.c upload-pack.c+3 -10 replies
2/17tree.c: add path_to_sha1()tree.c tree.h+37 -00 replies
3/17Introduce $GIT_DIR/narrowDocumentation/git-rev-parse.txt Documentation/gitrepository-layout.txt Makefile +6 more+178 -00 replies
4/17index: make narrow index incompatible with older gitcache.h read-cache.c t/t0063-narrow-repo.sh+59 -20 replies
5/17pack-objects: support narrow packs with pathspecsDocumentation/git-pack-objects.txt builtin/pack-objects.c t/t6000-rev-list-misc.sh+26 -30 replies
6/17{fetch,upload}-pack: support narrow repositoryDocumentation/git-fetch-pack.txt Documentation/technical/pack-protocol.txt builtin/fetch-pack.c +1 more+51 -20 replies
7/17unpack-trees: split traverse_trees() code into a separate functionunpack-trees.c+35 -290 replies
8/17unpack-trees: support unpack trees in narrow repositoryt/t1013-read-tree-narrow.sh unpack-trees.c+162 -10 replies
9/17cache-tree: only cache tree within narrow areacache-tree.c+37 -40 replies
10/17get_pathspec(): support narrow pathspec rewriting.gitignore Makefile cache.h +3 more+337 -50 replies
11/17pathspec retrieval fixbuiltin/commit.c builtin/grep.c builtin/ls-files.c +3 more+12 -110 replies
12/17clone: support --narrow optionDocumentation/git-clone.txt builtin/clone.c+56 -10 replies
13/17commit: add narrow's commit_tree versioncommit.c commit.h narrow-tree.c +1 more+126 -00 replies
14/17commit: use commit_narrow_tree() to support narrow repobuiltin/commit.c t/t7510-commit-narrow.sh+39 -10 replies
15/17write-tree: requires --narrow-base in narrow repositorybuiltin/write-tree.c git-am.sh+26 -10 replies
16/17merge: try to do local merge if possible in narrow repoDocumentation/git-merge.txt builtin/merge.c narrow-tree.c +1 more+150 -50 replies
17/17Add narrow clone demonstration testt/t9999-narrow.sh+87 -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/17] Narrow clone v3 (was subtree clone)

I'll describe differences between this series and Elijah's one [1]. I think it's more interesting. Changes from v2 [2] will follow later.

In short I think the two series are converging. The outstanding difference is Elijah drops shallow clone in favor of more flexible history cutting while I only focus on tree cutting.

Two other differences are tree traversal and tree generating. I admit that changing traverse_trees() the way Elijah does is more flexible and is probably the only way to support negative pathspec. And I think his sparse clone supports even cloning a single file. Mine does not support that. I'm going to steal some of his patches at some point.

Tree generating from index, Elijah merges the base tree inside write_cache_as_tree() while it does it inside commit_tree(). Again the principle is pretty much the same. I'll see if I can resist from stealing some more :)

OK, changes from v2:

- Require en/object-list-with-pathspec
- Use lower-case index extension instead of stepping index version to 4
- Support cloning multiple tree
- Remote merge is dropped. It may be resurrected at some point if people like to merge so much.

Things that won't work:

- fsck/prune/...
- Shell scripts that use "git write-tree"

What's next:
- stealing
- fsck (will probably make fsck use rev-list in narrow repo)
- only send commits that have changes in narrow area and graft it at client side

[1] http://mid.gmane.org/[email protected]
[2] http://mid.gmane.org/[email protected]

Nguyễn Thái Ngọc Duy (17):
rev-list: do not do commit simplification if simplify_history = 0 tree.c: add path_to_sha1()
Introduce $GIT_DIR/narrow
index: make narrow index incompatible with older git
pack-objects: support narrow packs with pathspecs {fetch,upload}-pack: support narrow repository
unpack-trees: split traverse_trees() code into a separate function
unpack-trees: support unpack trees in narrow repository
cache-tree: only cache tree within narrow area get_pathspec(): support narrow pathspec rewriting pathspec retrieval fix
clone: support --narrow option
commit: add narrow's commit_tree version
commit: use commit_narrow_tree() to support narrow repo
write-tree: requires --narrow-base in narrow repository
merge: try to do local merge if possible in narrow repo Add narrow clone demonstration test

 .gitignore                                |    1 +
 Documentation/git-clone.txt               |   14 ++-
 Documentation/git-fetch-pack.txt          |    3 +
 Documentation/git-merge.txt               |   16 ++
 Documentation/git-pack-objects.txt        |    2 +-
 Documentation/git-rev-parse.txt           |    3 +
 Documentation/gitrepository-layout.txt    |    5 +
 Documentation/technical/pack-protocol.txt |    3 +
 Makefile                                  |    3 +
 builtin/clone.c                           |   43 +++++
 builtin/commit.c                          |   16 +-
 builtin/fetch-pack.c                      |    9 +
 builtin/grep.c                            |    5 +-
 builtin/ls-files.c                        |    2 +-
 builtin/ls-tree.c                         |    2 +-
 builtin/merge.c                           |   60 ++++++-
 builtin/pack-objects.c                    |   19 ++-
 builtin/reset.c                           |    3 +-
 builtin/rev-parse.c                       |    8 +
 builtin/write-tree.c                      |   25 +++
 cache-tree.c                              |   41 ++++-
 cache.h                                   |    5 +
 commit.c                                  |   16 ++
 commit.h                                  |    5 +
 environment.c                             |    2 +
 git-am.sh                                 |    2 +-
 narrow-tree.c                             |  285 +++++++++++++++++++++++++++++
 narrow-tree.h                             |    8 +
 read-cache.c                              |   32 +++-
 revision.c                                |    7 +-
 setup.c                                   |  172 +++++++++++++++++-
 t/t0062-narrow-pathspec.sh                |  150 +++++++++++++++
 t/t0063-narrow-repo.sh                    |   74 ++++++++
 t/t1013-read-tree-narrow.sh               |   72 ++++++++
 t/t6000-rev-list-misc.sh                  |    9 +
 t/t7510-commit-narrow.sh                  |   30 +++
 t/t9999-narrow.sh                         |   87 +++++++++
 test-get-pathspec.c                       |   17 ++
 tree.c                                    |   35 ++++
 tree.h                                    |    2 +
 unpack-trees.c                            |  153 +++++++++++++---
 upload-pack.c                             |   39 ++++-
 42 files changed, 1420 insertions(+), 65 deletions(-)
 create mode 100644 narrow-tree.c
 create mode 100644 narrow-tree.h
 create mode 100755 t/t0062-narrow-pathspec.sh
 create mode 100755 t/t0063-narrow-repo.sh
 create mode 100755 t/t1013-read-tree-narrow.sh
 create mode 100755 t/t7510-commit-narrow.sh
 create mode 100755 t/t9999-narrow.sh
 create mode 100644 test-get-pathspec.c