mugit/internal/git/paths.go (view raw)
Oleksandr Smirnov
Oleksandr Smirnov
olexsmir@gmail.com chore: remove context.todo, and unused stuff, 2 months ago
olexsmir@gmail.com chore: remove context.todo, and unused stuff, 2 months ago
| 1 | package git |
| 2 | |
| 3 | import ( |
| 4 | "fmt" |
| 5 | "strings" |
| 6 | |
| 7 | securejoin "github.com/cyphar/filepath-securejoin" |
| 8 | ) |
| 9 | |
| 10 | func ResolveName(name string) string { |
| 11 | return strings.TrimSuffix(name, ".git") + ".git" |
| 12 | } |
| 13 | |
| 14 | func ResolvePath(baseDir, repoName string) (string, error) { |
| 15 | path, err := securejoin.SecureJoin(baseDir, repoName) |
| 16 | if err != nil { |
| 17 | return "", fmt.Errorf("failed to secure join paths: %w", err) |
| 18 | } |
| 19 | return path, err |
| 20 | } |