MCPcopy Create free account
hub / github.com/LegacyCodeHQ/clarity-cli / ensureRepoRoot

Function ensureRepoRoot

vcs/git/git_ls_files.go:63–76  ·  view source on GitHub ↗
(repoPath string)

Source from the content-addressed store, hash-verified

61}
62
63func ensureRepoRoot(repoPath string) (string, error) {
64 if _, err := os.Stat(repoPath); os.IsNotExist(err) {
65 return "", fmt.Errorf("repository path does not exist: %s", repoPath)
66 }
67 if !isGitRepository(repoPath) {
68 return "", fmt.Errorf("%s is not a git repository (use 'git init' to initialize)", repoPath)
69 }
70
71 repoRoot, err := GetRepositoryRoot(repoPath)
72 if err != nil {
73 return "", fmt.Errorf("failed to get repository root: %w", err)
74 }
75 return filepath.Clean(repoRoot), nil
76}
77
78func parseNullSeparatedPaths(stdout []byte) []string {
79 parts := strings.Split(string(stdout), "\x00")

Callers 2

ListTrackedFilesFunction · 0.85
ListUntrackedFilesFunction · 0.85

Calls 2

isGitRepositoryFunction · 0.85
GetRepositoryRootFunction · 0.85

Tested by

no test coverage detected