This commit is contained in:
Kris Nova 2017-05-01 21:29:50 -06:00
Родитель bd57fe9d7d
Коммит 134b2473ef
7 изменённых файлов: 169 добавлений и 9 удалений

6
Gopkg.lock сгенерированный
Просмотреть файл

@ -1,4 +1,4 @@
memo = "099c73630ad2c4f0894ed8646e2e4b5a9f635c85661a77fbf3b9f9dd78c77e87"
memo = "932b7b1663f6eecccb1fada1d3670ae24cd8aa7c8b61e3b224edfefebe25954e"
[[projects]]
branch = "2.x"
@ -9,8 +9,8 @@ memo = "099c73630ad2c4f0894ed8646e2e4b5a9f635c85661a77fbf3b9f9dd78c77e87"
[[projects]]
name = "github.com/Masterminds/vcs"
packages = ["."]
revision = "2b467644127097f69ed9c9829a0c5f757a804cee"
version = "v1.10.2"
revision = "3084677c2c188840777bff30054f2b553729d329"
version = "v1.11.1"
[[projects]]
branch = "master"

Просмотреть файл

@ -6,7 +6,7 @@ required = ["github.com/Masterminds/semver"]
[[dependencies]]
name = "github.com/Masterminds/vcs"
version = "^1.8.0"
version = "^1.11.0"
[[dependencies]]
branch = "master"

5
vendor/github.com/Masterminds/vcs/.travis.yml сгенерированный поставляемый
Просмотреть файл

@ -3,6 +3,7 @@ language: go
go:
- 1.6
- 1.7
- 1.8
- tip
before_script:
@ -16,8 +17,8 @@ before_script:
sudo: false
script:
- GO15VENDOREXPERIMENT=1 make setup
- GO15VENDOREXPERIMENT=1 make test
- make setup
- make test
notifications:
webhooks:

16
vendor/github.com/Masterminds/vcs/CHANGELOG.md сгенерированный поставляемый
Просмотреть файл

@ -1,3 +1,19 @@
# 1.11.1 (2017-04-28)
## Fixed
- #76: Fix submodule handling for Windows (thanks @m0j0hn)
# 1.11.0 (2017-03-23)
## Added
- #65: Exposed CmdFromDir function (thanks @erizocosmico)
## Changed
- #69: Updated testing for Go 1.8
## Fixed
- #64: Testing fatal error if bzr not installed (thanks @kevinburke)
# 1.10.2 (2017-01-24)
## Fixed

2
vendor/github.com/Masterminds/vcs/bzr_test.go сгенерированный поставляемый
Просмотреть файл

@ -31,7 +31,7 @@ func TestBzr(t *testing.T) {
repo, err := NewBzrRepo("https://launchpad.net/govcstestbzrrepo", tempDir+"/govcstestbzrrepo")
if err != nil {
t.Error(err)
t.Fatal(err)
}
if repo.Vcs() != Bzr {

32
vendor/github.com/Masterminds/vcs/git.go сгенерированный поставляемый
Просмотреть файл

@ -7,6 +7,7 @@ import (
"os"
"os/exec"
"path/filepath"
"runtime"
"strings"
"time"
)
@ -363,9 +364,33 @@ func (s *GitRepo) Ping() bool {
return err == nil
}
// EscapePathSeparator escapes the path separator by replacing it with several.
// Note: this is harmless on Unix, and needed on Windows.
func EscapePathSeparator(path string) (string) {
switch runtime.GOOS {
case `windows`:
// On Windows, triple all path separators.
// Needed to escape backslash(s) preceding doublequotes,
// because of how Windows strings treats backslash+doublequote combo,
// and Go seems to be implicitly passing around a doublequoted string on Windows,
// so we cannnot use default string instead.
// See: https://blogs.msdn.microsoft.com/twistylittlepassagesallalike/2011/04/23/everyone-quotes-command-line-arguments-the-wrong-way/
// e.g., C:\foo\bar\ -> C:\\\foo\\\bar\\\
// used with --prefix, like this: --prefix=C:\foo\bar\ -> --prefix=C:\\\foo\\\bar\\\
return strings.Replace(path,
string(os.PathSeparator),
string(os.PathSeparator) + string(os.PathSeparator) + string(os.PathSeparator),
-1)
default:
return path
}
}
// ExportDir exports the current revision to the passed in directory.
func (s *GitRepo) ExportDir(dir string) error {
var path string
// Without the trailing / there can be problems.
if !strings.HasSuffix(dir, string(os.PathSeparator)) {
dir = dir + string(os.PathSeparator)
@ -379,13 +404,16 @@ func (s *GitRepo) ExportDir(dir string) error {
return NewLocalError("Unable to create directory", err, "")
}
out, err := s.RunFromDir("git", "checkout-index", "-f", "-a", "--prefix="+dir)
path = EscapePathSeparator( dir )
out, err := s.RunFromDir("git", "checkout-index", "-f", "-a", "--prefix="+path)
s.log(out)
if err != nil {
return NewLocalError("Unable to export source", err, string(out))
}
// and now, the horror of submodules
out, err = s.RunFromDir("git", "submodule", "foreach", "--recursive", "git checkout-index -f -a --prefix=\""+filepath.Join(dir, "$path")+string(filepath.Separator)+"\"")
path = EscapePathSeparator( dir + "$path" + string(os.PathSeparator) )
out, err = s.RunFromDir("git", "submodule", "foreach", "--recursive", "git checkout-index -f -a --prefix="+path)
s.log(out)
if err != nil {
return NewLocalError("Error while exporting submodule sources", err, string(out))

115
vendor/github.com/Masterminds/vcs/git_test.go сгенерированный поставляемый
Просмотреть файл

@ -482,3 +482,118 @@ func TestGitSubmoduleHandling(t *testing.T) {
}
}
func TestGitSubmoduleHandling2(t *testing.T) {
tempDir, err := ioutil.TempDir("", "go-vcs-git-submodule-tests2")
if err != nil {
t.Error(err)
}
defer func() {
err = os.RemoveAll(tempDir)
if err != nil {
t.Error(err)
}
}()
repo, err := NewGitRepo("https://github.com/cloudfoundry/sonde-go", tempDir+"/VCSTestRepo2")
if err != nil {
t.Error(err)
}
if repo.Vcs() != Git {
t.Error("Git is detecting the wrong type")
}
// Check the basic getters.
if repo.Remote() != "https://github.com/cloudfoundry/sonde-go" {
t.Error("Remote not set properly")
}
if repo.LocalPath() != tempDir+"/VCSTestRepo2" {
t.Error("Local disk location not set properly")
}
//Logger = log.New(os.Stdout, "", log.LstdFlags)
// Do an initial clone.
err = repo.Get()
if err != nil {
t.Errorf("Unable to clone Git repo. Err was %s", err)
}
// Verify Git repo is a Git repo
if !repo.CheckLocal() {
t.Error("Problem checking out repo or Git CheckLocal is not working")
}
// Test internal lookup mechanism used outside of Git specific functionality.
ltype, err := DetectVcsFromFS(tempDir + "/VCSTestRepo2")
if err != nil {
t.Error("detectVcsFromFS unable to Git repo")
}
if ltype != Git {
t.Errorf("detectVcsFromFS detected %s instead of Git type", ltype)
}
// Test NewRepo on existing checkout. This should simply provide a working
// instance without error based on looking at the local directory.
nrepo, nrerr := NewRepo("https://github.com/cloudfoundry/sonde-go", tempDir+"/VCSTestRepo2")
if nrerr != nil {
t.Error(nrerr)
}
// Verify the right oject is returned. It will check the local repo type.
if !nrepo.CheckLocal() {
t.Error("Wrong version returned from NewRepo")
}
// Perform an update.
err = repo.Update()
if err != nil {
t.Error(err)
}
v, err := repo.Current()
if err != nil {
t.Errorf("Error trying Git Current: %s", err)
}
if v != "master" {
t.Errorf("Current failed to detect Git on tip of master. Got version: %s", v)
}
tempDir2, err := ioutil.TempDir("", "go-vcs-git-tests-export")
if err != nil {
t.Fatalf("Error creating temp directory: %s", err)
}
defer func() {
err = os.RemoveAll(tempDir2)
if err != nil {
t.Error(err)
}
}()
exportDir := filepath.Join(tempDir2, "src")
err = repo.ExportDir(exportDir)
if err != nil {
t.Errorf("Unable to export Git repo. Err was %s", err)
}
_, err = os.Stat(filepath.Join(exportDir, "README.md"))
if err != nil {
t.Errorf("Error checking exported file in Git: %s", err)
}
_, err = os.Stat(filepath.Join( filepath.Join(exportDir, "definitions"), "README.md"))
if err != nil {
t.Errorf("Error checking exported file in Git: %s", err)
}
_, err = os.Stat(filepath.Join(exportDir, string(repo.Vcs())))
if err != nil {
if found := os.IsNotExist(err); !found {
t.Errorf("Error checking exported metadata in Git: %s", err)
}
} else {
t.Error("Error checking Git metadata. It exists.")
}
}