jesseduffield / jesseduffield/lazygit

Failed to start lazygit from the directory that do not exist (after switching branch)

Open
#3,088 3 comments 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**
Once I switched the branch, exit lazygit. The branch I switched to do not have the directory, from where I executed lazygit command. Executing lazygit command is resulting in an error.

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

1. I switched the branch (inside lazygit), and exit lazygit where the current working directory do not exists in the branch switched to
2. open lazygit again

**Expected behavior**
Throw some error text about the directory do not exist

**Screenshots**
```
2023/10/23 03:05:20 An error occur
red! Please create an issue at: https://github.com/jesseduffield/lazygit/issues

*os.SyscallError getwd: no such file or directory
github.com/jesseduffield/lazygit/pkg/app/app.go:55 (0x562832a91610)
github.com/jesseduffield/lazygit/pkg/app/entry_point.go:150 (0x562832a936ea)
github.com/jesseduffield/lazygit/main.go:23 (0x562832a94e78)
runtime/internal/atomic/types.go:194 (0x5628323eeeb2)
runtime/asm_amd64.s:1650 (0x56283241f121)
```

**Version info:**
```bash
sh-5.1$ 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.0
sh-5.1$ git --version
git version 2.42.0
```

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.