Merge branch 'fix-default-branch'
This commit is contained in:
commit
cec8ea9806
|
@ -29,7 +29,7 @@ func newRepositoryNode(project *gitlab.Project, param *FSParam) (*RepositoryNode
|
|||
|
||||
func (n *RepositoryNode) Readlink(ctx context.Context) ([]byte, syscall.Errno) {
|
||||
// Create the local copy of the repo
|
||||
localRepoLoc, _ := n.param.Git.CloneOrPull(n.project.CloneURL, n.project.ID, "master")
|
||||
localRepoLoc, _ := n.param.Git.CloneOrPull(n.project.CloneURL, n.project.ID, n.project.DefaultBranch)
|
||||
|
||||
return []byte(localRepoLoc), 0
|
||||
}
|
||||
|
|
|
@ -5,16 +5,21 @@ import (
|
|||
)
|
||||
|
||||
type Project struct {
|
||||
ID int
|
||||
Name string
|
||||
CloneURL string
|
||||
ID int
|
||||
Name string
|
||||
CloneURL string
|
||||
DefaultBranch string
|
||||
}
|
||||
|
||||
func (c *gitlabClient) newProjectFromGitlabProject(project *gitlab.Project) Project {
|
||||
// https://godoc.org/github.com/xanzy/go-gitlab#Project
|
||||
p := Project{
|
||||
ID: project.ID,
|
||||
Name: project.Path,
|
||||
ID: project.ID,
|
||||
Name: project.Path,
|
||||
DefaultBranch: project.DefaultBranch,
|
||||
}
|
||||
if p.DefaultBranch == "" {
|
||||
p.DefaultBranch = "master"
|
||||
}
|
||||
if c.PullMethod == PullMethodSSH {
|
||||
p.CloneURL = project.SSHURLToRepo
|
||||
|
|
Loading…
Reference in New Issue