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

Function parseRenameNameStatus

vcs/git/git_diff.go:168–186  ·  view source on GitHub ↗

parseRenameNameStatus parses `--name-status` rename rows ("R \told\tnew") into an absolute old->new map, or nil when there are none.

(stdout []byte, repoRoot string)

Source from the content-addressed store, hash-verified

166// parseRenameNameStatus parses `--name-status` rename rows ("R<score>\told\tnew")
167// into an absolute old->new map, or nil when there are none.
168func parseRenameNameStatus(stdout []byte, repoRoot string) map[string]string {
169 renames := make(map[string]string)
170 for _, line := range strings.Split(string(stdout), "\n") {
171 if line == "" || line[0] != 'R' {
172 continue
173 }
174 fields := strings.Split(line, "\t")
175 if len(fields) != 3 {
176 continue
177 }
178 oldPath := filepath.Join(repoRoot, strings.TrimSpace(fields[1]))
179 newPath := filepath.Join(repoRoot, strings.TrimSpace(fields[2]))
180 renames[oldPath] = newPath
181 }
182 if len(renames) == 0 {
183 return nil
184 }
185 return renames
186}
187
188// getUncommittedFiles returns a list of all uncommitted files (relative to repo root)
189func getUncommittedFiles(repoPath string) ([]string, error) {

Callers 2

GetCommitRenamesFunction · 0.85
GetCommitRangeRenamesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected