jesseduffield / lazygit

simple terminal UI for git commands
MIT License
53.82k stars 1.88k forks source link

Graph is (can be) buggy when showWholeGraph true in some cases #3973

Open ADIX7 opened 1 month ago

ADIX7 commented 1 month ago

Describe the bug When using showWholeGraph the graph is the commits panel works as expected, but when opening the commits of a branch (so pressing Enter on a branch name) the graph bugs. It is quite interesting so not so easy to explain. All the "content" (commit hash, author, commit message) is correct but the graph (where the dots are and where the lines go) is not, the graph is actually the one that is shown in the Commits panel. So it looks like as if the branch specific view does get a list of commits with the correct data and displays the commits hash, author, commit message correctly based on that but for drawing the graph it uses (or not filters?) all the commits. Also, while the correct commit line is highlighted, on the graph the wrong dots and lines are the ones that are highlighted. It seems that the one that is highlighted is the one that should be at the commit that is currently selected but because other commits are also shown the "commit line" and the graph "dot" is not at the correct place.

I tried to debug this, check the git commands, but lazygit --debug crashes:

POTENTIAL DEADLOCK: Recursive locking:
current goroutine 2 lock 0xc000356350
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers/refresh_helper.go:504 helpers.(*RefreshHelper).refreshBranches ??? <<<<<
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers/refresh_helper.go:503 helpers.(*RefreshHelper).refreshBranches ???
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers/refresh_helper.go:273 helpers.(*RefreshHelper).refreshReflogAndBranches ???
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers/refresh_helper.go:129 helpers.(*RefreshHelper).Refresh.func2.2 ???
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers/refresh_helper.go:107 helpers.(*RefreshHelper).Refresh.func2.1.1 ???
github.com/jesseduffield/gocui@v0.3.1-0.20240906064314-bfab49c720d7/gui.go:702 gocui.(*Gui).onWorkerAux ???
github.com/jesseduffield/gocui@v0.3.1-0.20240906064314-bfab49c720d7/task.go:22 gocui.(*TaskImpl).Done ???

Previous place where the lock was grabbed (same goroutine)
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers/refresh_helper.go:322 helpers.(*RefreshHelper).refreshCommitsWithLimit ??? <<<<<
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers/refresh_helper.go:321 helpers.(*RefreshHelper).refreshCommitsWithLimit ???
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers/refresh_helper.go:277 helpers.(*RefreshHelper).refreshCommitsAndCommitFiles ???
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers/refresh_helper.go:107 helpers.(*RefreshHelper).Refresh.func2.1.1 ???
github.com/jesseduffield/gocui@v0.3.1-0.20240906064314-bfab49c720d7/gui.go:702 gocui.(*Gui).onWorkerAux ???
github.com/jesseduffield/gocui@v0.3.1-0.20240906064314-bfab49c720d7/task.go:22 gocui.(*TaskImpl).Done ???

Other goroutines holding locks:
goroutine 2 lock 0xc000356340
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers/refresh_helper.go:442 helpers.(*RefreshHelper).refreshBranches ??? <<<<<
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers/refresh_helper.go:441 helpers.(*RefreshHelper).refreshBranches ???
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers/refresh_helper.go:273 helpers.(*RefreshHelper).refreshReflogAndBranches ???
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers/refresh_helper.go:129 helpers.(*RefreshHelper).Refresh.func2.2 ???
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers/refresh_helper.go:107 helpers.(*RefreshHelper).Refresh.func2.1.1 ???
github.com/jesseduffield/gocui@v0.3.1-0.20240906064314-bfab49c720d7/gui.go:702 gocui.(*Gui).onWorkerAux ???
github.com/jesseduffield/gocui@v0.3.1-0.20240906064314-bfab49c720d7/task.go:22 gocui.(*TaskImpl).Done ???

To Reproduce Tried to create a minimal repository to reproduce, but I could not, so this must be an edge case. Still trying to create a repo where this also happens.

Expected behavior Correctly show the graph

Screenshots kép kép

Version info: Lazygit version: commit=, build date=, build source=homebrew, version=0.44.1, os=linux, arch=amd64, git version=2.46.2

Git version: git version 2.46.2

phanirithvij commented 2 days ago

lazygit --debug crashes

https://github.com/jesseduffield/lazygit/issues/4002