Skip to content

list-object-filter: introduce depth filter

ZheNing Hu via GitGitGadget git 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 8 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3commit-graph: let commit graph respect commit graftcommit-graph.c+30 -62 replies
2/3list-object-filter: pass traversal_context in filter_init_fnlist-objects-filter.c list-objects-filter.h list-objects.c +1 more+21 -110 replies
3/3list-object-filter: introduce depth filterDocumentation/rev-list-options.txt builtin/clone.c list-objects-filter-options.c +8 more+279 -150 replies

Reviews trailers per patch

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

Read the v1 thread

Cover letter [PATCH 0/3] list-object-filter: introduce depth filter

This patch let partial clone have the similar capabilities of the shallow clone git clone --depth=<depth>.

Disadvantages of git clone --depth=<depth> --filter=blob:none: we must call git fetch --unshallow to lift the shallow clone restriction, it will download all history of current commit.

Disadvantages of git clone --filter=blob:none with git sparse-checkout: The git client needs to send a lot of missing objects' id to the server, this can be very wasteful of network traffic.

Now we can use git clone --filter="depth=<depth>" to omit all commits whose depth is >= <depth>. By this way, we can have the advantages of both shallow clone and partial clone: Limiting the depth of commits, get other objects on demand.

Unfinished business for now:

1. Git fetch has not yet learned the depth filter, if we can solve this problem, we may can have a better "batch fetch" for some needed commits (see [1]).
2. Sometimes we may want to partial clone to avoid automatic downloads missing objects, e.g. when running git log, we might want to have similar results of shallow clone (without commit graft).

[1]:
https://lore.kernel.org/git/[email protected]/

ZheNing Hu (3):
commit-graph: let commit graph respect commit graft
list-object-filter: pass traversal_context in filter_init_fn
list-object-filter: introduce depth filter

 Documentation/rev-list-options.txt  |   6 ++
 builtin/clone.c                     |  10 ++-
 commit-graph.c                      |  36 +++++++--
 list-objects-filter-options.c       |  30 +++++++
 list-objects-filter-options.h       |   6 ++
 list-objects-filter.c               |  78 ++++++++++++++++++-
 list-objects-filter.h               |   2 +
 list-objects.c                      |  10 +--
 list-objects.h                      |   8 ++
 shallow.c                           |  16 ++++
 shallow.h                           |   2 +
 t/t5616-partial-clone.sh            | 116 ++++++++++++++++++++++++++++
 t/t6112-rev-list-filters-objects.sh |  14 ++++
 upload-pack.c                       |  14 ----
 upload-pack.h                       |  14 ++++
 15 files changed, 330 insertions(+), 32 deletions(-)

base-commit: d42b38dfb5edf1a7fddd9542d722f91038407819
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1343%2Fadlternative%2Fzh%2Ffilter_depth-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1343/adlternative/zh/filter_depth-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/1343

Signature · 1 line
gitgitgadget