normalizeFilePaths normalizes file paths for golden file comparison by replacing the temp directory with $REPO placeholder
(tmpDir string, paths []string)
| 84 | // normalizeFilePaths normalizes file paths for golden file comparison |
| 85 | // by replacing the temp directory with $REPO placeholder |
| 86 | func normalizeFilePaths(tmpDir string, paths []string) string { |
| 87 | if len(paths) == 0 { |
| 88 | return "(empty)" |
| 89 | } |
| 90 | resolvedTmpDir, _ := filepath.EvalSymlinks(tmpDir) |
| 91 | var normalized []string |
| 92 | for _, p := range paths { |
| 93 | relPath := strings.TrimPrefix(p, resolvedTmpDir+"/") |
| 94 | normalized = append(normalized, "$REPO/"+relPath) |
| 95 | } |
| 96 | sort.Strings(normalized) |
| 97 | return strings.Join(normalized, "\n") |
| 98 | } |
| 99 | |
| 100 | // normalizeFileStats normalizes file stats for golden file comparison |
| 101 | func normalizeFileStats(tmpDir string, stats map[string]vcs.FileStats) string { |
no outgoing calls