Skip to content

Commit 7c8f409

Browse files
committedAug 7, 2024
feat: add remote::Names as shortcut to the value returned for all remote names.
1 parent 2e00b5e commit 7c8f409

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed
 

‎gix/src/remote/mod.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
use std::borrow::Cow;
2-
31
use crate::bstr::BStr;
2+
use std::borrow::Cow;
3+
use std::collections::BTreeSet;
44

55
/// The direction of an operation carried out (or to be carried out) through a remote.
66
#[derive(Debug, Eq, PartialEq, Copy, Clone, Hash)]
@@ -31,6 +31,9 @@ pub enum Name<'repo> {
3131
Url(Cow<'repo, BStr>),
3232
}
3333

34+
/// A type-definition for a sorted list of unvalidated remote names - they have been read straight from the configuration.
35+
pub type Names<'a> = BTreeSet<Cow<'a, BStr>>;
36+
3437
///
3538
#[allow(clippy::empty_docs)]
3639
pub mod name;

‎gix/src/repository/config/remote.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::bstr::BStr;
2-
use std::{borrow::Cow, collections::BTreeSet};
2+
use std::borrow::Cow;
33

44
use crate::config::tree::{Remote, Section};
55
use crate::remote;
@@ -8,7 +8,7 @@ use crate::remote;
88
impl crate::Repository {
99
/// Returns a sorted list unique of symbolic names of remotes that
1010
/// we deem [trustworthy][crate::open::Options::filter_config_section()].
11-
pub fn remote_names(&self) -> BTreeSet<Cow<'_, BStr>> {
11+
pub fn remote_names(&self) -> remote::Names<'_> {
1212
self.config
1313
.resolved
1414
.sections_by_name(Remote.name())

0 commit comments

Comments
 (0)
Please sign in to comment.