ignore symlinks to match go1.11.4 checksum algorithm changes

This commit is contained in:
Serge Zaitsev 2019-01-14 11:53:30 +01:00
parent c16efb7791
commit a7494ce36f
2 changed files with 12 additions and 1 deletions

View File

@ -163,6 +163,9 @@ func (g *gitVCS) Zip(ctx context.Context, version Version) (io.ReadCloser, error
if submodule(f.Name) { if submodule(f.Name) {
continue continue
} }
if !f.Mode.IsRegular() {
continue
}
name := f.Name name := f.Name
if strings.HasPrefix(name, prefix) { if strings.HasPrefix(name, prefix) {
name = strings.TrimPrefix(name, prefix) name = strings.TrimPrefix(name, prefix)

View File

@ -10,6 +10,7 @@ import (
"io" "io"
"io/ioutil" "io/ioutil"
"sort" "sort"
"strings"
"testing" "testing"
) )
@ -73,12 +74,19 @@ func TestGit(t *testing.T) {
Timestamp: "2016-09-29", Timestamp: "2016-09-29",
Checksum: "WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw=", Checksum: "WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw=",
}, },
{
// A module with symlinks, should match Go 1.11.4 algorithm fix
Module: "github.com/hashicorp/go-rootcerts",
Tag: "v0.0.0-20160503143440-6bb64b370b90",
Timestamp: "2016-05-03",
Checksum: "VBj0QYQ0u2MCJzBfeYXGexnAl17GsH1yidnoxCqqD9E=",
},
} { } {
if test.Module == "" { if test.Module == "" {
continue continue
} }
auth := NoAuth() auth := NoAuth()
if test.Tag != "" { if test.Tag != "" && !strings.HasPrefix(test.Tag, "v0.0.0-") {
t.Run(test.Module+"/List", func(t *testing.T) { t.Run(test.Module+"/List", func(t *testing.T) {
git := NewGit(t.Log, "", test.Module, auth) git := NewGit(t.Log, "", test.Module, auth)
list, err := git.List(context.Background()) list, err := git.List(context.Background())