Skip to content

Commit

Permalink
Check branch exisiting before do remove.
Browse files Browse the repository at this point in the history
  • Loading branch information
tannguyen04 committed Mar 19, 2024
1 parent 5ccd7aa commit 5eb9725
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/GitArtifactGitRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,14 @@ public function removeBranch($name, bool $force = FALSE): GitArtifactGitReposito
return $this;
}

$branches = $this->getBranches();
if (empty($branches)) {
return $this;
}
if (!in_array($name, $branches)) {
return $this;
}

if (!$force) {
return parent::removeBranch($name);
}
Expand Down

0 comments on commit 5eb9725

Please sign in to comment.