mirror of
https://github.com/Murmele/Gittyup.git
synced 2024-09-11 02:35:41 +03:00
Set head/stash reference after pop/drop stash
Fixes the issue "Dropping multiple stashs in a row segfaults #637". The cause of the crash was that the commit list was not properly updated after pop/drop stash actions. With this change the commit list is updated or when the stash gets empty (after last pop/drop) then the head is selected as current reference.
This commit is contained in:
parent
ed47229ac9
commit
778715ae9f
@ -2122,6 +2122,13 @@ void RepoView::dropStash(int index) {
|
||||
LogEntry *entry = addLogEntry(msg(commit), tr("Drop Stash"));
|
||||
if (!mRepo.dropStash(index))
|
||||
error(entry, tr("drop stash"), commit.link());
|
||||
|
||||
if (mRepo.stashes().size() == 0) {
|
||||
// switch back to head when there are no stashes left
|
||||
mCommits->setReference(mRepo.head());
|
||||
} else {
|
||||
mCommits->setReference(mRepo.stashRef());
|
||||
}
|
||||
}
|
||||
|
||||
void RepoView::popStash(int index) {
|
||||
@ -2135,7 +2142,12 @@ void RepoView::popStash(int index) {
|
||||
return;
|
||||
}
|
||||
|
||||
refresh(false);
|
||||
if (mRepo.stashes().size() == 0) {
|
||||
// switch back to head when there are no stashes left
|
||||
mCommits->setReference(mRepo.head());
|
||||
} else {
|
||||
mCommits->setReference(mRepo.stashRef());
|
||||
}
|
||||
}
|
||||
|
||||
void RepoView::promptToAddTag(const git::Commit &commit) {
|
||||
|
Loading…
Reference in New Issue
Block a user