Get the default remote, if one is configured. Returns the first remote marked as default, or "origin" if it exists and no other default is set. # Example ```rust use atomic_repository::remote::{RemoteConfig, RemoteEntry}; let mut config = RemoteConfig::new(); config.add("upstream", RemoteEntry::new_default("https://upstream.com/repo")).unwrap(); config.add("origin", RemoteEntry::new("https://o
(&self)
| 428 | /// assert_eq!(name, "upstream"); |
| 429 | /// ``` |
| 430 | pub fn get_default(&self) -> Option<(&str, &RemoteEntry)> { |
| 431 | // First, look for an explicitly marked default |
| 432 | for (name, entry) in &self.remotes { |
| 433 | if entry.default { |
| 434 | return Some((name, entry)); |
| 435 | } |
| 436 | } |
| 437 | |
| 438 | // Fall back to "origin" if it exists |
| 439 | if let Some(origin) = self.remotes.get("origin") { |
| 440 | return Some(("origin", origin)); |
| 441 | } |
| 442 | |
| 443 | // Return the first remote if there's only one |
| 444 | if self.remotes.len() == 1 { |
| 445 | if let Some((name, entry)) = self.remotes.iter().next() { |
| 446 | return Some((name, entry)); |
| 447 | } |
| 448 | } |
| 449 | |
| 450 | None |
| 451 | } |
| 452 | |
| 453 | /// Add a new remote. |
| 454 | /// |