Merge branch 'fix-default-branch'

This commit is contained in:
Massaki Archambault 2021-03-02 23:45:29 -05:00
commit cec8ea9806
2 changed files with 11 additions and 6 deletions

View File

@ -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
}

View File

@ -8,6 +8,7 @@ type Project struct {
ID int
Name string
CloneURL string
DefaultBranch string
}
func (c *gitlabClient) newProjectFromGitlabProject(project *gitlab.Project) Project {
@ -15,6 +16,10 @@ func (c *gitlabClient) newProjectFromGitlabProject(project *gitlab.Project) Proj
p := Project{
ID: project.ID,
Name: project.Path,
DefaultBranch: project.DefaultBranch,
}
if p.DefaultBranch == "" {
p.DefaultBranch = "master"
}
if c.PullMethod == PullMethodSSH {
p.CloneURL = project.SSHURLToRepo