blob: c0e44778faca28c820bf2f790bc1d6e45c7b1373 [file] [log] [blame] [view]
Mike Frysingerb4687ad2020-02-07 19:44:53 -05001# Repo internal filesystem layout
2
3A reference to the `.repo/` tree in repo client checkouts.
4Hopefully it's complete & up-to-date, but who knows!
5
6*** note
7**Warning**:
8This is meant for developers of the repo project itself as a quick reference.
9**Nothing** in here must be construed as ABI, or that repo itself will never
10change its internals in backwards incompatible ways.
11***
12
13[TOC]
14
15## .repo/ layout
16
17All content under `.repo/` is managed by `repo` itself with few exceptions.
18
19In general, you should not make manual changes in here.
20If a setting was initialized using an option to `repo init`, you should use that
21command to change the setting later on.
22It is always safe to re-run `repo init` in existing repo client checkouts.
23For example, if you want to change the manifest branch, you can simply run
24`repo init --manifest-branch=<new name>` and repo will take care of the rest.
25
Mike Frysingerf841ca42020-02-18 21:31:51 -050026* `config`: Per-repo client checkout settings using [git-config] file format.
27* `.repo_config.json`: JSON cache of the `config` file for repo to
28 read/process quickly.
29
Mike Frysingerb4687ad2020-02-07 19:44:53 -050030### repo/ state
31
32* `repo/`: A git checkout of the repo project. This is how `repo` re-execs
33 itself to get the latest released version.
34
35 It tracks the git repository at `REPO_URL` using the `REPO_REV` branch.
36 Those are specified at `repo init` time using the `--repo-url=<REPO_URL>`
Mike Frysinger58ac1672020-03-14 14:35:26 -040037 and `--repo-rev=<REPO_REV>` options.
Mike Frysingerb4687ad2020-02-07 19:44:53 -050038
39 Any changes made to this directory will usually be automatically discarded
40 by repo itself when it checks for updates. If you want to update to the
41 latest version of repo, use `repo selfupdate` instead. If you want to
42 change the git URL/branch that this tracks, re-run `repo init` with the new
43 settings.
44
Gavin Mak11cb9602023-08-16 22:06:25 +000045* `.repo_fetchtimes.json`: Used by `repo sync` to record fetch times when
46 syncing the various projects.
47
48* `.repo_localsyncstate.json`: Used by `repo sync` to detect and warn on
49 on partial tree syncs. Partial syncs are allowed by `repo` itself, but are
50 unsupported by many projects where `repo` is used.
Mike Frysingerb4687ad2020-02-07 19:44:53 -050051
52### Manifests
53
54For more documentation on the manifest format, including the local_manifests
55support, see the [manifest-format.md] file.
56
LaMont Jonescc879a92021-11-18 22:40:18 +000057* `submanifests/{submanifest.path}/`: The path prefix to the manifest state of
58 a submanifest included in a multi-manifest checkout. The outermost manifest
59 manifest state is found adjacent to `submanifests/`.
60
Mike Frysingerb4687ad2020-02-07 19:44:53 -050061* `manifests/`: A git checkout of the manifest project. Its `.git/` state
62 points to the `manifest.git` bare checkout (see below). It tracks the git
63 branch specified at `repo init` time via `--manifest-branch`.
64
65 The local branch name is always `default` regardless of the remote tracking
66 branch. Do not get confused if the remote branch is not `default`, or if
67 there is a remote `default` that is completely different!
68
69 No manual changes should be made in here as it will just confuse repo and
70 it won't automatically recover causing no new changes to be picked up.
71
72* `manifests.git/`: A bare checkout of the manifest project. It tracks the
73 git repository specified at `repo init` time via `--manifest-url`.
74
75 No manual changes should be made in here as it will just confuse repo.
76 If you want to switch the tracking settings, re-run `repo init` with the
77 new settings.
78
Mike Frysingera269b1c2020-02-21 00:49:41 -050079* `manifest.xml`: The manifest that repo uses. It is generated at `repo init`
80 and uses the `--manifest-name` to determine what manifest file to load next
81 out of `manifests/`.
82
83 Do not try to modify this to load other manifests as it will confuse repo.
84 If you want to switch manifest files, re-run `repo init` with the new
85 setting.
86
87 Older versions of repo managed this with symlinks.
88
Mike Frysingerb4687ad2020-02-07 19:44:53 -050089* `manifest.xml -> manifests/<manifest-name>.xml`: A symlink to the manifest
90 that the user wishes to sync. It is specified at `repo init` time via
91 `--manifest-name`.
92
Mike Frysingerb4687ad2020-02-07 19:44:53 -050093
94* `manifests.git/.repo_config.json`: JSON cache of the `manifests.git/config`
95 file for repo to read/process quickly.
96
97* `local_manifest.xml` (*Deprecated*): User-authored tweaks to the manifest
98 used to sync. See [local manifests] for more details.
99* `local_manifests/`: Directory of user-authored manifest fragments to tweak
100 the manifest used to sync. See [local manifests] for more details.
101
102### Project objects
103
Mike Frysinger6db40972021-02-25 03:13:31 -0500104*** note
105**Warning**: Please do not use repo's approach to projects/ & project-objects/
106layouts as a model for other tools to implement similar approaches.
107It has a number of known downsides like:
108* [Symlinks do not work well under Windows](./windows.md).
109* Git sometimes replaces symlinks under .git/ with real files (under unknown
110 circumstances), and then the internal state gets out of sync, and data loss
111 may ensue.
112* When sharing project-objects between multiple project checkouts, Git might
113 automatically run `gc` or `prune` which may lead to data loss or corruption
114 (since those operate on leaf projects and miss refs in other leaves). See
115 https://gerrit-review.googlesource.com/c/git-repo/+/254392 for more details.
116
117Instead, you should use standard Git workflows like [git worktree] or
118[gitsubmodules] with [superprojects].
119***
120
jiajia tanga590e642021-04-25 20:02:02 +0800121* `copy-link-files.json`: Tracking file used by `repo sync` to determine when
122 copyfile or linkfile are added or removed and need corresponding updates.
Mike Frysingerb4687ad2020-02-07 19:44:53 -0500123* `project.list`: Tracking file used by `repo sync` to determine when projects
124 are added or removed and need corresponding updates in the checkout.
125* `projects/`: Bare checkouts of every project synced by the manifest. The
126 filesystem layout matches the `<project path=...` setting in the manifest
127 (i.e. where it's checked out in the repo client source tree). Those
128 checkouts will symlink their `.git/` state to paths under here.
129
130 Some git state is further split out under `project-objects/`.
131* `project-objects/`: Git objects that are safe to share across multiple
132 git checkouts. The filesystem layout matches the `<project name=...`
Mike Frysinger0334b8c2020-02-19 15:47:46 -0500133 setting in the manifest (i.e. the path on the remote server) with a `.git`
134 suffix. This allows for multiple checkouts of the same remote git repo to
135 share their objects. For example, you could have different branches of
Mike Frysinger6e89c962020-11-15 18:42:26 -0500136 `foo/bar.git` checked out to `foo/bar-main`, `foo/bar-release`, etc...
Mike Frysinger0334b8c2020-02-19 15:47:46 -0500137 There will be multiple trees under `projects/` for each one, but only one
138 under `project-objects/`.
Mike Frysingerb4687ad2020-02-07 19:44:53 -0500139
Mike Frysinger0334b8c2020-02-19 15:47:46 -0500140 This layout is designed to allow people to sync against different remotes
141 (e.g. a local mirror & a public review server) while avoiding duplicating
142 the content. However, this can run into problems if different remotes use
143 the same path on their respective servers. Best to avoid that.
Kaushik Lingarkarcf9a2a22024-12-17 12:49:14 -0800144* `modules/`: Like `projects/`, but for git submodules.
Mike Frysingerb4687ad2020-02-07 19:44:53 -0500145* `subproject-objects/`: Like `project-objects/`, but for git submodules.
Mike Frysinger979d5bd2020-02-09 02:28:34 -0500146* `worktrees/`: Bare checkouts of every project synced by the manifest. The
147 filesystem layout matches the `<project name=...` setting in the manifest
Mike Frysinger0334b8c2020-02-19 15:47:46 -0500148 (i.e. the path on the remote server) with a `.git` suffix. This has the
149 same advantages as the `project-objects/` layout above.
Mike Frysinger979d5bd2020-02-09 02:28:34 -0500150
Mike Frysinger6db40972021-02-25 03:13:31 -0500151 This is used when [git worktree]'s are enabled.
Mike Frysingerb4687ad2020-02-07 19:44:53 -0500152
Mike Frysinger02585842020-02-18 19:01:45 -0500153### Global settings
Mike Frysinger09dd9bd2020-02-09 02:27:54 -0500154
155The `.repo/manifests.git/config` file is used to track settings for the entire
156repo client checkout.
Raman Tenneti7954de12021-07-28 14:36:49 -0700157
Mike Frysinger09dd9bd2020-02-09 02:27:54 -0500158Most settings use the `[repo]` section to avoid conflicts with git.
Raman Tenneti7954de12021-07-28 14:36:49 -0700159
160Everything under `[repo.syncstate.*]` is used to keep track of sync details for logging
161purposes.
162
Mike Frysinger09dd9bd2020-02-09 02:27:54 -0500163User controlled settings are initialized when running `repo init`.
164
Raman Tennetif32f2432021-04-12 20:57:25 -0700165| Setting | `repo init` Option | Use/Meaning |
166|------------------- |---------------------------|-------------|
167| manifest.groups | `--groups` & `--platform` | The manifest groups to sync |
Jack Neusc474c9c2021-07-26 23:08:54 +0000168| manifest.standalone | `--standalone-manifest` | Download manifest as static file instead of creating checkout |
Raman Tennetif32f2432021-04-12 20:57:25 -0700169| repo.archive | `--archive` | Use `git archive` for checkouts |
170| repo.clonebundle | `--clone-bundle` | Whether the initial sync used clone.bundle explicitly |
171| repo.clonefilter | `--clone-filter` | Filter setting when using [partial git clones] |
172| repo.depth | `--depth` | Create shallow checkouts when cloning |
173| repo.dissociate | `--dissociate` | Dissociate from any reference/mirrors after initial clone |
XD Trol630876f2022-01-17 23:29:04 +0800174| repo.git-lfs | `--git-lfs` | Enable [Git LFS] support |
Raman Tennetif32f2432021-04-12 20:57:25 -0700175| repo.mirror | `--mirror` | Checkout is a repo mirror |
176| repo.partialclone | `--partial-clone` | Create [partial git clones] |
177| repo.partialcloneexclude | `--partial-clone-exclude` | Comma-delimited list of project names (not paths) to exclude while using [partial git clones] |
178| repo.reference | `--reference` | Reference repo client checkout |
179| repo.submodules | `--submodules` | Sync git submodules |
180| repo.superproject | `--use-superproject` | Sync [superproject] |
181| repo.worktree | `--worktree` | Use [git worktree] for checkouts |
182| user.email | `--config-name` | User's e-mail address; Copied into `.git/config` when checking out a new project |
183| user.name | `--config-name` | User's name; Copied into `.git/config` when checking out a new project |
Mike Frysinger09dd9bd2020-02-09 02:27:54 -0500184
185[partial git clones]: https://git-scm.com/docs/gitrepository-layout#_code_partialclone_code
Raman Tenneti21dce3d2021-02-09 00:26:31 -0800186[superproject]: https://en.wikibooks.org/wiki/Git/Submodules_and_Superprojects
Mike Frysinger09dd9bd2020-02-09 02:27:54 -0500187
Mike Frysinger02585842020-02-18 19:01:45 -0500188### Repo hooks settings
189
190For more details on this feature, see the [repo-hooks docs](./repo-hooks.md).
191We'll just discuss the internal configuration settings.
192These are stored in the registered `<repo-hooks>` project itself, so if the
193manifest switches to a different project, the settings will not be copied.
194
195| Setting | Use/Meaning |
196|--------------------------------------|-------------|
197| repo.hooks.\<hook\>.approvedmanifest | User approval for secure manifest sources (e.g. https://) |
198| repo.hooks.\<hook\>.approvedhash | User approval for insecure manifest sources (e.g. http://) |
199
200
201For example, if our manifest had the following entries, we would store settings
202under `.repo/projects/src/repohooks.git/config` (which would be reachable via
203`git --git-dir=src/repohooks/.git config`).
204```xml
205 <project path="src/repohooks" name="chromiumos/repohooks" ... />
206 <repo-hooks in-project="chromiumos/repohooks" ... />
207```
208
209If `<hook>` is `pre-upload`, the `.git/config` setting might be:
210```ini
211[repo "hooks.pre-upload"]
212 approvedmanifest = https://chromium.googlesource.com/chromiumos/manifest
213```
214
215## Per-project settings
216
217These settings are somewhat meant to be tweaked by the user on a per-project
218basis (e.g. `git config` in a checked out source repo).
219
220Where possible, we re-use standard git settings to avoid confusion, and we
221refrain from documenting those, so see [git-config] documentation instead.
222
223See `repo help upload` for documentation on `[review]` settings.
224
225The `[remote]` settings are automatically populated/updated from the manifest.
226
227The `[branch]` settings are updated by `repo start` and `git branch`.
228
David Greenawayd98f3932022-12-09 09:38:24 +1100229| Setting | Subcommands | Use/Meaning |
230|---------------------------------------|---------------|-------------|
231| review.\<url\>.autocopy | upload | Automatically add to `--cc=<value>` |
232| review.\<url\>.autoreviewer | upload | Automatically add to `--reviewers=<value>` |
233| review.\<url\>.autoupload | upload | Automatically answer "yes" or "no" to all prompts |
234| review.\<url\>.uploadhashtags | upload | Automatically add to `--hashtag=<value>` |
235| review.\<url\>.uploadlabels | upload | Automatically add to `--label=<value>` |
236| review.\<url\>.uploadnotify | upload | [Notify setting][upload-notify] to use |
237| review.\<url\>.uploadtopic | upload | Default [topic] to use |
238| review.\<url\>.uploadwarningthreshold | upload | Warn when attempting to upload more than this many CLs |
239| review.\<url\>.username | upload | Override username with `ssh://` review URIs |
240| remote.\<remote\>.fetch | sync | Set of refs to fetch |
241| remote.\<remote\>.projectname | \<network\> | The name of the project as it exists in Gerrit review |
242| remote.\<remote\>.pushurl | upload | The base URI for pushing CLs |
243| remote.\<remote\>.review | upload | The URI of the Gerrit review server |
244| remote.\<remote\>.url | sync & upload | The URI of the git project to fetch |
245| branch.\<branch\>.merge | sync & upload | The branch to merge & upload & track |
246| branch.\<branch\>.remote | sync & upload | The remote to track |
Mike Frysinger02585842020-02-18 19:01:45 -0500247
Mike Frysingerb4687ad2020-02-07 19:44:53 -0500248## ~/ dotconfig layout
249
Gavin Mak7e3b65b2023-01-26 23:27:51 +0000250Repo will create & maintain a few files under the `.repoconfig/` directory.
251This is placed in the user's home directory by default but can be changed by
252setting `REPO_CONFIG_DIR`.
Mike Frysingerb4687ad2020-02-07 19:44:53 -0500253
254* `.repoconfig/`: Repo's per-user directory for all random config files/state.
Mike Frysingerf841ca42020-02-18 21:31:51 -0500255* `.repoconfig/config`: Per-user settings using [git-config] file format.
Mike Frysingerb4687ad2020-02-07 19:44:53 -0500256* `.repoconfig/keyring-version`: Cache file for checking if the gnupg subdir
257 has all the same keys as the repo launcher. Used to avoid running gpg
258 constantly as that can be quite slow.
259* `.repoconfig/gnupg/`: GnuPG's internal state directory used when repo needs
260 to run `gpg`. This provides isolation from the user's normal `~/.gnupg/`.
261
Mike Frysingerf841ca42020-02-18 21:31:51 -0500262* `.repoconfig/.repo_config.json`: JSON cache of the `.repoconfig/config`
263 file for repo to read/process quickly.
Mike Frysingerb4687ad2020-02-07 19:44:53 -0500264* `.repo_.gitconfig.json`: JSON cache of the `.gitconfig` file for repo to
265 read/process quickly.
266
267
Mike Frysinger02585842020-02-18 19:01:45 -0500268[git-config]: https://git-scm.com/docs/git-config
XD Trol630876f2022-01-17 23:29:04 +0800269[Git LFS]: https://git-lfs.github.com/
Mike Frysinger6db40972021-02-25 03:13:31 -0500270[git worktree]: https://git-scm.com/docs/git-worktree
271[gitsubmodules]: https://git-scm.com/docs/gitsubmodules
Mike Frysingerb4687ad2020-02-07 19:44:53 -0500272[manifest-format.md]: ./manifest-format.md
273[local manifests]: ./manifest-format.md#Local-Manifests
Mike Frysinger6db40972021-02-25 03:13:31 -0500274[superprojects]: https://en.wikibooks.org/wiki/Git/Submodules_and_Superprojects
Mike Frysinger02585842020-02-18 19:01:45 -0500275[topic]: https://gerrit-review.googlesource.com/Documentation/intro-user.html#topics
Mike Frysingerf725e542020-03-14 17:39:03 -0400276[upload-notify]: https://gerrit-review.googlesource.com/Documentation/user-upload.html#notify