Closed siforrer closed 7 months ago
Tested. I can confirm this works. Nice bug fix!
One suggestion: If I do Stash->Pop Stash
with 2 or more stashes, my view is set to the stash list. Instead, wouldn't it make more sense to always set the view to show Uncommitted Changes
after a stash pop? I'm not sure if there is a clean way to do this currently, so maybe this would be a future enhancement to not hold up this PR.
Thanks for testing and the input regarding Stash->Pop Stash
. I totally agree with you and did that change. I put the setReference in the refresh function.
An additional benefit of this is that fixes the following problem which I just noticed:
Initial state - stash selected and commit list contains stashes:
Press Refresh
=> The head revision ist selected but the commit list contains stashes:
In your last commit #4cb4410, when I refresh, it automatically selects the top item in the CommitList. In my opinion, this is disorienting. When a certain commit selected, I like that commit to stay selected unless the user specifically moves to another one by clicking or using arrow keys.
I think your mCommits->setReference(mRepo.head());
is excellent in the case where the selected commit no longer exists (e.g. a popped stash, or any commit that was deleted/rebased). But doing upon every refresh event seems a bit heavy-handed.
Thoughts?
I agree that a refresh should only have an effect if there was actually a change (e.g. in the background by a command line action). Thus the last commit is no improvement. The simple solution would be that I put mCommits->setReference(mRepo.head());
in the popStash
function. Though I will think a bit more about modifying the void RepoView::refresh(bool restoreSelection)
function because somehow it feels right to handle it there.
I tried to modify the refresh
method but I am not able to do that. Thus I reverted the changes and tried it as before in the popStash
method directly.
Tested. I can confirm this works. Nice bug fix!
One suggestion: If I do
Stash->Pop Stash
with 2 or more stashes, my view is set to the stash list. Instead, wouldn't it make more sense to always set the view to showUncommitted Changes
after a stash pop? I'm not sure if there is a clean way to do this currently, so maybe this would be a future enhancement to not hold up this PR.
I was able to change it that the the view shows Uncommitted Changes after a stash pop.
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.