diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2026-02-20 21:14:45 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2026-02-20 21:21:52 +0000 |
| commit | b10340cb00a00da07d0ae735796d83801454779e (patch) | |
| tree | 771671bf25ae2b7d13369490fefc5f55631de5ea /src/bin/ngit/sub_commands/init.rs | |
| parent | fa99cf7dfc9e6b16e67afe03873486039263ce42 (diff) | |
use trusted maintainer's grasp servers as fallback for co-maintainers
when a co-maintainer has no grasp servers of their own, fall back to
the trusted maintainer's grasp servers rather than jumping straight to
system defaults. if the trusted maintainer only uses a single grasp
server, the first system default is appended for redundancy. system
defaults are only used when neither the user nor the trusted maintainer
has any grasp servers configured.
Diffstat (limited to 'src/bin/ngit/sub_commands/init.rs')
| -rw-r--r-- | src/bin/ngit/sub_commands/init.rs | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/bin/ngit/sub_commands/init.rs b/src/bin/ngit/sub_commands/init.rs index 5c43e6e..5ff57d5 100644 --- a/src/bin/ngit/sub_commands/init.rs +++ b/src/bin/ngit/sub_commands/init.rs | |||
| @@ -282,12 +282,23 @@ fn resolve_grasp_servers( | |||
| 282 | 282 | ||
| 283 | if !interactive || cli.defaults || state.has_coordinate() || cli.force { | 283 | if !interactive || cli.defaults || state.has_coordinate() || cli.force { |
| 284 | // Prefer grasp servers from my existing announcement, then user's grasp | 284 | // Prefer grasp servers from my existing announcement, then user's grasp |
| 285 | // list, then system fallbacks | 285 | // list (or trusted maintainer's servers as fallback), then system defaults |
| 286 | let existing = detect_existing_grasp_servers(my_ref.as_ref(), &args.relay, &[], identifier); | 286 | let existing = detect_existing_grasp_servers(my_ref.as_ref(), &args.relay, &[], identifier); |
| 287 | if !existing.is_empty() { | 287 | if !existing.is_empty() { |
| 288 | return Ok(existing); | 288 | return Ok(existing); |
| 289 | } | 289 | } |
| 290 | return Ok(grasp_servers_from_user_or_fallback(user_ref, client)); | 290 | // For co-maintainer state, pass the repo_ref so the trusted |
| 291 | // maintainer's grasp servers can be used as a fallback. | ||
| 292 | let trusted_maintainer_repo_ref = if matches!(state, InitState::CoMaintainer { .. }) { | ||
| 293 | state.repo_ref() | ||
| 294 | } else { | ||
| 295 | None | ||
| 296 | }; | ||
| 297 | return Ok(grasp_servers_from_user_or_fallback( | ||
| 298 | user_ref, | ||
| 299 | trusted_maintainer_repo_ref, | ||
| 300 | client, | ||
| 301 | )); | ||
| 291 | } | 302 | } |
| 292 | 303 | ||
| 293 | // Interactive prompt | 304 | // Interactive prompt |