Skip to content

Conversation

stefanhaller
Copy link
Collaborator

Addresses #4939.

@stefanhaller stefanhaller added the enhancement New feature or request label Oct 7, 2025
@stefanhaller stefanhaller linked an issue Oct 7, 2025 that may be closed by this pull request
Copy link

codacy-production bot commented Oct 7, 2025

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
Report missing for 47ca0821 87.50%
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (47ca082) Report Missing Report Missing Report Missing
Head commit (5d02cba) 58245 50653 86.97%

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 (#4943) 16 14 87.50%

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.

func (self *BranchCommands) AllBranchesLogCmdObj() *oscommands.CmdObj {
candidates := self.allBranchesLogCandidates()

if self.allBranchesLogCmdIndex >= len(candidates) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how to test this? isnt this impossible?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a real crash that I ran into during testing. You can reproduce this by configuring three log commands, pressing a to select the last one of those, and then (while lazygit is running) editing the config file again to remove one of the log commands. When you return to lazygit it will reload the config file, and crash.

PS It's always a good idea to look at commit messages when reviewing a PR, it's mentioned there.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PS It's always a good idea to look at commit messages when reviewing a PR, it's mentioned there.

thats the reason why i use lazygit ❤️

I know that uint was chosen to document that it can't be negative (not sure why
the "8" was chosen, though). That's pointless in languages that don't enforce
this though: you can subtract 1 from uint8(0) and you'll get something that
doesn't make sense; that's not any better than getting -1. I'm not a fan of
using unsigned types in general (at least in languages like go or C++), and they
usually just make the code more cumbersome without real benefits.
… log command

When cycling to the last branch log command, and then editing the config to
remove one or more log commands, lazygit would crash with an out of bounds panic
when returning to it. Fix this by resetting the log index to 0 when it is out of
bounds. (I think resetting to 0 is better than clamping, although it doesn't
matter much.)
Doesn't make a difference currently, since the title is either StatusTitle when
the dashboard is showing, or LogTitle when one of the branch logs is showing.
This is going to change in the next commit, though.
@stefanhaller stefanhaller force-pushed the show-index-of-all-branches-log-command branch from bee6f6c to 5d02cba Compare October 10, 2025 10:49
@stefanhaller stefanhaller merged commit 8e00bbd into master Oct 10, 2025
12 checks passed
@stefanhaller stefanhaller deleted the show-index-of-all-branches-log-command branch October 10, 2025 10:51
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.

Allow Cycling Backward Between Git Log Configurations

2 participants