jesseduffield / jesseduffield/lazygit

LazyGit does not open inside a symlink'ed dir (which is under git)

Open
#3,144 2 comments 1 reaction 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**
I have my scripts under git. My dotfiles install script places the scripts under ~/scripts
Trying to open LazyGit when in ~/scripts results in an error like below

```
2023/12/02 21:01:37 An error occurred! Please create an issue at: https://github.com/jesseduffield/lazygit/issues

*errors.errorString Must open lazygit in a git repository
github.com/jesseduffield/lazygit/pkg/commands/git.go:235 (0x560937b08da6)
github.com/jesseduffield/lazygit/pkg/commands/git.go:87 (0x560937b07936)
github.com/jesseduffield/lazygit/pkg/gui/gui.go:271 (0x560937c376eb)
github.com/jesseduffield/lazygit/pkg/gui/gui.go:656 (0x560937c3a2db)
github.com/jesseduffield/lazygit/pkg/gui/gui.go:675 (0x560937c3a9c5)
github.com/jesseduffield/lazygit/pkg/utils/utils.go:108 (0x5609379960fc)
github.com/jesseduffield/lazygit/pkg/gui/gui.go:674 (0x560937c3a90e)
github.com/jesseduffield/lazygit/pkg/app/app.go:263 (0x560937c6657d)
github.com/jesseduffield/lazygit/pkg/app/app.go:48 (0x560937c66512)
github.com/jesseduffield/lazygit/pkg/app/entry_point.go:150 (0x560937c686ea)
github.com/jesseduffield/lazygit/main.go:23 (0x560937c69e78)
runtime/internal/atomic/types.go:194 (0x5609375c3eb2)
runtime/asm_amd64.s:1650 (0x5609375f4121)
```

**To Reproduce**
Steps to reproduce the behavior:

1. Have dir hierarchy under git VCS
2. Symlink (soft) a dir under the tree to another location
3. Navigate to location and try to open LazyGit
4. See error

**Expected behavior**
I expected to follow the symlink back, a dir which is under git.

**Version info:**
❯ lazygit --version
commit=v0.40.2, build date=2023-08-12T17:47:33Z, build source=binaryRelease, version=0.40.2, os=linux, arch=amd64, git version=2.42.1

❯ git --version
git version 2.42.1

**Additional context**
Running the logs I get

```
Tailing log file /home/smitropoulos/.config/lazygit/development.log

Dec 2 21:08:32 |ERRO| fatal: not a git repository (or any parent up to mount point /)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
command="git rev-parse --git-dir"
Dec 2 21:08:32 |INFO| git rev-parse --git-dir (882.795µs)
Dec 2 21:08:42 |INFO| language: en-GB
Dec 2 21:08:42 |DEBU| RunCommand command="git --version"
Dec 2 21:08:42 |INFO| git --version (980.67µs)
Dec 2 21:08:42 |DEBU| RunCommand command="git rev-parse --git-dir"
Dec 2 21:08:42 |INFO| git rev-parse --git-dir (1.058449ms)
Dec 2 21:08:42 |DEBU| RunCommand command="git rev-parse --is-bare-repository"
Dec 2 21:08:42 |INFO| git rev-parse --is-bare-repository (678.929µs)
Dec 2 21:08:42 |ERRO| *errors.errorString Must open lazygit in a git repository
github.com/jesseduffield/lazygit/pkg/commands/git.go:235 (0x555ae98ecda6)
github.com/jesseduffield/lazygit/pkg/commands/git.go:87 (0x555ae98eb936)
github.com/jesseduffield/lazygit/pkg/gui/gui.go:271 (0x555ae9a1b6eb)
github.com/jesseduffield/lazygit/pkg/gui/gui.go:656 (0x555ae9a1e2db)
github.com/jesseduffield/lazygit/pkg/gui/gui.go:675 (0x555ae9a1e9c5)
github.com/jesseduffield/lazygit/pkg/utils/utils.go:108 (0x555ae977a0fc)
github.com/jesseduffield/lazygit/pkg/gui/gui.go:674 (0x555ae9a1e90e)
github.com/jesseduffield/lazygit/pkg/app/app.go:263 (0x555ae9a4a57d)
github.com/jesseduffield/lazygit/pkg/app/app.go:48 (0x555ae9a4a512)
github.com/jesseduffield/lazygit/pkg/app/entry_point.go:150 (0x555ae9a4c6ea)
github.com/jesseduffield/lazygit/main.go:23 (0x555ae9a4de78)
runtime/internal/atomic/types.go:194 (0x555ae93a7eb2)
runtime/asm_amd64.s:1650 (0x555ae93d8121)

```

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.