Allow gitea dev version (#914)

* update gitea sdk to latest
* As before try to autodetect gitea version, if this does not work, assume it's latest version (v1.17.0 atm)
This commit is contained in:
6543
2022-05-14 17:34:40 +02:00
committed by GitHub
parent c350af645b
commit d06dfc86b4
28 changed files with 358 additions and 163 deletions

View File

@@ -93,6 +93,7 @@ type Repository struct {
AvatarURL string `json:"avatar_url"`
Internal bool `json:"internal"`
MirrorInterval string `json:"mirror_interval"`
MirrorUpdated time.Time `json:"mirror_updated,omitempty"`
DefaultMergeStyle MergeStyle `json:"default_merge_style"`
}
@@ -286,7 +287,9 @@ func (c *Client) SearchRepos(opt SearchRepoOptions) ([]*Repository, *Response, e
// private repos only not supported on gitea <= 1.11.x
return nil, nil, err
}
link.Query().Add("private", "false")
newQuery := link.Query()
newQuery.Add("private", "false")
link.RawQuery = newQuery.Encode()
}
}
@@ -329,13 +332,13 @@ func (opt CreateRepoOption) Validate(c *Client) error {
return fmt.Errorf("name has more than 100 chars")
}
if len(opt.Description) > 255 {
return fmt.Errorf("name has more than 255 chars")
return fmt.Errorf("description has more than 255 chars")
}
if len(opt.DefaultBranch) > 100 {
return fmt.Errorf("name has more than 100 chars")
return fmt.Errorf("default branch name has more than 100 chars")
}
if len(opt.TrustModel) != 0 {
if err := c.CheckServerVersionConstraint(">=1.13.0"); err != nil {
if err := c.checkServerVersionGreaterThanOrEqual(version1_13_0); err != nil {
return err
}
}