diff options
| author | Joel Klinghed <the_jk@spawned.biz> | 2025-02-06 00:05:57 +0100 |
|---|---|---|
| committer | Joel Klinghed <the_jk@spawned.biz> | 2025-02-06 00:05:57 +0100 |
| commit | bd74717e10fb36e19893c15941876b2383b94714 (patch) | |
| tree | 5fc26ace64c37fb439ba94cc5ea437a0e93913d2 /server/common/src/git.rs | |
| parent | 350fc534de745f4cc62000fa25d67afcddb7918a (diff) | |
Add DELETE command for review
Only the owner or a maintainer of the project can remove a review.
Removing a review also removes the git branch.
Only reviews that are either draft or dropped can be removed.
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 + } } |
