* Resolve an `http.extraHeader` auth value for a follow-up `git fetch`, so the * token stays out of the remote URL and out of `.git/config` (it is passed * per-invocation via `-c`). Mirrors the token providers handled in shallowClone * that inject via extraHeader rather than embedding creds in th
(provider?: string)
| 291 | * Git credentials. |
| 292 | */ |
| 293 | function fetchAuthHeader(provider?: string): string | null { |
| 294 | if (provider === 'github') { |
| 295 | const token = getGitHubToken(); |
| 296 | return token ? buildAuthHeader(token) : null; |
| 297 | } |
| 298 | if (provider === 'gitlab') { |
| 299 | const token = getGitLabToken(); |
| 300 | return token ? buildAuthHeader(token, 'oauth2') : null; |
| 301 | } |
| 302 | if (provider === 'gitcode') { |
| 303 | const token = getGitCodeToken(); |
| 304 | return token ? buildAuthHeader(token, 'oauth2') : null; |
| 305 | } |
| 306 | return null; |
| 307 | } |
| 308 | |
| 309 | /** |
| 310 | * 在已有 clone 目录上执行 git fetch 并 reset 到最新 HEAD(用于 P5.3 增量;P5.1 暂不调用)。 |
no test coverage detected