summaryrefslogtreecommitdiffstats
path: root/docs/repoconfig.md
diff options
context:
space:
mode:
Diffstat (limited to 'docs/repoconfig.md')
-rw-r--r--docs/repoconfig.md103
1 files changed, 103 insertions, 0 deletions
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
3Repo keeps a small number of settings that apply to the current user rather
4than to one checkout. They live in the per-user configuration file
5`~/.repoconfig/config`, which is separate from both git's own `~/.gitconfig`
6and 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
13The file is `.repoconfig/config` inside the user's home directory. The parent
14directory can be changed by setting the `REPO_CONFIG_DIR` environment variable,
15in which case repo reads `$REPO_CONFIG_DIR/.repoconfig/config` instead.
16
17The file is created on demand; it's fine for it to be missing.
18
19## Format
20
21The file uses the [git-config] syntax, so it can be edited by hand:
22
23```ini
24[sync]
25 smartsync = true
26```
27
28or managed with `git config` by pointing it at the file explicitly:
29
30```sh
31# Set a value.
32git config --file ~/.repoconfig/config sync.smartsync true
33
34# Read a value.
35git config --file ~/.repoconfig/config sync.smartsync
36
37# Remove a value.
38git config --file ~/.repoconfig/config --unset sync.smartsync
39```
40
41Boolean settings accept `true`/`yes` and `false`/`no`.
42
43Repo caches a parsed copy of the file in `.repoconfig/.repo_config.json`; it is
44refreshed 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,
51optionally with arguments, in the same way as git aliases:
52
53```ini
54[alias]
55 ss = sync -s
56 st = status -o
57```
58
59Aliases defined in a checkout's `.repo/config` take precedence over per-user
60ones. 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
67checkouts, whether `repo sync` should [Smart Sync](./smart-sync.md) by
68default:
69
70```sh
71# Always Smart Sync, as if -s/--smart-sync were passed.
72git config --file ~/.repoconfig/config sync.smartsync true
73
74# Never Smart Sync by default, even if the manifest sets sync-smartsync="true".
75git config --file ~/.repoconfig/config sync.smartsync false
76
77# Remove the preference and go back to following the manifest.
78git config --file ~/.repoconfig/config --unset sync.smartsync
79```
80
81The effective behavior is resolved in this order; the first match wins:
82
831. Command line: `-s`/`--smart-sync`, `--no-smart-sync`, or `-t`/`--smart-tag`.
842. User config: `sync.smartsync` in `~/.repoconfig/config`.
853. Manifest: `sync-smartsync="true"` on the `<default>` element.
864. Otherwise, a regular ToT sync.
87
88So `sync.smartsync=false` turns off the manifest-driven default, but an
89explicit `repo sync -s`, `repo sync -t TAG` or `repo smartsync` still works.
90Likewise `sync.smartsync=true` is overridden by `--no-smart-sync`.
91
92A Smart Sync enabled by `sync.smartsync=true` is treated as an explicit
93request: 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
96the 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
99whatever `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