-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Show "Log (x of y)" in the title bar when there is more than one branch log command #4943
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
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.
Coverage summary from CodacySee diff coverage on Codacy
Coverage variation details
Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: Diff coverage details
Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: See your quality gate settings Change summary preferencesFootnotes
|
func (self *BranchCommands) AllBranchesLogCmdObj() *oscommands.CmdObj { | ||
candidates := self.allBranchesLogCandidates() | ||
|
||
if self.allBranchesLogCmdIndex >= len(candidates) { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
Addresses #4939.