···6363 RepoInfo: repoInfo,6464 })6565 return6666- } else {6767- rp.pages.Error503(w)6868- log.Println("failed to build index response", err)6969- return7066 }6767+6868+ rp.pages.Error503(w)6969+ log.Println("failed to build index response", err)7070+ return7171 }72727373 tagMap := make(map[string][]string)···256256 }257257258258 // if no ref specified, use default branch or first available259259- if ref == "" && len(branchesResp.Branches) > 0 {259259+ if ref == "" {260260 for _, branch := range branchesResp.Branches {261261 if branch.IsDefault {262262 ref = branch.Name263263 break264264 }265265 }266266- if ref == "" {267267- ref = branchesResp.Branches[0].Name268268- }269266 }270267271271- // check if repo is empty272272- if len(branchesResp.Branches) == 0 {268268+ // if ref is still empty, this means the default branch is not set269269+ if ref == "" {273270 return &types.RepoIndexResponse{274271 IsEmpty: true,275272 Branches: branchesResp.Branches,