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

Function validateGitRelPath

vcs/git/git.go:60–75  ·  view source on GitHub ↗
(path string)

Source from the content-addressed store, hash-verified

58}
59
60func validateGitRelPath(path string) error {
61 if path == "" {
62 return fmt.Errorf("git path cannot be empty")
63 }
64 if filepath.IsAbs(path) {
65 return fmt.Errorf("git path must be relative: %q", path)
66 }
67 if strings.Contains(path, "\x00") {
68 return fmt.Errorf("git path contains NUL: %q", path)
69 }
70 cleaned := filepath.Clean(path)
71 if cleaned == ".." || strings.HasPrefix(cleaned, ".."+string(filepath.Separator)) {
72 return fmt.Errorf("git path escapes repository: %q", path)
73 }
74 return nil
75}
76
77// validateCommit checks if the given commit reference exists in the repository
78func validateCommit(repoPath, commitID string) error {

Callers 1

GetFileContentFromCommitFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected