Commit efec513
config: use --show-scope instead of --show-origin in cache
Context:
The config cache path already gates on Git 2.54.0+ (or microsoft/git
2.53.0.vfs.0.1+) to use 'git config list --type=<X>'. These versions
also support --show-scope, which directly reports the scope (system,
global, local) as a simple string rather than a file path.
Justification:
The --show-origin approach required heuristic path matching to guess
the scope from origin paths like 'file:/etc/gitconfig' or
'file:~/.gitconfig'. This was fragile: it could fail on non-standard
install prefixes or platform-specific paths (e.g., Windows). Since
--show-scope is available at the same Git versions we already require,
we can use it for reliable scope detection with no guesswork.
Implementation:
- Replace --show-origin with --show-scope in the git config list call
- Replace DetermineLevel() path heuristic with ParseScope() that does
a direct string match on 'system', 'global', 'local'
- Remove the now-unused Origin property from ConfigCacheEntry
- Rename origin variables to scope throughout ConfigCache.Load()
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 3125246 commit efec513
1 file changed
Lines changed: 22 additions & 35 deletions
File tree
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
117 | | - | |
118 | 117 | | |
119 | 118 | | |
120 | 119 | | |
121 | | - | |
| 120 | + | |
122 | 121 | | |
123 | | - | |
124 | 122 | | |
125 | | - | |
| 123 | + | |
126 | 124 | | |
127 | 125 | | |
128 | | - | |
| 126 | + | |
129 | 127 | | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
152 | 139 | | |
153 | 140 | | |
154 | 141 | | |
155 | 142 | | |
156 | | - | |
| 143 | + | |
157 | 144 | | |
158 | 145 | | |
159 | 146 | | |
| |||
168 | 155 | | |
169 | 156 | | |
170 | 157 | | |
171 | | - | |
| 158 | + | |
172 | 159 | | |
173 | 160 | | |
174 | 161 | | |
175 | 162 | | |
176 | 163 | | |
177 | 164 | | |
178 | | - | |
| 165 | + | |
179 | 166 | | |
180 | 167 | | |
181 | 168 | | |
182 | | - | |
| 169 | + | |
183 | 170 | | |
184 | 171 | | |
185 | | - | |
| 172 | + | |
186 | 173 | | |
187 | 174 | | |
188 | 175 | | |
189 | 176 | | |
190 | | - | |
| 177 | + | |
191 | 178 | | |
192 | 179 | | |
193 | 180 | | |
| |||
225 | 212 | | |
226 | 213 | | |
227 | 214 | | |
228 | | - | |
| 215 | + | |
229 | 216 | | |
230 | 217 | | |
231 | 218 | | |
| |||
398 | 385 | | |
399 | 386 | | |
400 | 387 | | |
401 | | - | |
| 388 | + | |
402 | 389 | | |
403 | 390 | | |
404 | 391 | | |
| |||
0 commit comments