···63 RepoInfo: repoInfo,
64 })
65 return
66- } else {
67- rp.pages.Error503(w)
68- log.Println("failed to build index response", err)
69- return
70 }
000071 }
7273 tagMap := make(map[string][]string)
···256 }
257258 // if no ref specified, use default branch or first available
259- if ref == "" && len(branchesResp.Branches) > 0 {
260 for _, branch := range branchesResp.Branches {
261 if branch.IsDefault {
262 ref = branch.Name
263 break
264 }
265- }
266- if ref == "" {
267- ref = branchesResp.Branches[0].Name
268 }
269 }
270271- // check if repo is empty
272- if len(branchesResp.Branches) == 0 {
273 return &types.RepoIndexResponse{
274 IsEmpty: true,
275 Branches: branchesResp.Branches,
···63 RepoInfo: repoInfo,
64 })
65 return
000066 }
67+68+ rp.pages.Error503(w)
69+ log.Println("failed to build index response", err)
70+ return
71 }
7273 tagMap := make(map[string][]string)
···256 }
257258 // if no ref specified, use default branch or first available
259+ if ref == "" {
260 for _, branch := range branchesResp.Branches {
261 if branch.IsDefault {
262 ref = branch.Name
263 break
264 }
000265 }
266 }
267268+ // if ref is still empty, this means the default branch is not set
269+ if ref == "" {
270 return &types.RepoIndexResponse{
271 IsEmpty: true,
272 Branches: branchesResp.Branches,