mirror of
https://github.com/gitui-org/gitui
synced 2026-05-24 09:28:21 +00:00
Fix stashlist after marked drop (#1207)
This commit is contained in:
parent
96aa346292
commit
02efae1499
4 changed files with 26 additions and 8 deletions
|
|
@ -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))
|
* 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))
|
* 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))
|
* 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
|
## [0.20.1] - 2021-01-26
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -865,10 +865,10 @@ impl App {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Action::StashDrop(_) | Action::StashPop(_) => {
|
Action::StashDrop(_) | Action::StashPop(_) => {
|
||||||
if let Err(e) = StashList::action_confirmed(
|
if let Err(e) = self
|
||||||
&self.repo.borrow(),
|
.stashlist_tab
|
||||||
&action,
|
.action_confirmed(&self.repo.borrow(), &action)
|
||||||
) {
|
{
|
||||||
self.queue.push(InternalEvent::ShowErrorMsg(
|
self.queue.push(InternalEvent::ShowErrorMsg(
|
||||||
e.to_string(),
|
e.to_string(),
|
||||||
));
|
));
|
||||||
|
|
|
||||||
|
|
@ -138,6 +138,11 @@ impl CommitList {
|
||||||
&self.marked
|
&self.marked
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
pub fn clear_marked(&mut self) {
|
||||||
|
self.marked.clear();
|
||||||
|
}
|
||||||
|
|
||||||
pub fn copy_entry_hash(&self) -> Result<()> {
|
pub fn copy_entry_hash(&self) -> Result<()> {
|
||||||
if let Some(e) = self.items.iter().nth(
|
if let Some(e) = self.items.iter().nth(
|
||||||
self.selection.saturating_sub(self.items.index_offset()),
|
self.selection.saturating_sub(self.items.index_offset()),
|
||||||
|
|
|
||||||
|
|
@ -107,28 +107,40 @@ impl StashList {
|
||||||
|
|
||||||
/// Called when a pending stash action has been confirmed
|
/// Called when a pending stash action has been confirmed
|
||||||
pub fn action_confirmed(
|
pub fn action_confirmed(
|
||||||
|
&mut self,
|
||||||
repo: &RepoPath,
|
repo: &RepoPath,
|
||||||
action: &Action,
|
action: &Action,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
match action {
|
match action {
|
||||||
Action::StashDrop(ids) => Self::drop(repo, ids)?,
|
Action::StashDrop(ids) => self.drop(repo, ids)?,
|
||||||
Action::StashPop(id) => Self::pop(repo, *id)?,
|
Action::StashPop(id) => self.pop(repo, *id)?,
|
||||||
_ => (),
|
_ => (),
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn drop(repo: &RepoPath, ids: &[CommitId]) -> Result<()> {
|
fn drop(
|
||||||
|
&mut self,
|
||||||
|
repo: &RepoPath,
|
||||||
|
ids: &[CommitId],
|
||||||
|
) -> Result<()> {
|
||||||
for id in ids {
|
for id in ids {
|
||||||
sync::stash_drop(repo, *id)?;
|
sync::stash_drop(repo, *id)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self.list.clear_marked();
|
||||||
|
self.update()?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn pop(repo: &RepoPath, id: CommitId) -> Result<()> {
|
fn pop(&mut self, repo: &RepoPath, id: CommitId) -> Result<()> {
|
||||||
sync::stash_pop(repo, id)?;
|
sync::stash_pop(repo, id)?;
|
||||||
|
|
||||||
|
self.list.clear_marked();
|
||||||
|
self.update()?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue