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

Function normalizeFileStats

vcs/git/git_test_helpers.go:101–118  ·  view source on GitHub ↗

normalizeFileStats normalizes file stats for golden file comparison

(tmpDir string, stats map[string]vcs.FileStats)

Source from the content-addressed store, hash-verified

99
100// normalizeFileStats normalizes file stats for golden file comparison
101func normalizeFileStats(tmpDir string, stats map[string]vcs.FileStats) string {
102 if len(stats) == 0 {
103 return "(empty)"
104 }
105 resolvedTmpDir, _ := filepath.EvalSymlinks(tmpDir)
106 var keys []string
107 for k := range stats {
108 keys = append(keys, k)
109 }
110 sort.Strings(keys)
111 var lines []string
112 for _, k := range keys {
113 stat := stats[k]
114 relPath := strings.TrimPrefix(k, resolvedTmpDir+"/")
115 lines = append(lines, fmt.Sprintf("$REPO/%s: +%d -%d new=%t", relPath, stat.Additions, stat.Deletions, stat.IsNew))
116 }
117 return strings.Join(lines, "\n")
118}

Calls

no outgoing calls