Skip to content

Conversation

@stefanhaller
Copy link
Collaborator

  • Refresh views properly when entering/exiting filtering mode
  • Fix filtering of stashes

@stefanhaller stefanhaller added the bug Something isn't working label Jul 17, 2025
@codacy-production
Copy link

codacy-production bot commented Jul 17, 2025

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
Report missing for 143d4761 100.00%
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (143d476) Report Missing Report Missing Report Missing
Head commit (ec82e7c) 56912 49396 86.79%

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#4749) 67 67 100.00%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

Footnotes

  1. Codacy didn't receive coverage data for the commit, or there was an error processing the received data. Check your integration for errors and validate that your coverage setup is correct.

When exiting filtering mode while the focus is not in the local commits panel,
the call to HandleFocus would render the selection in the commits panel as if
the panel had the focus.

The call to HandleFocus was introduced recently in 4981419 in an attempt to
rerender the main view correctly, but it should only have been called when local
commits is the focused context. But instead, we can use PostRefreshUpdate, which
handles this distinction.
… showing

We don't currently do this, but will in the next commit; it's a reasonable thing
to want to do, and it shouldn't crash.
Since filtering switches to half-screen mode in the local commits panel, most
people probably didn't notice, but we do also filter those other views. So when
leaving half-screen mode (but not filtering), you could switch to sub-commits or
stashes, and those would show the filtered view only after the next refresh
(e.g. after a background fetch). It's worse when leaving filtering, because this
goes back to normal screen mode, and you would often see an empty stashes panel
after that (until the next background fetch), which is quite confusing.

I also find it questionable to always switch focus to the commits panel when
entering filtering. If it is initiated from subcommits, reflog, or stashes,
maybe we want to stay there. I'm not changing this now since I'm unsure how much
people rely on the current behavior.
The test shows that it doesn't work, the list is empty both when filtering by
file and by folder.

I could have added test cases for these to the unit tests in
stash_loader_test.go instead, but I don't find tests that need to mock git's
output very valuable, so I opted for an integration test even though it takes
much longer to run.
This was not a good idea, and it seems it has never been tested: the --name-only
and -z options don't work well together. Specifically, -z seems to simply cancel
--name-only.

This is not enough to make it work, we'll need more fixes in the next commit.

This reverts commit 50044dd.
This broke with the introduction of the age in the stashes list in bc330b8
(which was included in 0.41, so 12 minor versions ago).

This makes it work again when filtering by file, but it still doesn't work when
filtering by folder (and never has). We'll fix that next.
@stefanhaller stefanhaller force-pushed the filtering-mode-fixes branch from 2c77422 to ec82e7c Compare July 27, 2025 10:03
@stefanhaller stefanhaller enabled auto-merge July 27, 2025 10:03
@stefanhaller stefanhaller merged commit b8dfba8 into master Jul 27, 2025
13 checks passed
@stefanhaller stefanhaller deleted the filtering-mode-fixes branch July 27, 2025 10:05
tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request Aug 4, 2025
This MR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [jesseduffield/lazygit](https://github.com/jesseduffield/lazygit) | minor | `v0.53.0` -> `v0.54.0` |

MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot).

**Proposed changes to behavior should be submitted there as MRs.**

---

### Release Notes

<details>
<summary>jesseduffield/lazygit (jesseduffield/lazygit)</summary>

### [`v0.54.0`](https://github.com/jesseduffield/lazygit/releases/tag/v0.54.0)

[Compare Source](jesseduffield/lazygit@v0.53.0...v0.54.0)

<!-- Release notes generated using configuration in .github/release.yml at v0.54.0 -->

Again we don't have any major new features this time (unless you count the support for alt-backspace for deleting words in the commit message editor, which is one of my favorite additions), but lots of smaller quality-of-life improvements and bug fixes. The most notable one is probably the fix for the stale index.lock problem, which was a very long-standing bug that seemed to affect some users much more than others for some reason.

#### What's Changed

##### Enhancements 🔥

- Add confirmation for hard reset by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4704
- Provide user config defaults for UI-changeable settings by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4717
- Improve mouse handling of suggestions panel by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4726
- Add new command "Checkout previous branch" by [@&#8203;kyu08](https://github.com/kyu08) in jesseduffield/lazygit#4728
- Add confirmation for nuking the working tree by [@&#8203;DawidPietrykowski](https://github.com/DawidPietrykowski) in jesseduffield/lazygit#4727
- Support Alt+Backspace for word deletion in text areas by [@&#8203;rtzll](https://github.com/rtzll) in jesseduffield/lazygit#4741
- Don't use hunk mode for added or deleted files even when useHunkModeInStagingView config is on by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4758
- Show \[0] keybinding in main view title by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4754
- Draw divergence from base branch right-aligned in branches view by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4785
- Enable hunk staging mode by default by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4780

##### Fixes 🔧

- Fix scrolling hunk into view when selecting next hunk by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4709
- Fix stale main view content when entering/exiting filtering view by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4719
- Detect double-clicks properly by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4725
- Fix commit searching during rebase or in divergence from upstream view by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4730
- Fix amending commits whose commit message is empty by [@&#8203;aidancz](https://github.com/aidancz) in jesseduffield/lazygit#4732
- Several small fixes to filtering mode (by path or author) by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4749
- Show diff for renamed file when filtering by path by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4750
- Allow rewording or dropping commits in filtering mode by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4756
- Fix index out of bounds panic when repository has massive tags by [@&#8203;chojs23](https://github.com/chojs23) in jesseduffield/lazygit#4776
- When pressing `a` to stage all files, don't include untracked files when showing only tracked files by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4779
- Fix commit hash colors when filtering by path or aythor by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4789
- Improve temp dir handling by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4784
- Terminate git processes more gracefully to avoid the stale index.lock problem by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4782

##### Maintenance ⚙️

- Raise sponsors MRs as a draft by [@&#8203;jesseduffield](https://github.com/jesseduffield) in jesseduffield/lazygit#4694
- Update the peter-evans/create-pull-request action to v7 by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4695
- Update release workflow by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4703
- Clean up the .gitignore file by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4706
- Remove unused code and texts by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4715
- Remove deprecated edit configs by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4716
- Bump minimum required git version to 2.32 by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4718
- Use a better way of pinning the version of golangci-lint by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4733
- Make the minimum required git version a placeholder in the error text by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4778
- refactor: use slices.Equal to simplify code by [@&#8203;jishudashu](https://github.com/jishudashu) in jesseduffield/lazygit#4764

##### Docs 📖

- Fix broken markdown in auto-generated keybindings documentation by [@&#8203;KEY60228](https://github.com/KEY60228) in jesseduffield/lazygit#4690
- Remove the homebrew tap from the readme by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4705

##### I18n 🌎

- Update translations from Crowdin by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4791

##### Performance Improvements 📊

- Fix performance regression on startup in repos with many tags by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4777

#### New Contributors

- [@&#8203;KEY60228](https://github.com/KEY60228) made their first contribution in jesseduffield/lazygit#4690
- [@&#8203;DawidPietrykowski](https://github.com/DawidPietrykowski) made their first contribution in jesseduffield/lazygit#4727
- [@&#8203;rtzll](https://github.com/rtzll) made their first contribution in jesseduffield/lazygit#4741
- [@&#8203;chojs23](https://github.com/chojs23) made their first contribution in jesseduffield/lazygit#4776
- [@&#8203;jishudashu](https://github.com/jishudashu) made their first contribution in jesseduffield/lazygit#4764

**Full Changelog**: jesseduffield/lazygit@v0.53.0...v0.54.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this MR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS40Ni43IiwidXBkYXRlZEluVmVyIjoiNDEuNDYuNyIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiUmVub3ZhdGUgQm90Il19-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant