Repository: jesseduffield/lazygit (language: go)

Issue:
Opening outside of the git repository results in error and exits
**Describe the bug**
Opening outside of the git repository results in error and exits with the following message:
`2024/07/12 14:07:03 Error: must be run inside a git repository`

**To Reproduce**
Steps to reproduce the behavior:

1. Try to launch `lazygit` outside of a git repository
2. `lazygit` emits the error message and exits

**Expected behavior**
It shoud behave in a way specified by the `notARepository` setting.

**Version info:**
_Run `lazygit --version` and paste the result here_
`commit=e0377f2bc, build date=20240712.112152, build source=unknown, version=v0.42.0.e0377f2bc, os=linux, arch=amd64, git version=2.45.2`

**Additional context**
It worked normally in
`commit=6fcb7eb8b, build date=20240519.113145, build source=unknown, version=v0.42.0.6fcb7eb8b, os=linux, arch=amd64, git version=2.45.2`



Discussion / hints:
Issue persists in version 43:
commit=, build date=, build source=homebrew, version=0.43.1, os=linux (WSL), arch=amd64, git version=2.45.2
Same in 0.43.1
```
commit=v0.43.1, build date=2024-07-13T16:14:46Z, build source=binaryRelease, version=0.43.1, os=linux, arch=amd64, git version=2.45.2
```

same here
```commit=71ad3fac63a3ef3326021837b49e9497d332818b, build date=2024-07-13T10:24:19Z, build source=binaryRelease, version=0.43.1, os=linux, arch=amd64, git version=2.39.2```
Same with 0.43.1
I've been able to track the regression to 7a67096. [This](https://github.com/jesseduffield/lazygit/blob/f598da0df2c778f94ec6f6636a259fc96eb0d8b7/pkg/app/app.go#L121C1-L121C76) comment is actually wrong, since `GetRepoPaths` will return an error if we are not in a git repo, causing `NewApp` to error out before we call `setupRepo` and parse the logic in the user's configuration file.

Fix patch:
diff --git a/pkg/app/app.go b/pkg/app/app.go
index e12461e2803..755f707c493 100644
--- a/pkg/app/app.go
+++ b/pkg/app/app.go
@@ -118,11 +118,11 @@ func NewApp(config config.AppConfigurer, test integrationTypes.IntegrationTest,
 		return app, err
 	}
 
-	// If we're not in a repo, repoPaths will be nil. The error is moot for us
+	// If we're not in a repo, GetRepoPaths will return an error. The error is moot for us
 	// at this stage, since we'll try to init a new repo in setupRepo(), below
 	repoPaths, err := git_commands.GetRepoPaths(app.OSCommand.Cmd, gitVersion)
 	if err != nil {
-		return app, err
+		common.Log.Infof("Error getting repo paths: %v", err)
 	}
 
 	showRecentRepos, err := app.setupRepo(repoPaths)


Test patch: