(text, scratch, replacement string)
| 507 | } |
| 508 | |
| 509 | func hideDirectory(text, scratch, replacement string) string { |
| 510 | paths := []string{scratch} |
| 511 | // macOS gives gh /private/var/... for a temporary folder under /var/.... |
| 512 | if resolved, err := filepath.EvalSymlinks(scratch); err == nil && resolved != scratch { |
| 513 | paths = append(paths, resolved) |
| 514 | } |
| 515 | sort.Slice(paths, func(i, j int) bool { return len(paths[i]) > len(paths[j]) }) |
| 516 | for _, p := range paths { |
| 517 | text = strings.ReplaceAll(text, p, replacement) |
| 518 | } |
| 519 | return text |
| 520 | } |
| 521 | |
| 522 | // ghEnv builds gh's whole environment from scratch, so the caller's tokens, |
| 523 | // config and git settings never reach it. Every run gets fresh directories, |
no outgoing calls
no test coverage detected