Skip to content

Commit ef4ade1

Browse files
committed
fix stashlist not updated after dropping marked
1 parent 96aa346 commit ef4ade1

File tree

3 files changed

+19
-6
lines changed

3 files changed

+19
-6
lines changed

Diff for: src/app.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -865,10 +865,10 @@ impl App {
865865
}
866866
}
867867
Action::StashDrop(_) | Action::StashPop(_) => {
868-
if let Err(e) = StashList::action_confirmed(
869-
&self.repo.borrow(),
870-
&action,
871-
) {
868+
if let Err(e) = self
869+
.stashlist_tab
870+
.action_confirmed(&self.repo.borrow(), &action)
871+
{
872872
self.queue.push(InternalEvent::ShowErrorMsg(
873873
e.to_string(),
874874
));

Diff for: src/components/commitlist.rs

+5
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,11 @@ impl CommitList {
138138
&self.marked
139139
}
140140

141+
///
142+
pub fn clear_marked(&mut self) {
143+
self.marked.clear();
144+
}
145+
141146
pub fn copy_entry_hash(&self) -> Result<()> {
142147
if let Some(e) = self.items.iter().nth(
143148
self.selection.saturating_sub(self.items.index_offset()),

Diff for: src/tabs/stashlist.rs

+10-2
Original file line numberDiff line numberDiff line change
@@ -107,23 +107,31 @@ impl StashList {
107107

108108
/// Called when a pending stash action has been confirmed
109109
pub fn action_confirmed(
110+
&mut self,
110111
repo: &RepoPath,
111112
action: &Action,
112113
) -> Result<()> {
113114
match action {
114-
Action::StashDrop(ids) => Self::drop(repo, ids)?,
115+
Action::StashDrop(ids) => self.drop(repo, ids)?,
115116
Action::StashPop(id) => Self::pop(repo, *id)?,
116117
_ => (),
117118
};
118119

119120
Ok(())
120121
}
121122

122-
fn drop(repo: &RepoPath, ids: &[CommitId]) -> Result<()> {
123+
fn drop(
124+
&mut self,
125+
repo: &RepoPath,
126+
ids: &[CommitId],
127+
) -> Result<()> {
123128
for id in ids {
124129
sync::stash_drop(repo, *id)?;
125130
}
126131

132+
self.list.clear_marked();
133+
self.update()?;
134+
127135
Ok(())
128136
}
129137

0 commit comments

Comments
 (0)