"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "vendor/code.gitea.io/sdk/gitea/repo.go" between
gitea-1.13.1.tar.gz and gitea-1.13.2.tar.gz

About: Gitea allows to set up a self-hosted code hosting Git service (a fork of Gogs).

repo.go  (gitea-1.13.1):repo.go  (gitea-1.13.2)
skipping to change at line 76 skipping to change at line 76
// RepoTypeNone dont specify a type // RepoTypeNone dont specify a type
RepoTypeNone RepoType = "" RepoTypeNone RepoType = ""
// RepoTypeSource is the default repo type // RepoTypeSource is the default repo type
RepoTypeSource RepoType = "source" RepoTypeSource RepoType = "source"
// RepoTypeFork is a repo witch was forked from an other one // RepoTypeFork is a repo witch was forked from an other one
RepoTypeFork RepoType = "fork" RepoTypeFork RepoType = "fork"
// RepoTypeMirror represents an mirror repo // RepoTypeMirror represents an mirror repo
RepoTypeMirror RepoType = "mirror" RepoTypeMirror RepoType = "mirror"
) )
// TrustModel represent how git signatures are handled in a repository
type TrustModel string
const (
// TrustModelDefault use TM set by global config
TrustModelDefault TrustModel = "default"
// TrustModelCollaborator gpg signature has to be owned by a repo collabo
rator
TrustModelCollaborator TrustModel = "collaborator"
// TrustModelCommitter gpg signature has to match committer
TrustModelCommitter TrustModel = "committer"
// TrustModelCollaboratorCommitter gpg signature has to match committer a
nd owned by a repo collaborator
TrustModelCollaboratorCommitter TrustModel = "collaboratorcommitter"
)
// ListReposOptions options for listing repositories // ListReposOptions options for listing repositories
type ListReposOptions struct { type ListReposOptions struct {
ListOptions ListOptions
} }
// ListMyRepos lists all repositories for the authenticated user that has access to. // ListMyRepos lists all repositories for the authenticated user that has access to.
func (c *Client) ListMyRepos(opt ListReposOptions) ([]*Repository, *Response, er ror) { func (c *Client) ListMyRepos(opt ListReposOptions) ([]*Repository, *Response, er ror) {
opt.setDefaults() opt.setDefaults()
repos := make([]*Repository, 0, opt.PageSize) repos := make([]*Repository, 0, opt.PageSize)
resp, err := c.getParsedResponse("GET", fmt.Sprintf("/user/repos?%s", opt .getURLQuery().Encode()), nil, nil, &repos) resp, err := c.getParsedResponse("GET", fmt.Sprintf("/user/repos?%s", opt .getURLQuery().Encode()), nil, nil, &repos)
skipping to change at line 227 skipping to change at line 241
opt.setDefaults() opt.setDefaults()
repos := new(searchRepoResponse) repos := new(searchRepoResponse)
link, _ := url.Parse("/repos/search") link, _ := url.Parse("/repos/search")
if len(opt.RawQuery) != 0 { if len(opt.RawQuery) != 0 {
link.RawQuery = opt.RawQuery link.RawQuery = opt.RawQuery
} else { } else {
link.RawQuery = opt.QueryEncode() link.RawQuery = opt.QueryEncode()
// IsPrivate only works on gitea >= 1.12.0 // IsPrivate only works on gitea >= 1.12.0
if err := c.CheckServerVersionConstraint(">=1.12.0"); err != nil && opt.IsPrivate != nil { if err := c.checkServerVersionGreaterThanOrEqual(version1_12_0); err != nil && opt.IsPrivate != nil {
if *opt.IsPrivate { if *opt.IsPrivate {
// private repos only not supported on gitea <= 1 .11.x // private repos only not supported on gitea <= 1 .11.x
return nil, nil, err return nil, nil, err
} }
link.Query().Add("private", "false") link.Query().Add("private", "false")
} }
} }
resp, err := c.getParsedResponse("GET", link.String(), nil, nil, &repos) resp, err := c.getParsedResponse("GET", link.String(), nil, nil, &repos)
return repos.Repos, resp, err return repos.Repos, resp, err
skipping to change at line 252 skipping to change at line 266
// Name of the repository to create // Name of the repository to create
Name string `json:"name"` Name string `json:"name"`
// Description of the repository to create // Description of the repository to create
Description string `json:"description"` Description string `json:"description"`
// Whether the repository is private // Whether the repository is private
Private bool `json:"private"` Private bool `json:"private"`
// Issue Label set to use // Issue Label set to use
IssueLabels string `json:"issue_labels"` IssueLabels string `json:"issue_labels"`
// Whether the repository should be auto-intialized? // Whether the repository should be auto-intialized?
AutoInit bool `json:"auto_init"` AutoInit bool `json:"auto_init"`
// Whether the repository is template
Template bool `json:"template"`
// Gitignores to use // Gitignores to use
Gitignores string `json:"gitignores"` Gitignores string `json:"gitignores"`
// License to use // License to use
License string `json:"license"` License string `json:"license"`
// Readme of the repository to create // Readme of the repository to create
Readme string `json:"readme"` Readme string `json:"readme"`
// DefaultBranch of the repository (used when initializes and in template ) // DefaultBranch of the repository (used when initializes and in template )
DefaultBranch string `json:"default_branch"` DefaultBranch string `json:"default_branch"`
// TrustModel of the repository
TrustModel TrustModel `json:"trust_model"`
} }
// Validate the CreateRepoOption struct // Validate the CreateRepoOption struct
func (opt CreateRepoOption) Validate() error { func (opt CreateRepoOption) Validate(c *Client) error {
if len(strings.TrimSpace(opt.Name)) == 0 { if len(strings.TrimSpace(opt.Name)) == 0 {
return fmt.Errorf("name is empty") return fmt.Errorf("name is empty")
} }
if len(opt.Name) > 100 {
return fmt.Errorf("name has more than 100 chars")
}
if len(opt.Description) > 255 {
return fmt.Errorf("name has more than 255 chars")
}
if len(opt.DefaultBranch) > 100 {
return fmt.Errorf("name has more than 100 chars")
}
if len(opt.TrustModel) != 0 {
if err := c.CheckServerVersionConstraint(">=1.13.0"); err != nil
{
return err
}
}
return nil return nil
} }
// CreateRepo creates a repository for authenticated user. // CreateRepo creates a repository for authenticated user.
func (c *Client) CreateRepo(opt CreateRepoOption) (*Repository, *Response, error ) { func (c *Client) CreateRepo(opt CreateRepoOption) (*Repository, *Response, error ) {
if err := opt.Validate(); err != nil { if err := opt.Validate(c); err != nil {
return nil, nil, err return nil, nil, err
} }
body, err := json.Marshal(&opt) body, err := json.Marshal(&opt)
if err != nil { if err != nil {
return nil, nil, err return nil, nil, err
} }
repo := new(Repository) repo := new(Repository)
resp, err := c.getParsedResponse("POST", "/user/repos", jsonHeader, bytes .NewReader(body), repo) resp, err := c.getParsedResponse("POST", "/user/repos", jsonHeader, bytes .NewReader(body), repo)
return repo, resp, err return repo, resp, err
} }
// CreateOrgRepo creates an organization repository for authenticated user. // CreateOrgRepo creates an organization repository for authenticated user.
func (c *Client) CreateOrgRepo(org string, opt CreateRepoOption) (*Repository, * Response, error) { func (c *Client) CreateOrgRepo(org string, opt CreateRepoOption) (*Repository, * Response, error) {
if err := opt.Validate(); err != nil { if err := opt.Validate(c); err != nil {
return nil, nil, err return nil, nil, err
} }
body, err := json.Marshal(&opt) body, err := json.Marshal(&opt)
if err != nil { if err != nil {
return nil, nil, err return nil, nil, err
} }
repo := new(Repository) repo := new(Repository)
resp, err := c.getParsedResponse("POST", fmt.Sprintf("/org/%s/repos", org ), jsonHeader, bytes.NewReader(body), repo) resp, err := c.getParsedResponse("POST", fmt.Sprintf("/org/%s/repos", org ), jsonHeader, bytes.NewReader(body), repo)
return repo, resp, err return repo, resp, err
} }
 End of changes. 8 change blocks. 
4 lines changed or deleted 39 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)