21 lines
514 B
Rust
21 lines
514 B
Rust
use crate::{bare::GitBare, errors::GitResult};
|
|
|
|
pub struct BranchReNameParams {
|
|
pub old_branch: String,
|
|
pub new_branch: String,
|
|
pub force: bool,
|
|
}
|
|
|
|
impl GitBare {
|
|
pub fn branch_rename(&self, params: BranchReNameParams) -> GitResult<()> {
|
|
let flag = if params.force { "-M" } else { "-m" };
|
|
self.git_command_trusted(vec![
|
|
"branch".to_string(),
|
|
flag.to_string(),
|
|
params.old_branch,
|
|
params.new_branch,
|
|
])?;
|
|
Ok(())
|
|
}
|
|
}
|