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

Function GetCommitDartFiles

vcs/git/git_diff.go:234–266  ·  view source on GitHub ↗

GetCommitDartFiles finds all files that were changed in a specific commit. Returns absolute paths to all files added, modified, or renamed in the commit.

(repoPath, commitID string)

Source from the content-addressed store, hash-verified

232// GetCommitDartFiles finds all files that were changed in a specific commit.
233// Returns absolute paths to all files added, modified, or renamed in the commit.
234func GetCommitDartFiles(repoPath, commitID string) ([]string, error) {
235 // Validate the repository path exists
236 if _, err := os.Stat(repoPath); os.IsNotExist(err) {
237 return nil, fmt.Errorf("repository path does not exist: %s", repoPath)
238 }
239
240 // Verify it's a git repository
241 if !isGitRepository(repoPath) {
242 return nil, fmt.Errorf("%s is not a git repository (use 'git init' to initialize)", repoPath)
243 }
244
245 // Validate the commit exists
246 if err := validateCommit(repoPath, commitID); err != nil {
247 return nil, err
248 }
249
250 // Get the repository root
251 repoRoot, err := GetRepositoryRoot(repoPath)
252 if err != nil {
253 return nil, fmt.Errorf("failed to get repository root: %w", err)
254 }
255
256 // Get files changed in the commit
257 commitFiles, err := getCommitFiles(repoPath, commitID)
258 if err != nil {
259 return nil, fmt.Errorf("failed to get files from commit: %w", err)
260 }
261
262 // Convert to absolute paths (no filtering - include all files)
263 absolutePaths := toAbsolutePaths(repoRoot, commitFiles)
264
265 return absolutePaths, nil
266}
267
268// getCommitFiles returns a list of all files changed in the specified commit (relative to repo root)
269func getCommitFiles(repoPath, commitID string) ([]string, error) {

Calls 5

isGitRepositoryFunction · 0.85
validateCommitFunction · 0.85
GetRepositoryRootFunction · 0.85
getCommitFilesFunction · 0.85
toAbsolutePathsFunction · 0.85