5 *********************************************************
6 Shallow commits do have parents, but not in the shallow
7 repo, and therefore grafts are introduced pretending that
8 these commits have no parents.
9 *********************************************************
11 The basic idea is to write the SHA1s of shallow commits into
12 $GIT_DIR/shallow, and handle its contents like the contents
13 of $GIT_DIR/info/grafts (with the difference that shallow
14 cannot contain parent information).
16 This information is stored in a new file instead of grafts, or
17 even the config, since the user should not touch that file
18 at all (even throughout development of the shallow clone, it
19 was never manually edited!).
21 Each line contains exactly one SHA1. When read, a commit_graft
22 will be constructed, which has nr_parent < 0 to make it easier
23 to discern from user provided grafts.
25 Since fsck-objects relies on the library to read the objects,
26 it honours shallow commits automatically.
28 There are some unfinished ends of the whole shallow business:
30 - maybe we have to force non-thin packs when fetching into a
31 shallow repo (ATM they are forced non-thin).
33 - A special handling of a shallow upstream is needed. At some
34 stage, upload-pack has to check if it sends a shallow commit,
35 and it should send that information early (or fail, if the
36 client does not support shallow repositories). There is no
37 support at all for this in this patch series.
39 - Instead of locking $GIT_DIR/shallow at the start, just
40 the timestamp of it is noted, and when it comes to writing it,
41 a check is performed if the mtime is still the same, dying if
44 - It is unclear how "push into/from a shallow repo" should behave.
46 - If you deepen a history, you'd want to get the tags of the
47 newly stored (but older!) commits. This does not work right now.
49 To make a shallow clone, you can call "git-clone --depth 20 repo".
50 The result contains only commit chains with a length of at most 20.
51 It also writes an appropriate $GIT_DIR/shallow.
53 You can deepen a shallow repository with "git-fetch --depth 20
54 repo branch", which will fetch branch from repo, but stop at depth
55 20, updating $GIT_DIR/shallow.