mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-10-08 22:52:12 +02:00
Change allBranchesLogCmdIndex to an int
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.
This commit is contained in:
@@ -13,7 +13,7 @@ import (
|
||||
|
||||
type BranchCommands struct {
|
||||
*GitCommon
|
||||
allBranchesLogCmdIndex uint8 // keeps track of current all branches log command
|
||||
allBranchesLogCmdIndex int // keeps track of current all branches log command
|
||||
}
|
||||
|
||||
func NewBranchCommands(gitCommon *GitCommon) *BranchCommands {
|
||||
@@ -285,7 +285,7 @@ func (self *BranchCommands) AllBranchesLogCmdObj() *oscommands.CmdObj {
|
||||
func (self *BranchCommands) RotateAllBranchesLogIdx() {
|
||||
n := len(self.allBranchesLogCandidates())
|
||||
i := self.allBranchesLogCmdIndex
|
||||
self.allBranchesLogCmdIndex = uint8((int(i) + 1) % n)
|
||||
self.allBranchesLogCmdIndex = (i + 1) % n
|
||||
}
|
||||
|
||||
func (self *BranchCommands) IsBranchMerged(branch *models.Branch, mainBranches *MainBranches) (bool, error) {
|
||||
|
Reference in New Issue
Block a user