Compare commits

..

No commits in common. "9f1538fed48733b5809bd0a2c5029d42e7152ca2" and "d9e446553c11ac18f4cad36d68594e6edac1a68e" have entirely different histories.

2 changed files with 3 additions and 18 deletions

View File

@ -3,8 +3,6 @@ package project
import ( import (
"log" "log"
"net/url" "net/url"
"os"
"strings"
"github.com/pkg/errors" "github.com/pkg/errors"
"gopkg.in/src-d/go-billy.v4" "gopkg.in/src-d/go-billy.v4"
@ -17,8 +15,6 @@ import (
) )
const GitScheme = "git" const GitScheme = "git"
const HTTPScheme = "http"
const HTTPSScheme = "https"
type GitFetcher struct{} type GitFetcher struct{}
@ -57,7 +53,6 @@ func (f *GitFetcher) Fetch(url *url.URL) (billy.Filesystem, error) {
URL: url.String(), URL: url.String(),
Auth: auth, Auth: auth,
ReferenceName: branchName, ReferenceName: branchName,
Progress: os.Stdout,
}) })
if err != nil { if err != nil {
if err == transport.ErrRepositoryNotFound { if err == transport.ErrRepositoryNotFound {
@ -90,10 +85,6 @@ func (f *GitFetcher) Match(url *url.URL) bool {
return true return true
} }
if (url.Scheme == HTTPSScheme || url.Scheme == HTTPScheme) && strings.HasSuffix(url.Path, ".git") {
return true
}
isFilesystemPath := isFilesystemPath(url.Path) isFilesystemPath := isFilesystemPath(url.Path)
if url.Scheme == "" && !isFilesystemPath { if url.Scheme == "" && !isFilesystemPath {
return true return true

View File

@ -4,8 +4,6 @@ import (
"net/url" "net/url"
"strings" "strings"
"gopkg.in/src-d/go-billy.v4/osfs"
"gopkg.in/src-d/go-billy.v4" "gopkg.in/src-d/go-billy.v4"
) )
@ -15,7 +13,7 @@ const FileScheme = "file"
type LocalFetcher struct{} type LocalFetcher struct{}
func (f *LocalFetcher) Fetch(url *url.URL) (billy.Filesystem, error) { func (f *LocalFetcher) Fetch(url *url.URL) (billy.Filesystem, error) {
return osfs.New(url.Path), nil return nil, nil
} }
func (f *LocalFetcher) Match(url *url.URL) bool { func (f *LocalFetcher) Match(url *url.URL) bool {
@ -23,11 +21,7 @@ func (f *LocalFetcher) Match(url *url.URL) bool {
return true return true
} }
if url.Scheme == "" && isFilesystemPath(url.Path) { return isFilesystemPath(url.Path)
return true
}
return false
} }
func NewLocalFetcher() *LocalFetcher { func NewLocalFetcher() *LocalFetcher {
@ -35,5 +29,5 @@ func NewLocalFetcher() *LocalFetcher {
} }
func isFilesystemPath(path string) bool { func isFilesystemPath(path string) bool {
return strings.HasPrefix(path, ".") || strings.HasPrefix(path, "/") return strings.HasPrefix(path, "./") || strings.HasPrefix(path, "/")
} }