Esempio n. 1
0
func listRepos(c *gin.Context) {
	repos := models.FindAllRepositories(gitserver.ReposRoot())

	response := gin.H{}

	repositoriesInfo := []gin.H{}
	for _, repo := range repos {
		repositoriesInfo = append(repositoriesInfo, repo.ToPublicResponse())
	}
	response["items"] = repositoriesInfo
	response["items_count"] = len(repositoriesInfo)

	c.JSON(200, response)
}
Esempio n. 2
0
// Name returns the name of the repository
func (repo *Repository) Name() string {
	name := strings.TrimPrefix(repo.Path, gitserver.ReposRoot())
	name = strings.TrimSuffix(name, ".git")
	return name
}