diff options
Diffstat (limited to 'server/common/src/git.rs')
| -rw-r--r-- | server/common/src/git.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/server/common/src/git.rs b/server/common/src/git.rs index 74c3247..ac0bdb3 100644 --- a/server/common/src/git.rs +++ b/server/common/src/git.rs @@ -326,6 +326,12 @@ impl RepoData { .await } + async fn delete_branch(&self, repo: &Repository, branch: &str) -> Result<(), Error> { + let mut cmd = self.git_cmd(repo); + cmd.arg("branch").arg("--delete").arg("--force").arg(branch); + self.run(&mut cmd).await + } + async fn get_log_format( &self, repo: &Repository, @@ -564,4 +570,11 @@ impl Repository { data.get_commiter(self, commit.as_str()).await } + + pub async fn delete_branch(&self, branch: impl Into<String>) -> Result<(), Error> { + let branch = branch.into(); + let data = self.lock.read().await; + + data.delete_branch(self, branch.as_str()).await + } } |
