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

merged
opened by oppi.li targeting master from push-yqnqquktxqpx
Changed files
+7 -10
appview
repo
+7 -10
appview/repo/index.go
···
RepoInfo: repoInfo,
})
return
-
} else {
-
rp.pages.Error503(w)
-
log.Println("failed to build index response", err)
-
return
}
+
+
rp.pages.Error503(w)
+
log.Println("failed to build index response", err)
+
return
}
tagMap := make(map[string][]string)
···
}
// if no ref specified, use default branch or first available
-
if ref == "" && len(branchesResp.Branches) > 0 {
+
if ref == "" {
for _, branch := range branchesResp.Branches {
if branch.IsDefault {
ref = branch.Name
break
}
}
-
if ref == "" {
-
ref = branchesResp.Branches[0].Name
-
}
}
-
// check if repo is empty
-
if len(branchesResp.Branches) == 0 {
+
// if ref is still empty, this means the default branch is not set
+
if ref == "" {
return &types.RepoIndexResponse{
IsEmpty: true,
Branches: branchesResp.Branches,