1Shallow commits 2=============== 3 4.Definition 5********************************************************* 6Shallow commits do have parents, but not in the shallow 7repo, and therefore grafts are introduced pretending that 8these commits have no parents. 9********************************************************* 10 11$GIT_DIR/shallow lists commit object names and tells Git to 12pretend as if they are root commits (e.g. "git log" traversal 13stops after showing them; "git fsck" does not complain saying 14the commits listed on their "parent" lines do not exist). 15 16Each line contains exactly one SHA-1. When read, a commit_graft 17will be constructed, which has nr_parent < 0 to make it easier 18to discern from user provided grafts. 19 20Since fsck-objects relies on the library to read the objects, 21it honours shallow commits automatically. 22 23There are some unfinished ends of the whole shallow business: 24 25- maybe we have to force non-thin packs when fetching into a 26 shallow repo (ATM they are forced non-thin). 27 28- A special handling of a shallow upstream is needed. At some 29 stage, upload-pack has to check if it sends a shallow commit, 30 and it should send that information early (or fail, if the 31 client does not support shallow repositories). There is no 32 support at all for this in this patch series. 33 34- Instead of locking $GIT_DIR/shallow at the start, just 35 the timestamp of it is noted, and when it comes to writing it, 36 a check is performed if the mtime is still the same, dying if 37 it is not. 38 39- It is unclear how "push into/from a shallow repo" should behave. 40 41- If you deepen a history, you'd want to get the tags of the 42 newly stored (but older!) commits. This does not work right now. 43 44To make a shallow clone, you can call "git-clone --depth 20 repo". 45The result contains only commit chains with a length of at most 20. 46It also writes an appropriate $GIT_DIR/shallow. 47 48You can deepen a shallow repository with "git-fetch --depth 20 49repo branch", which will fetch branch from repo, but stop at depth 5020, updating $GIT_DIR/shallow. 51 52The special depth 2147483647 (or 0x7fffffff, the largest positive 53number a signed 32-bit integer can contain) means infinite depth.