Merge pull request #713 from siforrer/fix-drop-pop-stash-crashes

Set head/stash reference after pop/drop stash
This commit is contained in:
Murmele 2024-04-20 17:43:54 +02:00 committed by GitHub
commit 9c20e60e8d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2122,6 +2122,13 @@ void RepoView::dropStash(int index) {
LogEntry *entry = addLogEntry(msg(commit), tr("Drop Stash")); LogEntry *entry = addLogEntry(msg(commit), tr("Drop Stash"));
if (!mRepo.dropStash(index)) if (!mRepo.dropStash(index))
error(entry, tr("drop stash"), commit.link()); 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) { void RepoView::popStash(int index) {
@ -2134,8 +2141,9 @@ void RepoView::popStash(int index) {
error(entry, tr("pop stash"), commit.link()); error(entry, tr("pop stash"), commit.link());
return; return;
} }
// switch back to head
refresh(false); selectReference(mRepo.head());
selectFirstCommit();
} }
void RepoView::promptToAddTag(const git::Commit &commit) { void RepoView::promptToAddTag(const git::Commit &commit) {