diff --git a/pkg/app/entry_point.go b/pkg/app/entry_point.go index fb19f06f6c6..df40854d890 100644 --- a/pkg/app/entry_point.go +++ b/pkg/app/entry_point.go @@ -59,6 +59,11 @@ func Start(buildInfo *BuildInfo, integrationTest integrationTypes.IntegrationTes log.Fatal(err) } + absRepoPath, err = filepath.EvalSymlinks(cliArgs.RepoPath) + if err != nil { + log.Fatal(err) + } + if isRepo, err := isDirectoryAGitRepository(absRepoPath); err != nil || !isRepo { log.Fatal(absRepoPath + " is not a valid git repository.") } diff --git a/pkg/commands/git.go b/pkg/commands/git.go index 51066103416..c9249a0dadf 100644 --- a/pkg/commands/git.go +++ b/pkg/commands/git.go @@ -64,10 +64,21 @@ func NewGitCommand( gitConfig git_config.IGitConfig, ) (*GitCommand, error) { currentPath, err := os.Getwd() + if err != nil { return nil, utils.WrapError(err) } + // Check if the current path is a symlink and walk it + absRepoPath, err := filepath.EvalSymlinks(currentPath) + if err != nil { + return nil, utils.WrapError(err) + } + + if absRepoPath != currentPath { + currentPath = absRepoPath + } + // converting to forward slashes for the sake of windows (which uses backwards slashes). We want everything // to have forward slashes internally currentPath = filepath.ToSlash(currentPath)