Skip to content

Commit

Permalink
Protect main branch
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris7 committed Sep 18, 2024
1 parent 6f928e1 commit acef1ad
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/models/operations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,9 @@ impl Branch {
}

pub fn delete(conn: &Connection, db_uuid: &str, branch_name: &str) {
if branch_name == "main" {
panic!("Main branch cannot be deleted");
}
if let Some(branch) = Branch::get_by_name(conn, db_uuid, branch_name) {
let branch_id = branch.id;
if let Some(current_branch) = OperationState::get_current_branch(conn, db_uuid) {
Expand Down

0 comments on commit acef1ad

Please sign in to comment.