Git Fetcher: handle URL with '.git' suffix

This commit is contained in:
wpetit 2020-04-07 08:27:44 +02:00
parent d9e446553c
commit 8c0ce3abe8
1 changed files with 7 additions and 0 deletions

View File

@ -3,6 +3,8 @@ 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"
@ -53,6 +55,7 @@ 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 {
@ -85,6 +88,10 @@ func (f *GitFetcher) Match(url *url.URL) bool {
return true return true
} }
if 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