Skip to content

First class shallow clone

Nguyễn Thái Ngọc Duy git 4 versions In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest28 patches 1 replyIn review
  2. v328 patches 18 repliesSuperseded
  3. v216 patches 17 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v17 patches2 repliesSuperseded

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/28transport.h: remove send_pack prototype, already defined in send-pack.htransport.h+0 -60 replies
2/28Replace struct extra_have_objects with struct sha1_arraybuiltin/send-pack.c connect.c remote.h +3 more+14 -220 replies
3/28send-pack: forbid pushing from a shallow repositorybuiltin/send-pack.c+3 -00 replies
4/28clone: prevent --reference to a shallow repositorybuiltin/clone.c+6 -00 replies
5/28Make the sender advertise shallow commits to the receiverDocumentation/technical/pack-protocol.txt builtin/receive-pack.c commit.h +2 more+26 -30 replies
6/28connect.c: teach get_remote_heads to parse "shallow" linesbuiltin/fetch-pack.c builtin/send-pack.c connect.c +3 more+20 -80 replies
7/28shallow.c: extend setup_*_shallow() to accept extra shallow commitscommit.h fetch-pack.c shallow.c +1 more+24 -110 replies
8/28shallow.c: the 8 steps to select new commits for .git/shallowcache.h commit.h shallow.c +1 more+90 -10 replies
9/28shallow.c: steps 6 and 7 to select new commits for .git/shallowcommit.h shallow.c+298 -00 replies
10/28fetch-pack.c: move shallow update code out of fetch_pack()fetch-pack.c+13 -90 replies
11/28fetch-pack.h: one statement per bitfield declarationfetch-pack.h+12 -120 replies
12/28clone: support remote shallow repositorybuiltin/clone.c builtin/fetch-pack.c fetch-pack.c +3 more+71 -70 replies
13/28fetch: support fetching from a shallow repositorybuiltin/fetch.c fetch-pack.c remote.h +2 more+176 -50 replies
14/28upload-pack: make sure deepening preserves shallow rootsDocumentation/fetch-options.txt shallow.c t/t5536-fetch-shallow.sh +1 more+28 -40 replies
15/28fetch: add --update-shallow to accept refs that update .git/shallowDocumentation/fetch-options.txt builtin/fetch.c fetch-pack.c +4 more+79 -10 replies
16/28receive-pack: reorder some code in unpack()builtin/receive-pack.c+30 -400 replies
17/28receive/send-pack: support pushing from a shallow cloneDocumentation/technical/pack-protocol.txt builtin/receive-pack.c builtin/send-pack.c +2 more+146 -110 replies
18/28New var GIT_SHALLOW_FILE to propagate --shallow-file to subprocessescache.h commit.h environment.c +2 more+12 -30 replies
19/28connected.c: add new variant that runs with --shallow-fileconnected.c connected.h+36 -80 replies
20/28receive-pack: allow pushes that update .git/shallowDocumentation/config.txt builtin/receive-pack.c commit.h +2 more+201 -130 replies
21/28send-pack: support pushing to a shallow clonebuiltin/send-pack.c t/t5537-push-shallow.sh transport.c+43 -40 replies
22/28remote-curl: pass ref SHA-1 to fetch-pack as wellbuiltin/fetch-pack.c remote-curl.c+9 -10 replies
23/28Support shallow fetch/clone over smart-httpDocumentation/gitremote-helpers.txt builtin/fetch-pack.c remote-curl.c +3 more+82 -73 replies
24/28receive-pack: support pushing to a shallow clone via httpbuiltin/receive-pack.c t/t5537-push-shallow.sh+35 -30 replies
25/28send-pack: support pushing from a shallow clone via httpbuiltin/send-pack.c send-pack.c t/t5537-push-shallow.sh+42 -50 replies
26/28clone: use git protocol for cloning shallow repo locallybuiltin/clone.c t/t5601-clone.sh+16 -20 replies
27/28prune: clean .git/shallow after pruning objectsDocumentation/git-prune.txt builtin/gc.c builtin/prune.c +3 more+71 -20 replies
28/28git-clone.txt: remove shallow clone limitationsDocumentation/git-clone.txt+1 -60 replies

Reviews trailers per patch

None of the 28 patches has a Reviewed-by or Acked-by.

PatchJeff King
1/28
2/28
3/28
4/28
5/28
6/28
7/28
8/28
9/28
10/28
11/28
12/28
13/28
14/28
15/28
16/28
17/28
18/28
19/28
20/28
21/28
22/28
23/28Noticed-by
24/28
25/28
26/28
27/28
28/28

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v4 thread

Cover letter [PATCH v4 00/28] First class shallow clone

This reroll should fix all comments I have received in v3. I reordered the shallow checks a bit so in common case it should be as cheap as a normal fetch or push. See 08/28 and 20/28 for the big picture. I'm not entirely happy with the hook issue in 20/28, but it looks good enough for me. There are a few XXXes for further improvement, but I'll keep them until this lands.

To recap, this series allows you to clone from a shallow repo, push to or fetch from any shallow repo. Normally it will reject new refs that introduce new shallow boundaries to your repository, so if you're in a full clone, it will always stay a full clone. Use "fetch --update-shallow" or set receive.shallowupdate to accept those refs.

Nguyễn Thái Ngọc Duy (28):
transport.h: remove send_pack prototype, already defined in send-pack.h Replace struct extra_have_objects with struct sha1_array
send-pack: forbid pushing from a shallow repository
clone: prevent --reference to a shallow repository
Make the sender advertise shallow commits to the receiver connect.c: teach get_remote_heads to parse "shallow" lines shallow.c: extend setup_*_shallow() to accept extra shallow commits shallow.c: the 8 steps to select new commits for .git/shallow shallow.c: steps 6 and 7 to select new commits for .git/shallow fetch-pack.c: move shallow update code out of fetch_pack() fetch-pack.h: one statement per bitfield declaration
clone: support remote shallow repository
fetch: support fetching from a shallow repository
upload-pack: make sure deepening preserves shallow roots
fetch: add --update-shallow to accept refs that update .git/shallow
receive-pack: reorder some code in unpack() receive/send-pack: support pushing from a shallow clone
New var GIT_SHALLOW_FILE to propagate --shallow-file to subprocesses connected.c: add new variant that runs with --shallow-file
receive-pack: allow pushes that update .git/shallow
send-pack: support pushing to a shallow clone
remote-curl: pass ref SHA-1 to fetch-pack as well
Support shallow fetch/clone over smart-http
receive-pack: support pushing to a shallow clone via http
send-pack: support pushing from a shallow clone via http
clone: use git protocol for cloning shallow repo locally
prune: clean .git/shallow after pruning objects git-clone.txt: remove shallow clone limitations

 Documentation/config.txt                  |   4 +
 Documentation/fetch-options.txt           |  14 +-
 Documentation/git-clone.txt               |   7 +-
 Documentation/git-prune.txt               |   2 +
 Documentation/gitremote-helpers.txt       |   7 +
 Documentation/technical/pack-protocol.txt |   7 +-
 builtin/clone.c                           |  18 +-
 builtin/fetch-pack.c                      |  23 +-
 builtin/fetch.c                           |  15 +-
 builtin/gc.c                              |   1 +
 builtin/prune.c                           |   4 +
 builtin/receive-pack.c                    | 314 +++++++++++++++----
 builtin/send-pack.c                       |   9 +-
 cache.h                                   |   3 +
 commit.h                                  |  39 ++-
 connect.c                                 |  22 +-
 connected.c                               |  42 ++-
 connected.h                               |   2 +
 environment.c                             |   6 +
 fetch-pack.c                              | 132 +++++++-
 fetch-pack.h                              |  29 +-
 git.c                                     |   2 +-
 remote-curl.c                             |  34 ++-
 remote.h                                  |   9 +-
 send-pack.c                               |  27 +-
 send-pack.h                               |   2 +-
 shallow.c                                 | 486 +++++++++++++++++++++++++++++-
 t/t5304-prune.sh                          |  10 +
 t/t5536-fetch-shallow.sh (new +x)         | 203 +++++++++++++
 t/t5537-push-shallow.sh (new +x)          | 183 +++++++++++
 t/t5601-clone.sh                          |   7 +
 trace.c                                   |   2 +-
 transport-helper.c                        |   6 +
 transport.c                               |  25 +-
 transport.h                               |  16 +-
 upload-pack.c                             |   8 +-
 36 files changed, 1555 insertions(+), 165 deletions(-)
 create mode 100755 t/t5536-fetch-shallow.sh
 create mode 100755 t/t5537-push-shallow.sh
Signature · 1 line
1.8.5.1.25.g8667982