1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
use std::{borrow::Cow, convert::TryInto};
use git_ref::FullNameRef;
use git_validate::reference::name::Error as ValidateNameError;
use crate::bstr::BStr;
impl crate::Repository {
pub fn remote_ref(&self, short_branch_name: &str) -> Option<Result<Cow<'_, FullNameRef>, ValidateNameError>> {
self.config
.resolved
.string("branch", Some(short_branch_name), "merge")
.map(|v| match v {
Cow::Borrowed(v) => v.try_into().map(Cow::Borrowed),
Cow::Owned(v) => v.try_into().map(Cow::Owned),
})
}
pub fn branch_remote_name(&self, short_branch_name: &str) -> Option<Cow<'_, BStr>> {
self.config.resolved.string("branch", Some(short_branch_name), "remote")
}
}