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