jesseduffield / lazygit

simple terminal UI for git commands
MIT License
50.97k stars 1.79k forks source link

Lazygit crashed on adding github SSH remote #3512

Closed mrvanes closed 4 months ago

mrvanes commented 5 months ago

Describe the bug Lazygit crashed when I replaced github SSH remote (because of a repository rename).

To Reproduce Steps to reproduce the behavior:

  1. Activate remotes panel
  2. Remove all remotes from local clone (d)
  3. Add new remote (n, name: origin, url: github SSH link)
  4. See error
$ lg
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x81712e]

goroutine 820 [running]:
github.com/jesseduffield/lazygit/pkg/commands/models.(*Remote).RefName(...)
        /home/runner/work/lazygit/lazygit/pkg/commands/models/remote.go:11
github.com/jesseduffield/lazygit/pkg/commands/models.(*Remote).ID(...)
        /home/runner/work/lazygit/lazygit/pkg/commands/models/remote.go:15
github.com/jesseduffield/lazygit/pkg/commands/models.(*Remote).URN(0x410645?)
        /home/runner/work/lazygit/lazygit/pkg/commands/models/remote.go:19 +0xe
github.com/jesseduffield/lazygit/pkg/gui.(*StateAccessor).SetItemOperation(0xc000078830, {0xe59c80, 0x0}, 0x5)
        /home/runner/work/lazygit/lazygit/pkg/gui/gui.go:202 +0xae
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers.(*InlineStatusHelper).WithInlineStatus.func2({0xe5f030, 0xc00065e018})
        /home/runner/work/lazygit/lazygit/pkg/gui/controllers/helpers/inline_status_helper.go:88 +0x8e
github.com/jesseduffield/lazygit/pkg/gui.NewGui.func5.(*AppStatusHelper).WithWaitingStatus.func1.1(0xc0007b2000?)
        /home/runner/work/lazygit/lazygit/pkg/gui/controllers/helpers/app_status_helper.go:65 +0x6f
github.com/jesseduffield/lazygit/pkg/gui/status.(*StatusManager).WithWaitingStatus(0xc0002b8a20, {0xd008fc, 0x8}, 0xc000292000, 0xc0003a1730)
        /home/runner/work/lazygit/lazygit/pkg/gui/status/status_manager.go:54 +0xb6
github.com/jesseduffield/lazygit/pkg/gui.NewGui.func5.(*AppStatusHelper).WithWaitingStatus.func1({0xe5eff8?, 0xc00088e100})
        /home/runner/work/lazygit/lazygit/pkg/gui/controllers/helpers/app_status_helper.go:64 +0xfa
github.com/jesseduffield/gocui.(*Gui).onWorkerAux(0x74b4ac?, 0xc00016e000?, {0xe5eff8?, 0xc00088e100?})
        /home/runner/work/lazygit/lazygit/vendor/github.com/jesseduffield/gocui/gui.go:680 +0x66
github.com/jesseduffield/gocui.(*Gui).OnWorker.func1()
        /home/runner/work/lazygit/lazygit/vendor/github.com/jesseduffield/gocui/gui.go:667 +0x2b
created by github.com/jesseduffield/gocui.(*Gui).OnWorker in goroutine 1
        /home/runner/work/lazygit/lazygit/vendor/github.com/jesseduffield/gocui/gui.go:666 +0x92

The remote actually was added to the clone.

Expected behavior I would expect lazygit to accept the remote without crashing.

Version info: commit=3675570a391b1a49ddd198b4c7e71e17701d4404, build date=2024-03-23T09:09:11Z, build source=binaryRelease, version=0.41.0, os=linux, arch=amd64, git version=2.40.1

git version 2.40.1

mark2185 commented 4 months ago

I can't seem to reproduce it.

How often does it reproduce for you? And does it still happen if you do it on a new clone of that repo?

mrvanes commented 4 months ago

I can't reproduce, let's close the issue.