Skip to content

Commit

Permalink
Merge pull request #713 from siforrer/fix-drop-pop-stash-crashes
Browse files Browse the repository at this point in the history
Set head/stash reference after pop/drop stash
  • Loading branch information
Murmele authored Apr 20, 2024
2 parents 64cecfa + 744dc13 commit 9c20e60
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/ui/RepoView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -2134,8 +2141,9 @@ void RepoView::popStash(int index) {
error(entry, tr("pop stash"), commit.link());
return;
}

refresh(false);
// switch back to head
selectReference(mRepo.head());
selectFirstCommit();
}

void RepoView::promptToAddTag(const git::Commit &commit) {
Expand Down

0 comments on commit 9c20e60

Please sign in to comment.