Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Show a friendly error message when starting lazygit from a non-existe…
…nt cwd (#3192) Closes #3187 - **PR Description** #3187 observes that lazygit crashes with a stack trace if it's run from a non-existent current working directory. The steps to reproduce are: ``` mkdir test cd test rm -r ../test lazygit ``` (Note: I can repro this on Ubuntu, but not on macOS Sonoma, where lazygit starts regardless of whether the current working directory exists or not.) Here's how the repro steps look on Ubuntu with this PR applied: ``` simon@ubuntu:/Users/simon/src/3p/lazygit$ go build . simon@ubuntu:/Users/simon/src/3p/lazygit$ mkdir deleteme simon@ubuntu:/Users/simon/src/3p/lazygit$ cd deleteme/ simon@ubuntu:/Users/simon/src/3p/lazygit/deleteme$ rm -r ../deleteme simon@ubuntu:/Users/simon/src/3p/lazygit/deleteme$ ../lazygit 2024/01/02 18:40:15 Error: the current working directory does not exist ``` - **Please check if the PR fulfills these requirements** * [x] Cheatsheets are up-to-date (run `go generate ./...`) * [x] Code has been formatted (see [here](https://github.com/jesseduffield/lazygit/blob/master/CONTRIBUTING.md#code-formatting)) * [x] Tests have been added/updated (see [here](https://github.com/jesseduffield/lazygit/blob/master/pkg/integration/README.md) for the integration test guide) * [x] Text is internationalised (see [here](https://github.com/jesseduffield/lazygit/blob/master/CONTRIBUTING.md#internationalisation)) * [x] Docs (specifically `docs/Config.md`) have been updated if necessary * [x] You've read through your own file changes for silly mistakes etc <!-- Be sure to name your PR with an imperative e.g. 'Add worktrees view' see https://github.com/jesseduffield/lazygit/releases/tag/v0.40.0 for examples -->
- Loading branch information