Fix tests on Windows (#562)
* fix: replace `\` with `/` in git ref to fix `git_test.go` on windows Paths on Windows use backslash (`\`) as directory separator and this breaks `TestGitFindRef()`. Replacing `\` with `/` in git ref fixes that issue. * fix: replace `gopkg.in/godo.v2/glob` with std library `path/filepath` `github.com/go-godo/godo` lib has been last updated in 2016 and it also depends on another outdated lib `github.com/MichaelTJones/walk` with last update in 2016. This also fixes `permission_denied` errors on Windows (and perhaps Linux in some specific cases). I'm not aware of any performance improvement or drawback because of that change.
This commit is contained in:
@@ -98,7 +98,8 @@ func findGitPrettyRef(head, root, sub string) (string, error) {
|
||||
}
|
||||
var pointsTo = strings.TrimSpace(string(bts))
|
||||
if head == pointsTo {
|
||||
name = strings.TrimPrefix(strings.Replace(path, root, "", 1), "/")
|
||||
// On Windows paths are separated with backslash character so they should be replaced to provide proper git refs format
|
||||
name = strings.TrimPrefix(strings.ReplaceAll(strings.Replace(path, root, "", 1), `\`, `/`), "/")
|
||||
log.Debugf("HEAD matches %s", name)
|
||||
}
|
||||
return nil
|
||||
|
Reference in New Issue
Block a user