pub struct RemoteDefaultBranch { /* private fields */ }Expand description
Get the default branch of a remote.
Connects to the remote and reads the branch its HEAD points to.
§Examples
use ironflow_ops_git::fetch::RemoteDefaultBranch;
use ironflow_core::operation::Operation;
let op = RemoteDefaultBranch::new("/path/to/repo", "origin");
assert_eq!(op.kind(), "git");Implementations§
Source§impl RemoteDefaultBranch
impl RemoteDefaultBranch
Sourcepub fn new(
repo_path: impl Into<PathBuf>,
remote_name: impl Into<String>,
) -> Self
pub fn new( repo_path: impl Into<PathBuf>, remote_name: impl Into<String>, ) -> Self
Create a new default-branch query operation.
Sourcepub async fn run(
&self,
ctx: &OperationContext,
) -> Result<RemoteDefaultBranchOutput, OperationError>
pub async fn run( &self, ctx: &OperationContext, ) -> Result<RemoteDefaultBranchOutput, OperationError>
Execute and return a typed result.
§Errors
Returns OperationError::Secret if the secret store fails, and
OperationError::External if the connection fails or the remote
has no default branch. The token never appears in the message.
Source§impl RemoteDefaultBranch
impl RemoteDefaultBranch
Sourcepub fn token_secret(self, key: impl Into<String>) -> Self
pub fn token_secret(self, key: impl Into<String>) -> Self
Read the HTTPS token from the secret key instead of git_token.
§Examples
use ironflow_ops_git::fetch::RemoteDefaultBranch;
let op = RemoteDefaultBranch::new("/path/to/repo", "origin").token_secret("gitlab_token");Trait Implementations§
Source§impl Operation for RemoteDefaultBranch
impl Operation for RemoteDefaultBranch
Source§fn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 OperationContext,
) -> Pin<Box<dyn Future<Output = Result<Value, OperationError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 OperationContext,
) -> Pin<Box<dyn Future<Output = Result<Value, OperationError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Execute the operation and return the result as JSON. Read more
Source§impl TypedOperation for RemoteDefaultBranch
impl TypedOperation for RemoteDefaultBranch
Source§type Output = RemoteDefaultBranchOutput
type Output = RemoteDefaultBranchOutput
The concrete output type that
Operation::execute produces.Auto Trait Implementations§
impl Freeze for RemoteDefaultBranch
impl RefUnwindSafe for RemoteDefaultBranch
impl Send for RemoteDefaultBranch
impl Sync for RemoteDefaultBranch
impl Unpin for RemoteDefaultBranch
impl UnsafeUnpin for RemoteDefaultBranch
impl UnwindSafe for RemoteDefaultBranch
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more