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

Function GetCommitRangeDeletedFiles

vcs/git/git_diff.go:321–346  ·  view source on GitHub ↗

GetCommitRangeDeletedFiles finds all files deleted between two commits. Returns absolute paths. Their content should be read from fromCommit.

(repoPath, fromCommit, toCommit string)

Source from the content-addressed store, hash-verified

319// GetCommitRangeDeletedFiles finds all files deleted between two commits.
320// Returns absolute paths. Their content should be read from fromCommit.
321func GetCommitRangeDeletedFiles(repoPath, fromCommit, toCommit string) ([]string, error) {
322 if _, err := os.Stat(repoPath); os.IsNotExist(err) {
323 return nil, fmt.Errorf("repository path does not exist: %s", repoPath)
324 }
325 if !isGitRepository(repoPath) {
326 return nil, fmt.Errorf("%s is not a git repository (use 'git init' to initialize)", repoPath)
327 }
328 if err := validateCommit(repoPath, fromCommit); err != nil {
329 return nil, err
330 }
331 if err := validateCommit(repoPath, toCommit); err != nil {
332 return nil, err
333 }
334
335 repoRoot, err := GetRepositoryRoot(repoPath)
336 if err != nil {
337 return nil, fmt.Errorf("failed to get repository root: %w", err)
338 }
339
340 stdout, stderr, err := runGitCommand(repoPath, "diff", "--name-only", "--diff-filter=D", fromCommit, toCommit)
341 if err != nil {
342 return nil, gitCommandError(err, stderr)
343 }
344
345 return toAbsolutePaths(repoRoot, parseNonEmptyLines(stdout)), nil
346}
347
348func parseNonEmptyLines(stdout []byte) []string {
349 var files []string

Calls 7

isGitRepositoryFunction · 0.85
validateCommitFunction · 0.85
GetRepositoryRootFunction · 0.85
runGitCommandFunction · 0.85
gitCommandErrorFunction · 0.85
toAbsolutePathsFunction · 0.85
parseNonEmptyLinesFunction · 0.85