From adbb3263972f98d2ca2dcbd54ea849fb90e043c6 Mon Sep 17 00:00:00 2001 From: Penpen7 Date: Tue, 5 Nov 2024 03:16:27 +0900 Subject: [PATCH] search git repository not only in specified directory but also in parent directories --- internal/git/repository.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/git/repository.go b/internal/git/repository.go index cb3e32f..a9d4ce1 100644 --- a/internal/git/repository.go +++ b/internal/git/repository.go @@ -17,7 +17,9 @@ type ( ) func GetInfo(repoDir string) (*RepositoryInfo, error) { - repo, err := git.PlainOpen(repoDir) + repo, err := git.PlainOpenWithOptions(repoDir, &git.PlainOpenOptions{ + DetectDotGit: true, + }) if err != nil { return nil, fmt.Errorf("failed to open git repo: %w", err) }