From 3232f46a8bbaa5dde12ceea55fabaddff4054172 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luka=20Marku=C5=A1i=C4=87?= Date: Mon, 12 Sep 2022 17:18:42 +0200 Subject: [PATCH] Validate --path argument when starting lazygit --- pkg/app/entry_point.go | 5 +++++ 1 file changed, 5 insertions(+) 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") }