Open FedericoMuciaccia opened 5 months ago
Would also like to add that this occurs in the subdirectory of a bare work tree root. For example, if I have a directory that contains a .bare
directory with a .git
file that points git to it (let's call this directory the "work tree root")...
[2024-08-15 09:16:19]» ls -al
total 64
drwxrwxr-x 15 chb chb 4096 Aug 15 09:12 .
drwxrwxr-x 67 chb chb 4096 Aug 9 18:30 ..
drwxrwxr-x 10 chb chb 4096 Aug 15 09:09 .bare
drwxrwxr-x 8 chb chb 4096 Jun 13 15:17 docs-and-diagrams
-rw-rw-r-- 1 chb chb 16 May 9 2023 .git
drwxrwxr-x 8 chb chb 4096 Jun 10 08:45 main
drwxrwxr-x 3 chb adm 4096 Apr 17 14:43 RWEB-8332-redis-logging
and then I change to what was once a worktree directory (in the eg above, RWEB-8332-redis-logging
)...
[2024-08-15 09:16:20]» cd RWEB-8332-redis-logging
[2024-08-15 09:19:08]» ls -al
total 12
drwxrwxr-x 3 chb adm 4096 Apr 17 14:43 .
drwxrwxr-x 15 chb chb 4096 Aug 15 09:12 ..
drwxrwxr-x 2 chb adm 4096 Apr 17 14:43 .idea
The directory is now empty of git
artifacts. If I run lazygit
inside of this directory, I get the following:
[2024-08-15 09:12:36]» lg │
2024/08/15 09:12:37 An error occurred! Please create an issue at: https://github.com/jesseduffield/lazygit/issues │
│
*errors.errorString 'git -C /home/chb/code/work/pbs/terraform-pbsorg/RWEB-8332-redis-logging rev-parse --path-format=absolute --show-toplevel --absolute-git-di│
r --git-common-dir --is-bare-repository --show-superproject-working-tree' failed: fatal: this operation must be run in a work tree │
│
/home/runner/work/lazygit/lazygit/pkg/commands/git_commands/repo_paths.go:147 (0x9bd5f8) │
/home/runner/work/lazygit/lazygit/pkg/commands/git_commands/repo_paths.go:91 (0x9bcdc8) │
/home/runner/work/lazygit/lazygit/pkg/commands/git_commands/repo_paths.go:83 (0x9bcc8c) │
/home/runner/work/lazygit/lazygit/pkg/app/app.go:123 (0xbcaa79) │
/home/runner/work/lazygit/lazygit/pkg/app/app.go:45 (0xbca318) │
/home/runner/work/lazygit/lazygit/pkg/app/entry_point.go:161 (0xbcc597) │
/home/runner/work/lazygit/lazygit/main.go:23 (0xbcdef8) │
/opt/hostedtoolcache/go/1.22.5/x64/src/runtime/internal/atomic/types.go:194 (0x43ff5d) │
/opt/hostedtoolcache/go/1.22.5/x64/src/runtime/asm_amd64.s:1695 (0x477e81) │
[2024-08-15 09:19:10]» lazygit --version
commit=71ad3fac63a3ef3326021837b49e9497d332818b, build date=2024-07-13T10:24:19Z, build source=binaryRelease, version=0.43.1, os=linux, arch=amd64, git version
=2.46.0
Describe the bug Lazygit crashes when invoked from the .git folder of a regular local Git repository.
Way to Reproduce it The following commands
result in the following error:
Expected behavior Clean exit with a clear error message (like "Error: must be run inside the main folder of a git repository")
Version info: