Monorepo for Tangled tangled.org

appview: restore old behavior when non-default branches are pushed

Signed-off-by: oppiliappan <me@oppi.li>

oppi.li 04e49c1b d51ccd35

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