diff options
| author | Insaf Latypov <saferif@google.com> | 2026-10-13 15:50:11 +0000 |
|---|---|---|
| committer | gerrit-scoped@luci-project-accounts.iam.gserviceaccount.com <gerrit-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2026-10-19 12:20:06 -0700 |
| commit | 46e9866ca0f161604bd45a0c3b7c7887c9415dcb (patch) | |
| tree | 2f70f0e9b78804ee11f96f427b56066bda5e1e4f /docs | |
| parent | 404aec7b53107a07f29445580f6b5e7a99419757 (diff) | |
| download | git-repo-2.70.tar.gz | |
Add a boolean `sync.smartsync` setting in the per-user repo config
(~/.repoconfig/config):
* true: smart sync by default, as if -s were passed.
* false: never smart sync by default, even if the manifest enables it.
* unset: follow the manifest default, as before.
Add docs/repoconfig.md as the user facing documentation for
~/.repoconfig/config and its settings, and point smart-sync.md and the
`repo sync` help at it.
Bug: 569927750
Test: ./run_tests
Change-Id: Ideb4119fcb5e90f8bb35c493d9e4f8bec7878b77
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/643264
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Insaf Latypov <saferif@google.com>
Tested-by: Insaf Latypov <saferif@google.com>
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/internal-fs-layout.md | 1 | ||||
| -rw-r--r-- | docs/repoconfig.md | 103 | ||||
| -rw-r--r-- | docs/smart-sync.md | 16 |
3 files changed, 120 insertions, 0 deletions
diff --git a/docs/internal-fs-layout.md b/docs/internal-fs-layout.md index ea0070bfb..64fe74cbe 100644 --- a/docs/internal-fs-layout.md +++ b/docs/internal-fs-layout.md | |||
| @@ -253,6 +253,7 @@ setting `REPO_CONFIG_DIR`. | |||
| 253 | 253 | ||
| 254 | * `.repoconfig/`: Repo's per-user directory for all random config files/state. | 254 | * `.repoconfig/`: Repo's per-user directory for all random config files/state. |
| 255 | * `.repoconfig/config`: Per-user settings using [git-config] file format. | 255 | * `.repoconfig/config`: Per-user settings using [git-config] file format. |
| 256 | See [repoconfig.md](./repoconfig.md) for the available settings. | ||
| 256 | * `.repoconfig/keyring-version`: Cache file for checking if the gnupg subdir | 257 | * `.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 | has all the same keys as the repo launcher. Used to avoid running gpg |
| 258 | constantly as that can be quite slow. | 259 | constantly as that can be quite slow. |
diff --git a/docs/repoconfig.md b/docs/repoconfig.md new file mode 100644 index 000000000..aef92fdc6 --- /dev/null +++ b/docs/repoconfig.md | |||
| @@ -0,0 +1,103 @@ | |||
| 1 | # repoconfig: User Configuration | ||
| 2 | |||
| 3 | Repo keeps a small number of settings that apply to the current user rather | ||
| 4 | than to one checkout. They live in the per-user configuration file | ||
| 5 | `~/.repoconfig/config`, which is separate from both git's own `~/.gitconfig` | ||
| 6 | and the per-checkout settings stored in `.repo/manifests.git/config` (see | ||
| 7 | [internal-fs-layout.md](./internal-fs-layout.md#Global-settings) for those). | ||
| 8 | |||
| 9 | [TOC] | ||
| 10 | |||
| 11 | ## Location | ||
| 12 | |||
| 13 | The file is `.repoconfig/config` inside the user's home directory. The parent | ||
| 14 | directory can be changed by setting the `REPO_CONFIG_DIR` environment variable, | ||
| 15 | in which case repo reads `$REPO_CONFIG_DIR/.repoconfig/config` instead. | ||
| 16 | |||
| 17 | The file is created on demand; it's fine for it to be missing. | ||
| 18 | |||
| 19 | ## Format | ||
| 20 | |||
| 21 | The file uses the [git-config] syntax, so it can be edited by hand: | ||
| 22 | |||
| 23 | ```ini | ||
| 24 | [sync] | ||
| 25 | smartsync = true | ||
| 26 | ``` | ||
| 27 | |||
| 28 | or managed with `git config` by pointing it at the file explicitly: | ||
| 29 | |||
| 30 | ```sh | ||
| 31 | # Set a value. | ||
| 32 | git config --file ~/.repoconfig/config sync.smartsync true | ||
| 33 | |||
| 34 | # Read a value. | ||
| 35 | git config --file ~/.repoconfig/config sync.smartsync | ||
| 36 | |||
| 37 | # Remove a value. | ||
| 38 | git config --file ~/.repoconfig/config --unset sync.smartsync | ||
| 39 | ``` | ||
| 40 | |||
| 41 | Boolean settings accept `true`/`yes` and `false`/`no`. | ||
| 42 | |||
| 43 | Repo caches a parsed copy of the file in `.repoconfig/.repo_config.json`; it is | ||
| 44 | refreshed automatically whenever `config` changes and can be safely deleted. | ||
| 45 | |||
| 46 | ## Settings | ||
| 47 | |||
| 48 | ### alias.* | ||
| 49 | |||
| 50 | `alias.<name>` defines `repo <name>` as a shortcut for another subcommand, | ||
| 51 | optionally with arguments, in the same way as git aliases: | ||
| 52 | |||
| 53 | ```ini | ||
| 54 | [alias] | ||
| 55 | ss = sync -s | ||
| 56 | st = status -o | ||
| 57 | ``` | ||
| 58 | |||
| 59 | Aliases defined in a checkout's `.repo/config` take precedence over per-user | ||
| 60 | ones. Existing subcommands cannot be overridden by an alias. | ||
| 61 | |||
| 62 | ### sync | ||
| 63 | |||
| 64 | #### smartsync | ||
| 65 | |||
| 66 | `sync.smartsync` is a boolean that lets a user decide once, for all their | ||
| 67 | checkouts, whether `repo sync` should [Smart Sync](./smart-sync.md) by | ||
| 68 | default: | ||
| 69 | |||
| 70 | ```sh | ||
| 71 | # Always Smart Sync, as if -s/--smart-sync were passed. | ||
| 72 | git config --file ~/.repoconfig/config sync.smartsync true | ||
| 73 | |||
| 74 | # Never Smart Sync by default, even if the manifest sets sync-smartsync="true". | ||
| 75 | git config --file ~/.repoconfig/config sync.smartsync false | ||
| 76 | |||
| 77 | # Remove the preference and go back to following the manifest. | ||
| 78 | git config --file ~/.repoconfig/config --unset sync.smartsync | ||
| 79 | ``` | ||
| 80 | |||
| 81 | The effective behavior is resolved in this order; the first match wins: | ||
| 82 | |||
| 83 | 1. Command line: `-s`/`--smart-sync`, `--no-smart-sync`, or `-t`/`--smart-tag`. | ||
| 84 | 2. User config: `sync.smartsync` in `~/.repoconfig/config`. | ||
| 85 | 3. Manifest: `sync-smartsync="true"` on the `<default>` element. | ||
| 86 | 4. Otherwise, a regular ToT sync. | ||
| 87 | |||
| 88 | So `sync.smartsync=false` turns off the manifest-driven default, but an | ||
| 89 | explicit `repo sync -s`, `repo sync -t TAG` or `repo smartsync` still works. | ||
| 90 | Likewise `sync.smartsync=true` is overridden by `--no-smart-sync`. | ||
| 91 | |||
| 92 | A Smart Sync enabled by `sync.smartsync=true` is treated as an explicit | ||
| 93 | request: it is subject to the same restrictions as `-s` (it is skipped when | ||
| 94 | `-l`/`--local-only`, `-m`/`--manifest-name`, `-t`/`--smart-tag` or | ||
| 95 | `--superproject-revision` is used), and a failure to obtain a manifest from | ||
| 96 | the server fails the sync instead of silently falling back to ToT. | ||
| 97 | |||
| 98 | `sync.smartsync` does not affect `-l`/`--local-only`: a local-only sync keeps | ||
| 99 | whatever `smart_sync_override.xml` the previous network sync left behind. See | ||
| 100 | [smart-sync.md](./smart-sync.md#Client-Options) for details. | ||
| 101 | |||
| 102 | |||
| 103 | [git-config]: https://git-scm.com/docs/git-config | ||
diff --git a/docs/smart-sync.md b/docs/smart-sync.md index 24f37461b..905a004a0 100644 --- a/docs/smart-sync.md +++ b/docs/smart-sync.md | |||
| @@ -204,6 +204,10 @@ still fails the sync, as before. Options that specify an explicit target or | |||
| 204 | manifest source (such as `-t`/`--smart-tag`, `-m`/`--manifest-name` or | 204 | manifest source (such as `-t`/`--smart-tag`, `-m`/`--manifest-name` or |
| 205 | `--superproject-revision`) will also disable the default Smart Sync behavior. | 205 | `--superproject-revision`) will also disable the default Smart Sync behavior. |
| 206 | 206 | ||
| 207 | Users can override this manifest default on their workstation with the | ||
| 208 | `sync.smartsync` user setting; see | ||
| 209 | [Per-user default](#Per_user-default-sync_smartsync) below. | ||
| 210 | |||
| 207 | ### --smart-sync / -s | 211 | ### --smart-sync / -s |
| 208 | 212 | ||
| 209 | Explicitly enables Smart Sync. Repo will call | 213 | Explicitly enables Smart Sync. Repo will call |
| @@ -231,6 +235,18 @@ match the settings Android build environments automatically setup. | |||
| 231 | Explicitly disables Smart Sync, overriding any `sync-smartsync="true"` setting | 235 | Explicitly disables Smart Sync, overriding any `sync-smartsync="true"` setting |
| 232 | declared in the manifest `<default>` element. | 236 | declared in the manifest `<default>` element. |
| 233 | 237 | ||
| 238 | ### Per-user default (sync.smartsync) | ||
| 239 | |||
| 240 | A user can decide once, for all their checkouts, whether `repo sync` should | ||
| 241 | Smart Sync by default by setting the boolean `sync.smartsync` key in their | ||
| 242 | [per-user repo config](./repoconfig.md#smartsync). | ||
| 243 | |||
| 244 | Command line flags (`-s`, `--no-smart-sync`, `-t`) override the user setting, | ||
| 245 | which in turn overrides the manifest's `sync-smartsync` default. A Smart Sync | ||
| 246 | enabled this way is treated as an explicit request, so it is subject to the | ||
| 247 | same restrictions as `-s` and fails the sync if no manifest can be obtained | ||
| 248 | from the server instead of silently falling back to ToT. | ||
| 249 | |||
| 234 | ### --smart-tag=TAG / -t | 250 | ### --smart-tag=TAG / -t |
| 235 | 251 | ||
| 236 | Repo will call `GetManifest(TAG)`. | 252 | Repo will call `GetManifest(TAG)`. |
