vcs: Add 'create branch' button
This commit is contained in:
parent
79ece8a86e
commit
cb24cb1ea5
2 changed files with 108 additions and 34 deletions
|
@ -39,6 +39,9 @@ pub trait GitRepository: Send {
|
|||
fn change_branch(&self, _: &str) -> Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
fn create_branch(&self, _: &str) -> Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Debug for dyn GitRepository {
|
||||
|
@ -152,6 +155,12 @@ impl GitRepository for LibGitRepository {
|
|||
)?;
|
||||
Ok(())
|
||||
}
|
||||
fn create_branch(&self, name: &str) -> Result<()> {
|
||||
let current_commit = self.head()?.peel_to_commit()?;
|
||||
self.branch(name, ¤t_commit, false)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
fn read_status(status: git2::Status) -> Option<GitFileStatus> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue