diff --git a/src/app.rs b/src/app.rs index 58f68876..b6ce9894 100644 --- a/src/app.rs +++ b/src/app.rs @@ -768,7 +768,7 @@ impl App { sync::discard_lines(CWD, &path, &lines)?; flags.insert(NeedsUpdate::ALL); } - Action::DeleteBranch(branch_ref, true) => { + Action::DeleteLocalBranch(branch_ref) => { if let Err(e) = sync::delete_branch(CWD, &branch_ref) { self.queue.push(InternalEvent::ShowErrorMsg( @@ -778,8 +778,9 @@ impl App { flags.insert(NeedsUpdate::ALL); self.select_branch_popup.update_branches()?; } - Action::DeleteBranch(branch_ref, false) => { + Action::DeleteRemoteBranch(branch_ref) => { self.queue.push( + //TODO: check if this is correct based on the fix in `c6abbaf` branch_ref.rsplit('/').next().map_or_else( || { InternalEvent::ShowErrorMsg(format!( diff --git a/src/components/branchlist.rs b/src/components/branchlist.rs index 5f7c1e64..64a25cf5 100644 --- a/src/components/branchlist.rs +++ b/src/components/branchlist.rs @@ -659,13 +659,15 @@ impl BranchListComponent { } fn delete_branch(&mut self) { + let reference = + self.branches[self.selection as usize].reference.clone(); + self.queue.push(InternalEvent::ConfirmAction( - Action::DeleteBranch( - self.branches[self.selection as usize] - .reference - .clone(), - self.local, - ), + if self.local { + Action::DeleteLocalBranch(reference) + } else { + Action::DeleteRemoteBranch(reference) + }, )); } } diff --git a/src/components/reset.rs b/src/components/reset.rs index e389afb8..bd1fb9dd 100644 --- a/src/components/reset.rs +++ b/src/components/reset.rs @@ -157,7 +157,7 @@ impl ConfirmComponent { strings::confirm_title_reset(), strings::confirm_msg_reset_lines(lines.len()), ), - Action::DeleteBranch(branch_ref, true) => ( + Action::DeleteLocalBranch(branch_ref) => ( strings::confirm_title_delete_branch( &self.key_config, ), @@ -166,7 +166,7 @@ impl ConfirmComponent { branch_ref, ), ), - Action::DeleteBranch(branch_ref, false) => ( + Action::DeleteRemoteBranch(branch_ref) => ( strings::confirm_title_delete_remote_branch( &self.key_config, ), diff --git a/src/queue.rs b/src/queue.rs index 8bd43b4d..1160730e 100644 --- a/src/queue.rs +++ b/src/queue.rs @@ -36,7 +36,8 @@ pub enum Action { ResetLines(String, Vec), StashDrop(Vec), StashPop(CommitId), - DeleteBranch(String, bool), + DeleteLocalBranch(String), + DeleteRemoteBranch(String), DeleteTag(String), ForcePush(String, bool), PullMerge { incoming: usize, rebase: bool },