Skip to content

Commit

Permalink
reimplement delete-local with the CLI semantics
Browse files Browse the repository at this point in the history
  • Loading branch information
gulbanana committed Mar 23, 2024
1 parent 22a1d8e commit f577b7d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src-tauri/src/worker/mutations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -576,14 +576,13 @@ impl Mutation for CreateRef {

impl Mutation for DeleteRef {
fn execute(self: Box<Self>, ws: &mut WorkspaceSession) -> Result<MutationResult> {
todo!("implementation looks complete, but is not. for example, we need to untrack local branches first, and remote branches have to be absented and then pushed.");

match self.r#ref {
StoreRef::RemoteBranch {
branch_name,
remote_name,
..
} => {
todo!("need to track-as-absent");
precondition!(
"{}@{} is a remote branch and cannot be deleted",
branch_name,
Expand All @@ -593,7 +592,8 @@ impl Mutation for DeleteRef {
StoreRef::LocalBranch { branch_name, .. } => {
let mut tx = ws.start_transaction()?;

tx.mut_repo().remove_branch(&branch_name);
tx.mut_repo()
.set_local_branch_target(&branch_name, RefTarget::absent());

match ws.finish_transaction(tx, format!("forget {}", branch_name))? {
Some(new_status) => Ok(MutationResult::Updated { new_status }),
Expand Down

0 comments on commit f577b7d

Please sign in to comment.