| Mike Frysinger | b4687ad | 2020-02-07 19:44:53 -0500 | [diff] [blame] | 1 | # Repo internal filesystem layout |
| 2 | |
| 3 | A reference to the `.repo/` tree in repo client checkouts. |
| 4 | Hopefully it's complete & up-to-date, but who knows! |
| 5 | |
| 6 | *** note |
| 7 | **Warning**: |
| 8 | This 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 |
| 10 | change its internals in backwards incompatible ways. |
| 11 | *** |
| 12 | |
| 13 | [TOC] |
| 14 | |
| 15 | ## .repo/ layout |
| 16 | |
| 17 | All content under `.repo/` is managed by `repo` itself with few exceptions. |
| 18 | |
| 19 | In general, you should not make manual changes in here. |
| 20 | If a setting was initialized using an option to `repo init`, you should use that |
| 21 | command to change the setting later on. |
| 22 | It is always safe to re-run `repo init` in existing repo client checkouts. |
| 23 | For 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 Frysinger | f841ca4 | 2020-02-18 21:31:51 -0500 | [diff] [blame] | 26 | * `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 Frysinger | b4687ad | 2020-02-07 19:44:53 -0500 | [diff] [blame] | 30 | ### 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 Frysinger | 58ac167 | 2020-03-14 14:35:26 -0400 | [diff] [blame] | 37 | and `--repo-rev=<REPO_REV>` options. |
| Mike Frysinger | b4687ad | 2020-02-07 19:44:53 -0500 | [diff] [blame] | 38 | |
| 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 Mak | 11cb960 | 2023-08-16 22:06:25 +0000 | [diff] [blame] | 45 | * `.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 Frysinger | b4687ad | 2020-02-07 19:44:53 -0500 | [diff] [blame] | 51 | |
| 52 | ### Manifests |
| 53 | |
| 54 | For more documentation on the manifest format, including the local_manifests |
| 55 | support, see the [manifest-format.md] file. |
| 56 | |
| LaMont Jones | cc879a9 | 2021-11-18 22:40:18 +0000 | [diff] [blame] | 57 | * `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 Frysinger | b4687ad | 2020-02-07 19:44:53 -0500 | [diff] [blame] | 61 | * `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 Frysinger | a269b1c | 2020-02-21 00:49:41 -0500 | [diff] [blame] | 79 | * `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 Frysinger | b4687ad | 2020-02-07 19:44:53 -0500 | [diff] [blame] | 89 | * `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 Frysinger | b4687ad | 2020-02-07 19:44:53 -0500 | [diff] [blame] | 93 | |
| 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 Frysinger | 6db4097 | 2021-02-25 03:13:31 -0500 | [diff] [blame] | 104 | *** note |
| 105 | **Warning**: Please do not use repo's approach to projects/ & project-objects/ |
| 106 | layouts as a model for other tools to implement similar approaches. |
| 107 | It 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 | |
| 117 | Instead, you should use standard Git workflows like [git worktree] or |
| 118 | [gitsubmodules] with [superprojects]. |
| 119 | *** |
| 120 | |
| jiajia tang | a590e64 | 2021-04-25 20:02:02 +0800 | [diff] [blame] | 121 | * `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 Frysinger | b4687ad | 2020-02-07 19:44:53 -0500 | [diff] [blame] | 123 | * `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 Frysinger | 0334b8c | 2020-02-19 15:47:46 -0500 | [diff] [blame] | 133 | 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 Frysinger | 6e89c96 | 2020-11-15 18:42:26 -0500 | [diff] [blame] | 136 | `foo/bar.git` checked out to `foo/bar-main`, `foo/bar-release`, etc... |
| Mike Frysinger | 0334b8c | 2020-02-19 15:47:46 -0500 | [diff] [blame] | 137 | There will be multiple trees under `projects/` for each one, but only one |
| 138 | under `project-objects/`. |
| Mike Frysinger | b4687ad | 2020-02-07 19:44:53 -0500 | [diff] [blame] | 139 | |
| Mike Frysinger | 0334b8c | 2020-02-19 15:47:46 -0500 | [diff] [blame] | 140 | 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 Lingarkar | cf9a2a2 | 2024-12-17 12:49:14 -0800 | [diff] [blame] | 144 | * `modules/`: Like `projects/`, but for git submodules. |
| Mike Frysinger | b4687ad | 2020-02-07 19:44:53 -0500 | [diff] [blame] | 145 | * `subproject-objects/`: Like `project-objects/`, but for git submodules. |
| Mike Frysinger | 979d5bd | 2020-02-09 02:28:34 -0500 | [diff] [blame] | 146 | * `worktrees/`: Bare checkouts of every project synced by the manifest. The |
| 147 | filesystem layout matches the `<project name=...` setting in the manifest |
| Mike Frysinger | 0334b8c | 2020-02-19 15:47:46 -0500 | [diff] [blame] | 148 | (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 Frysinger | 979d5bd | 2020-02-09 02:28:34 -0500 | [diff] [blame] | 150 | |
| Mike Frysinger | 6db4097 | 2021-02-25 03:13:31 -0500 | [diff] [blame] | 151 | This is used when [git worktree]'s are enabled. |
| Mike Frysinger | b4687ad | 2020-02-07 19:44:53 -0500 | [diff] [blame] | 152 | |
| Mike Frysinger | 0258584 | 2020-02-18 19:01:45 -0500 | [diff] [blame] | 153 | ### Global settings |
| Mike Frysinger | 09dd9bd | 2020-02-09 02:27:54 -0500 | [diff] [blame] | 154 | |
| 155 | The `.repo/manifests.git/config` file is used to track settings for the entire |
| 156 | repo client checkout. |
| Raman Tenneti | 7954de1 | 2021-07-28 14:36:49 -0700 | [diff] [blame] | 157 | |
| Mike Frysinger | 09dd9bd | 2020-02-09 02:27:54 -0500 | [diff] [blame] | 158 | Most settings use the `[repo]` section to avoid conflicts with git. |
| Raman Tenneti | 7954de1 | 2021-07-28 14:36:49 -0700 | [diff] [blame] | 159 | |
| 160 | Everything under `[repo.syncstate.*]` is used to keep track of sync details for logging |
| 161 | purposes. |
| 162 | |
| Mike Frysinger | 09dd9bd | 2020-02-09 02:27:54 -0500 | [diff] [blame] | 163 | User controlled settings are initialized when running `repo init`. |
| 164 | |
| Raman Tenneti | f32f243 | 2021-04-12 20:57:25 -0700 | [diff] [blame] | 165 | | Setting | `repo init` Option | Use/Meaning | |
| 166 | |------------------- |---------------------------|-------------| |
| 167 | | manifest.groups | `--groups` & `--platform` | The manifest groups to sync | |
| Jack Neus | c474c9c | 2021-07-26 23:08:54 +0000 | [diff] [blame] | 168 | | manifest.standalone | `--standalone-manifest` | Download manifest as static file instead of creating checkout | |
| Raman Tenneti | f32f243 | 2021-04-12 20:57:25 -0700 | [diff] [blame] | 169 | | 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 Trol | 630876f | 2022-01-17 23:29:04 +0800 | [diff] [blame] | 174 | | repo.git-lfs | `--git-lfs` | Enable [Git LFS] support | |
| Raman Tenneti | f32f243 | 2021-04-12 20:57:25 -0700 | [diff] [blame] | 175 | | 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 Frysinger | 09dd9bd | 2020-02-09 02:27:54 -0500 | [diff] [blame] | 184 | |
| 185 | [partial git clones]: https://git-scm.com/docs/gitrepository-layout#_code_partialclone_code |
| Raman Tenneti | 21dce3d | 2021-02-09 00:26:31 -0800 | [diff] [blame] | 186 | [superproject]: https://en.wikibooks.org/wiki/Git/Submodules_and_Superprojects |
| Mike Frysinger | 09dd9bd | 2020-02-09 02:27:54 -0500 | [diff] [blame] | 187 | |
| Mike Frysinger | 0258584 | 2020-02-18 19:01:45 -0500 | [diff] [blame] | 188 | ### Repo hooks settings |
| 189 | |
| 190 | For more details on this feature, see the [repo-hooks docs](./repo-hooks.md). |
| 191 | We'll just discuss the internal configuration settings. |
| 192 | These are stored in the registered `<repo-hooks>` project itself, so if the |
| 193 | manifest 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 | |
| 201 | For example, if our manifest had the following entries, we would store settings |
| 202 | under `.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 | |
| 209 | If `<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 | |
| 217 | These settings are somewhat meant to be tweaked by the user on a per-project |
| 218 | basis (e.g. `git config` in a checked out source repo). |
| 219 | |
| 220 | Where possible, we re-use standard git settings to avoid confusion, and we |
| 221 | refrain from documenting those, so see [git-config] documentation instead. |
| 222 | |
| 223 | See `repo help upload` for documentation on `[review]` settings. |
| 224 | |
| 225 | The `[remote]` settings are automatically populated/updated from the manifest. |
| 226 | |
| 227 | The `[branch]` settings are updated by `repo start` and `git branch`. |
| 228 | |
| David Greenaway | d98f393 | 2022-12-09 09:38:24 +1100 | [diff] [blame] | 229 | | 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 Frysinger | 0258584 | 2020-02-18 19:01:45 -0500 | [diff] [blame] | 247 | |
| Mike Frysinger | b4687ad | 2020-02-07 19:44:53 -0500 | [diff] [blame] | 248 | ## ~/ dotconfig layout |
| 249 | |
| Gavin Mak | 7e3b65b | 2023-01-26 23:27:51 +0000 | [diff] [blame] | 250 | Repo will create & maintain a few files under the `.repoconfig/` directory. |
| 251 | This is placed in the user's home directory by default but can be changed by |
| 252 | setting `REPO_CONFIG_DIR`. |
| Mike Frysinger | b4687ad | 2020-02-07 19:44:53 -0500 | [diff] [blame] | 253 | |
| 254 | * `.repoconfig/`: Repo's per-user directory for all random config files/state. |
| Mike Frysinger | f841ca4 | 2020-02-18 21:31:51 -0500 | [diff] [blame] | 255 | * `.repoconfig/config`: Per-user settings using [git-config] file format. |
| Mike Frysinger | b4687ad | 2020-02-07 19:44:53 -0500 | [diff] [blame] | 256 | * `.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 Frysinger | f841ca4 | 2020-02-18 21:31:51 -0500 | [diff] [blame] | 262 | * `.repoconfig/.repo_config.json`: JSON cache of the `.repoconfig/config` |
| 263 | file for repo to read/process quickly. |
| Mike Frysinger | b4687ad | 2020-02-07 19:44:53 -0500 | [diff] [blame] | 264 | * `.repo_.gitconfig.json`: JSON cache of the `.gitconfig` file for repo to |
| 265 | read/process quickly. |
| 266 | |
| 267 | |
| Mike Frysinger | 0258584 | 2020-02-18 19:01:45 -0500 | [diff] [blame] | 268 | [git-config]: https://git-scm.com/docs/git-config |
| XD Trol | 630876f | 2022-01-17 23:29:04 +0800 | [diff] [blame] | 269 | [Git LFS]: https://git-lfs.github.com/ |
| Mike Frysinger | 6db4097 | 2021-02-25 03:13:31 -0500 | [diff] [blame] | 270 | [git worktree]: https://git-scm.com/docs/git-worktree |
| 271 | [gitsubmodules]: https://git-scm.com/docs/gitsubmodules |
| Mike Frysinger | b4687ad | 2020-02-07 19:44:53 -0500 | [diff] [blame] | 272 | [manifest-format.md]: ./manifest-format.md |
| 273 | [local manifests]: ./manifest-format.md#Local-Manifests |
| Mike Frysinger | 6db4097 | 2021-02-25 03:13:31 -0500 | [diff] [blame] | 274 | [superprojects]: https://en.wikibooks.org/wiki/Git/Submodules_and_Superprojects |
| Mike Frysinger | 0258584 | 2020-02-18 19:01:45 -0500 | [diff] [blame] | 275 | [topic]: https://gerrit-review.googlesource.com/Documentation/intro-user.html#topics |
| Mike Frysinger | f725e54 | 2020-03-14 17:39:03 -0400 | [diff] [blame] | 276 | [upload-notify]: https://gerrit-review.googlesource.com/Documentation/user-upload.html#notify |