Commit 37fe8bd
committed
repo-settings: add fetch.haveRefs config
In some large repos and strange commit history data shapes, it can be
very expensive to not advertise certain references. For example, a
parallel 'release' branch that occasionally merges the 'main' branch and
augments the content with release metadata could create a long
commit history that is not reachable from any other user development
branches. If the client fails to advertise its copy of the 'release'
branch, then it could end up redownloading that entire history in the
range 'main..origin/release' instead of only 'release..origin/release'.
Add a new multi-valued config key 'fetch.haveRefs' that forces certain
references to be advertised during negotiation. This change focuses on
safely parsing and storing those strings in the repo_settings struct.
Some things that I needed to be careful about: the
repo_config_get_string_multi() method fills the given list with a
pointer to a list that is managed by the config subsystem. Holding a
pointer to that list is not safe, so it must be copied before moving on
to other config reads.
Since we have a deep copy of these values, we need to free them as the
settings are cleared.
Signed-off-by: Derrick Stolee <stolee@gmail.com>1 parent 3ad2ea4 commit 37fe8bd
3 files changed
Lines changed: 36 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
82 | 101 | | |
83 | 102 | | |
84 | 103 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| 38 | + | |
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
| |||
131 | 132 | | |
132 | 133 | | |
133 | 134 | | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
134 | 145 | | |
135 | 146 | | |
136 | 147 | | |
| |||
161 | 172 | | |
162 | 173 | | |
163 | 174 | | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
164 | 179 | | |
165 | 180 | | |
166 | 181 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
58 | 59 | | |
59 | 60 | | |
60 | 61 | | |
| 62 | + | |
61 | 63 | | |
62 | 64 | | |
63 | 65 | | |
| |||
0 commit comments