Skip to content

Commit

Permalink
Revert "fix: normalise path separators on Windows to fix sub-package …
Browse files Browse the repository at this point in the history
…tags (#165)"

This reverts commit 6862035.
  • Loading branch information
caarlos0 committed Aug 24, 2024
1 parent 9d87b71 commit fc3e2dc
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"fmt"
"os"
"path"
"path/filepath"
"runtime/debug"
"strings"

Expand Down Expand Up @@ -54,15 +53,11 @@ func defaults(flag string) string {

cwd, wdErr := os.Getwd()
gitRoot, grErr := git.Root()
if wdErr == nil && grErr == nil {
cwd = filepath.Clean(cwd)
gitRoot = filepath.Clean(gitRoot)
if cwd != gitRoot {
prefix := strings.TrimPrefix(cwd, gitRoot)
prefix = strings.TrimPrefix(prefix, string(os.PathSeparator))
prefix = strings.TrimSuffix(prefix, string(os.PathSeparator))
return path.Join(prefix, pat)
}
if wdErr == nil && grErr == nil && cwd != gitRoot {
prefix := strings.TrimPrefix(cwd, gitRoot)
prefix = strings.TrimPrefix(prefix, string(os.PathSeparator))
prefix = strings.TrimSuffix(prefix, string(os.PathSeparator))
return path.Join(prefix, pat)
}

return def
Expand Down

0 comments on commit fc3e2dc

Please sign in to comment.