Skip to content
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

got painc error : index out of range #95

Closed
Xib1uvXi opened this issue Aug 9, 2018 · 5 comments
Closed

got painc error : index out of range #95

Xib1uvXi opened this issue Aug 9, 2018 · 5 comments

Comments

@Xib1uvXi
Copy link

Xib1uvXi commented Aug 9, 2018

OS ENV : Ubuntu 18.04

Git version : 2.17.1

run command : lazygit

git status:

On branch master
nothing to commit, working tree clean
panic: runtime error: index out of range

goroutine 1 [running]:
main.branchInfoFromLine(0xc42026a000, 0x2c, 0xc4200cd680, 0x25, 0x26, 0x0, 0xc42013d988, 0x747bf9)
        /home/qydev/go/src/github.com/jesseduffield/lazygit/gitcommands.go:557 +0x100
main.getBranches(0x842496, 0xa, 0xc420256600)
        /home/qydev/go/src/github.com/jesseduffield/lazygit/gitcommands.go:584 +0x15f
main.getGitBranches(0xc420198120, 0x841032, 0x8)
        /home/qydev/go/src/github.com/jesseduffield/lazygit/gitcommands.go:618 +0x159
main.refreshBranches.func1(0xc420198120, 0x1, 0xc42013dbf0)
        /home/qydev/go/src/github.com/jesseduffield/lazygit/branches_panel.go:111 +0x97
github.com/jesseduffield/lazygit/vendor/github.com/jesseduffield/gocui.(*Gui).consumeevents(0xc420198120, 0x0, 0x0)
        /home/qydev/go/src/github.com/jesseduffield/lazygit/vendor/github.com/jesseduffield/gocui/gui.go:414 +0x17c
github.com/jesseduffield/lazygit/vendor/github.com/jesseduffield/gocui.(*Gui).MainLoop(0xc420198120, 0x0, 0x0)
        /home/qydev/go/src/github.com/jesseduffield/lazygit/vendor/github.com/jesseduffield/gocui/gui.go:396 +0x1f5
main.run(0x0, 0x0)
        /home/qydev/go/src/github.com/jesseduffield/lazygit/gui.go:261 +0x161
main.main()
        /home/qydev/go/src/github.com/jesseduffield/lazygit/main.go:121 +0xd7

@jesseduffield
Copy link
Owner

jesseduffield commented Aug 9, 2018

The function branchInfoFromLine() processes the output from the command

git reflog -n100 --pretty='%cr|%gs' --grep-reflog='checkout: moving' HEAD

It expects each line to look like '3 days ago|checkout: moving from feature/use-dep to master'
it them strips it down to 3 days ago master using this regex "\\|.*\\s"(replacing everything that matches with a string). It then takes the 1st, 3rd, and 4th words to get the line you see in the branches panel. It looks like one of your lines isn't ending up with 4 words after we process it.

If there's nothing confidential in the output of that git reflog command, please post it here. Otherwise, could you check to see if there are any lines in the output that don't match our expected format?

@Swenson1992
Copy link

image
only a line

@jesseduffield
Copy link
Owner

jesseduffield commented Aug 14, 2018

@songjian925 @Xib1uvXi This should be resolved in #146
But it looks like the cause of the issue is due to different locales defining time units differently. The original code expected something like '7 days ago' and then processed that to get '7d'. So although this will solve the bug, it might look funny in the list.

There is currently a PR up #137 for doing i18n, feel free to contribute to that effort if you want to get involved in any translations :)

Please pull down the latest release and see if this solves your issue

@glvr182
Copy link
Contributor

glvr182 commented Aug 19, 2018

@Xib1uvXi Is your bug fixed in the latest version?

@Xib1uvXi
Copy link
Author

@glvr182 yep

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants