diff options
author | Luka Markušić <luka.markusic@microblink.com> | 2022-09-12 17:18:42 +0200 |
---|---|---|
committer | Luka Markušić <luka.markusic@microblink.com> | 2022-09-12 17:18:42 +0200 |
commit | 3232f46a8bbaa5dde12ceea55fabaddff4054172 (patch) | |
tree | 43d27cb5074e9490eb18de34896d7f89ff3fcd03 | |
parent | de6d278e572f7f79a56323446306a2962487c024 (diff) |
Validate --path argument when starting lazygit
-rw-r--r-- | pkg/app/entry_point.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/pkg/app/entry_point.go b/pkg/app/entry_point.go index 5a767bb94..b355ebcca 100644 --- a/pkg/app/entry_point.go +++ b/pkg/app/entry_point.go @@ -57,6 +57,11 @@ func Start(buildInfo *BuildInfo, integrationTest integrationTypes.IntegrationTes if err != nil { log.Fatal(err) } + + if isRepo, err := isDirectoryAGitRepository(absRepoPath); err != nil || !isRepo { + log.Fatal(absRepoPath + " is not a valid git repository.") + } + cliArgs.WorkTree = absRepoPath cliArgs.GitDir = filepath.Join(absRepoPath, ".git") } |