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

[Bug] Lazygit crashes when inside a link to a subdirectory of a git repo #3102

Closed
aarondill opened this issue Oct 31, 2023 · 1 comment
Closed
Labels
bug Something isn't working

Comments

@aarondill
Copy link

Describe the bug
When the PWD is within a link to a subdirectory of a valid git repo, opening lazygit results in the following error:

> lg --version
commit=5e388e21c8ca6aa883dbcbe45c47f6fdd5116815, build date=2023-08-07T14:05:48Z, build source=binaryRelease, version=0.40.2, os=linux, arch=amd64, git version=2.34.1
> lg
2023/10/31 07:20:00 An error occurred! Please create an issue at: https://github.com/jesseduffield/lazygit/issues

*errors.errorString Must open lazygit in a git repository
/home/runner/work/lazygit/lazygit/pkg/commands/git.go:235 (0x9bbea6)
/home/runner/work/lazygit/lazygit/pkg/commands/git.go:87 (0x9ba88f)
/home/runner/work/lazygit/lazygit/pkg/gui/gui.go:271 (0xaedbf4)
/home/runner/work/lazygit/lazygit/pkg/gui/gui.go:656 (0xaf0798)
/home/runner/work/lazygit/lazygit/pkg/gui/gui.go:675 (0xaf0dac)
/home/runner/work/lazygit/lazygit/pkg/utils/utils.go:108 (0x82b2c7)
/home/runner/work/lazygit/lazygit/pkg/gui/gui.go:674 (0xaf0cf4)
/home/runner/work/lazygit/lazygit/pkg/app/app.go:263 (0xb1afe9)
/home/runner/work/lazygit/lazygit/pkg/app/app.go:48 (0xb1af7e)
/home/runner/work/lazygit/lazygit/pkg/app/entry_point.go:150 (0xb1d286)
/home/runner/work/lazygit/lazygit/main.go:23 (0xb1eb1e)
/opt/hostedtoolcache/go/1.20.7/x64/src/runtime/internal/atomic/types.go:194 (0x437c87)
/opt/hostedtoolcache/go/1.20.7/x64/src/runtime/asm_amd64.s:1598 (0x467ec1)

To Reproduce

Here is a short repro script: https://gist.github.com/aarondill/c10ec7712778c36c7c8c725cb6171646

Expected behavior

Don't crash. I expected lazygit to simply do the normal notARepository action.

Version info:

 > git --version
git version 2.34.1
> lazygit --version
commit=5e388e21c8ca6aa883dbcbe45c47f6fdd5116815, build date=2023-08-07T14:05:48Z, build source=binaryRelease, version=0.40.2, os=linux, arch=amd64, git version=2.34.1

Additional context

It seems that git rev-parse --git-dir will return the gitdir of the non-symlinked file, while I would expect it to throw, like I wasn't in a git repo.

@aarondill aarondill added the bug Something isn't working label Oct 31, 2023
@mark2185
Copy link
Collaborator

Should be solved by #3017 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants