jesseduffield / jesseduffield/lazygit

crash when starting lazygit in a git submodule repo

Open
#3,322 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
Go
Stars
82.4k
Forks
3k
Avg merge
2d 18h
Merged PRs (30d)
19

Description

**Describe the bug**
Lazygit is crashing when I'm trying to run it from a git submodule

**To Reproduce**
- navigate into the folder of the submodule, e.g.:
config_files/clink/clink-completions
where `config_files` is my repo, `clink-completions` a submodule [clink-completions](https://github.com/vladimir-kotikov/clink-completions)
- run lazygit.exe

**Expected behavior**
lazygit starts

**Screenshots**
````
*errors.errorString Error getting repo paths: failed to get repo git dir path: could not find git dir for C:/Users/bw1faeh0/configFiles/clink/clink-completions
/home/runner/work/lazygit/lazygit/pkg/commands/git.go:100 (0x75609a)
/home/runner/work/lazygit/lazygit/pkg/gui/gui.go:271 (0x888fb4)
/home/runner/work/lazygit/lazygit/pkg/gui/gui.go:656 (0x88bb38)
/home/runner/work/lazygit/lazygit/pkg/gui/gui.go:675 (0x88c14c)
/home/runner/work/lazygit/lazygit/pkg/utils/utils.go:108 (0x5be7e7)
/home/runner/work/lazygit/lazygit/pkg/gui/gui.go:674 (0x88c094)
/home/runner/work/lazygit/lazygit/pkg/app/app.go:263 (0x8ba7c9)
/home/runner/work/lazygit/lazygit/pkg/app/app.go:48 (0x8ba75e)
/home/runner/work/lazygit/lazygit/pkg/app/entry_point.go:154 (0x8bc9f1)
/home/runner/work/lazygit/lazygit/main.go:23 (0x8be27e)
/opt/hostedtoolcache/go/1.20.7/x64/src/runtime/internal/atomic/types.go:194 (0x1ca2d7)
/opt/hostedtoolcache/go/1.20.7/x64/src/runtime/asm_amd64.s:1598 (0x1f72e1)
````

**Version info:**
`commit=7847203d6e8e89d4f5dc52ac167a219b0bd69d5f, build date=2023-08-05T06:20:46Z, build source=binaryRelease, version=0.40.0, os=windows, arch=amd64, git version=2.43.0.windows.1`
`git version 2.43.0.windows.1`

**Additional context**
When I run lazygit from the root of my repo (which refers to the submodules) and I navigate to the submodules using lazygit, it displays the submodules correctly:
![grafik](https://github.com/jesseduffield/lazygit/assets/29235332/57b0c636-624e-402c-9a71-0e307535e74f)
![grafik](https://github.com/jesseduffield/lazygit/assets/29235332/f25a24f4-07b5-4aeb-8314-47dfcbcb7a36)

Hitting `Enter` in this state to dive into the submodule, lazygit crashes:
````
Switching \panic: runtime error: invalid memory address or nil pointer dereferenceJump to panel, H/L: Scroll left/right Donate Ask Question 0.40.0
[signal 0xc0000005 code=0x0 addr=0xd0 pc=0x804aa2]

goroutine 213 [running]:

github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers.(*RefreshHelper).refreshStashEntries(0xc00007e340)
/home/runne2)d
````

Log-Content from this crash:
````
Feb 12 09:50:21 |INFO| git for-each-ref --sort=-committerdate --format=%(HEAD)%00%(refname:short)%00%(upstream:short)%00%(upstream:track)%00%(subject)%00%(objectname) refs/heads (95.0248ms)
Feb 12 09:50:21 |INFO| postRefreshUpdate for localBranches took 0s
Feb 12 09:50:21 |DEBU| using cache for key rebase.updateRefs
Feb 12 09:50:22 |INFO| git rev-parse --abbrev-ref --verify HEAD (83.1019ms)
Feb 12 09:50:22 |DEBU| using cache for key rebase.updateRefs
Feb 12 09:50:22 |INFO| postRefreshUpdate for commits took 4.3608ms
Feb 12 09:50:25 |DEBU| RunCommand command="git rev-parse --git-dir"
Feb 12 09:50:25 |INFO| git rev-parse --git-dir (83.4954ms)
Feb 12 09:50:25 |INFO| refreshing all scopes in async mode
Feb 12 09:50:25 |INFO| Refresh took 0s
Feb 12 09:50:51 |DEBU| RunCommand command="git worktree list --porcelain"
Feb 12 09:50:51 |DEBU| RunCommand command="git rev-parse --symbolic-full-name main@{u}"
Feb 12 09:50:51 |DEBU| RunCommand command="git for-each-ref --sort=-committerdate --format=%(HEAD)%00%(refname:short)%00%(upstream:short)%00%(upstream:track)%00%(subject)%00%(objectname) refs/heads"
Feb 12 09:50:51 |DEBU| RunCommand command="git rev-parse --symbolic-full-name master@{u}"
Feb 12 09:50:51 |INFO| git stash list -z --pretty=%gs (142.9725ms)
Feb 12 09:50:51 |INFO| git tag --list -n --sort=-creatordate (142.3768ms)
Feb 12 09:50:51 |INFO| postRefreshUpdate for tags took 0s
Feb 12 09:50:51 |INFO| postRefreshUpdate for stash took 0s
Feb 12 09:50:51 |INFO| git -c log.showSignature=false log -g --abbrev=40 --format=%h%x00%ct%x00%gs%x00%p (160.7421ms)
Feb 12 09:50:51 |INFO| postRefreshUpdate for reflogCommits took 2.2271ms
Feb 12 09:50:52 |DEBU| using cache for key rebase.updateRefs
Feb 12 09:50:52 |INFO| git status --untracked-files=all --porcelain -z (269.7325ms)
Feb 12 09:50:52 |INFO| postRefreshUpdate for submodules took 557.6µs
Feb 12 09:50:52 |DEBU| RunCommand command="git diff --submodule --no-ext-diff --unified=3 --color=always -- gitconfig"
Feb 12 09:50:52 |INFO| postRefreshUpdate for files took 8.0309ms
Feb 12 09:50:52 |INFO| git merge-base HEAD refs/remotes/origin/master (88.7285ms)
Feb 12 09:50:52 |DEBU| RunCommand command="git rev-parse --abbrev-ref --verify HEAD"
Feb 12 09:50:52 |INFO| git rev-parse --abbrev-ref --verify HEAD (90.2373ms)
Feb 12 09:50:52 |DEBU| using cache for key rebase.updateRefs
Feb 12 09:50:52 |INFO| postRefreshUpdate for commits took 6.4632ms
Feb 12 09:50:53 |INFO| git log HEAD --topo-order --oneline --pretty=format:%H%x00%at%x00%aN%x00%ae%x00%D%x00%p%x00%s --abbrev=40 -300 --no-show-signature -- (141.4707ms)
Feb 12 09:50:53 |INFO| git tag --list -n --sort=-creatordate (142.5687ms)
Feb 12 09:50:53 |INFO| postRefreshUpdate for tags took 0s
Feb 12 09:50:53 |DEBU| RunCommand command="git rev-parse --abbrev-ref --verify HEAD"
Feb 12 09:50:53 |INFO| git for-each-ref --sort=-committerdate --format=%(HEAD)%00%(refname:short)%00%(upstream:short)%00%(upstream:track)%00%(subject)%00%(objectname) refs/heads (82.6656ms)
Feb 12 09:50:53 |INFO| postRefreshUpdate for localBranches took 36.3µs
Feb 12 09:50:53 |DEBU| using cache for key rebase.updateRefs
Feb 12 09:50:53 |INFO| git rev-parse --abbrev-ref --verify HEAD (83.7327ms)
Feb 12 09:50:53 |DEBU| using cache for key rebase.updateRefs
Feb 12 09:50:53 |INFO| postRefreshUpdate for commits took 5.0386ms
Feb 12 09:50:54 |DEBU| RunCommand command="git rev-parse --git-dir"
Feb 12 09:50:54 |INFO| git rev-parse --git-dir (81.1593ms)
Feb 12 09:50:54 |INFO| refreshing all scopes in async mode
Feb 12 09:50:54 |INFO| Refresh took 0s
````

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.