mirror of
https://github.com/extrawurst/gitui.git
synced 2024-12-26 18:43:37 +03:00
Fix stashlist after marked drop (#1207)
This commit is contained in:
parent
96aa346292
commit
02efae1499
@ -24,6 +24,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
* opening tags list without remotes ([#1111](https://github.com/extrawurst/gitui/issues/1111))
|
||||
* tabs indentation in blame [[@fersilva16](https://github.com/fersilva16)] ([#1111](https://github.com/extrawurst/gitui/issues/1117))
|
||||
* switch focus to index after staging last file ([#1169](https://github.com/extrawurst/gitui/pull/1169))
|
||||
* fix stashlist multi marking not updated after dropping ([#1207](https://github.com/extrawurst/gitui/pull/1207))
|
||||
|
||||
## [0.20.1] - 2021-01-26
|
||||
|
||||
|
@ -865,10 +865,10 @@ impl App {
|
||||
}
|
||||
}
|
||||
Action::StashDrop(_) | Action::StashPop(_) => {
|
||||
if let Err(e) = StashList::action_confirmed(
|
||||
&self.repo.borrow(),
|
||||
&action,
|
||||
) {
|
||||
if let Err(e) = self
|
||||
.stashlist_tab
|
||||
.action_confirmed(&self.repo.borrow(), &action)
|
||||
{
|
||||
self.queue.push(InternalEvent::ShowErrorMsg(
|
||||
e.to_string(),
|
||||
));
|
||||
|
@ -138,6 +138,11 @@ impl CommitList {
|
||||
&self.marked
|
||||
}
|
||||
|
||||
///
|
||||
pub fn clear_marked(&mut self) {
|
||||
self.marked.clear();
|
||||
}
|
||||
|
||||
pub fn copy_entry_hash(&self) -> Result<()> {
|
||||
if let Some(e) = self.items.iter().nth(
|
||||
self.selection.saturating_sub(self.items.index_offset()),
|
||||
|
@ -107,28 +107,40 @@ impl StashList {
|
||||
|
||||
/// Called when a pending stash action has been confirmed
|
||||
pub fn action_confirmed(
|
||||
&mut self,
|
||||
repo: &RepoPath,
|
||||
action: &Action,
|
||||
) -> Result<()> {
|
||||
match action {
|
||||
Action::StashDrop(ids) => Self::drop(repo, ids)?,
|
||||
Action::StashPop(id) => Self::pop(repo, *id)?,
|
||||
Action::StashDrop(ids) => self.drop(repo, ids)?,
|
||||
Action::StashPop(id) => self.pop(repo, *id)?,
|
||||
_ => (),
|
||||
};
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn drop(repo: &RepoPath, ids: &[CommitId]) -> Result<()> {
|
||||
fn drop(
|
||||
&mut self,
|
||||
repo: &RepoPath,
|
||||
ids: &[CommitId],
|
||||
) -> Result<()> {
|
||||
for id in ids {
|
||||
sync::stash_drop(repo, *id)?;
|
||||
}
|
||||
|
||||
self.list.clear_marked();
|
||||
self.update()?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn pop(repo: &RepoPath, id: CommitId) -> Result<()> {
|
||||
fn pop(&mut self, repo: &RepoPath, id: CommitId) -> Result<()> {
|
||||
sync::stash_pop(repo, id)?;
|
||||
|
||||
self.list.clear_marked();
|
||||
self.update()?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user