Skip to content

Conversation

stefanhaller
Copy link
Collaborator

This can be useful if you want to do some operation on the filtered file, e.g. check it out using c, or enter the file to make a custom patch from it.

Addresses #4935.

Copy link

codacy-production bot commented Oct 6, 2025

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
Report missing for fb005841 100.00%
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (fb00584) Report Missing Report Missing Report Missing
Head commit (7fe73c1) 58231 50652 86.98%

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 (#4942) 87 87 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.

@mikavilpas
Copy link

Works great with e.g. lazygit --filter pkg/gui/filetree/commit_file_tree_view_model.go

A minor finding: for absolute paths, --filter itself seems to work, but this new feature focuses on the first directory/file when opening the commit with enter.

Reproduction: lazygit --filter $(pwd)/pkg/gui/filetree/commit_file_tree_view_model.go

@stefanhaller stefanhaller force-pushed the select-filtered-file-when-entering-commit-files branch from 5c9e712 to c2d83f9 Compare October 8, 2025 08:48
@stefanhaller
Copy link
Collaborator Author

Thanks for checking. I added a fixup (c2d83f9) to solve the issue with absolute paths, and also made it work on Windows when you call it with a path that contains backslashes.

I didn't notice these things because I never use the --filter option, I only ever filter from within lazygit using its ctrl-s menu, in which case neither problem occurs.

@mikavilpas
Copy link

Absolute paths also work great now! 👍🏻

@stefanhaller stefanhaller force-pushed the select-filtered-file-when-entering-commit-files branch from c2d83f9 to 7fe73c1 Compare October 9, 2025 07:58
@stefanhaller stefanhaller enabled auto-merge October 9, 2025 07:58
@stefanhaller stefanhaller linked an issue Oct 9, 2025 that may be closed by this pull request
@stefanhaller stefanhaller merged commit 4b59f98 into master Oct 9, 2025
12 checks passed
@stefanhaller stefanhaller deleted the select-filtered-file-when-entering-commit-files branch October 9, 2025 08:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Help focusing on filtered file when viewing commit files

2 participants