Documentation
¶
Index ¶
- func ReplaceSSHHostname(sshURL string, newHostname string) string
- func SupportedClients() []string
- func ToSlug(title string) string
- type Bitbucket
- type Client
- type GitLabSnippet
- type Gitea
- type Github
- type Gitlab
- func (c Gitlab) GetGroupRepos(targetGroup string) ([]Repo, error)
- func (c Gitlab) GetOrgRepos(targetOrg string) ([]Repo, error)
- func (c Gitlab) GetSnippets(cloneData []Repo, target string) ([]Repo, error)
- func (c Gitlab) GetTopLevelGroups() ([]string, error)
- func (_ Gitlab) GetType() string
- func (c Gitlab) GetUserRepos(targetUsername string) ([]Repo, error)
- func (_ Gitlab) NewClient() (Client, error)
- type Repo
- type RepoCommits
- type ServerProjectResponse
- type ServerRepository
- type Sourcehut
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ReplaceSSHHostname ¶ added in v1.11.8
ReplaceSSHHostname replaces the hostname in an SSH clone URL with a custom hostname. This allows users to leverage SSH configs with multiple host aliases. For example: git@gitlab.com:org/repo.git -> git@my-gitlab-alias:org/repo.git
func SupportedClients ¶
func SupportedClients() []string
SupportedClients return list of all supported clients
Types ¶
type Bitbucket ¶
type Bitbucket struct {
// extend the bitbucket client
*bitbucket.Client
// contains filtered or unexported fields
}
func (Bitbucket) GetOrgRepos ¶
GetOrgRepos gets org repos
func (Bitbucket) GetUserRepos ¶
GetUserRepos gets user repos from bitbucket
type Client ¶
type Client interface {
NewClient() (Client, error)
GetUserRepos(targetUsername string) ([]Repo, error)
GetOrgRepos(targetOrg string) ([]Repo, error)
GetType() string
}
Client define the interface a scm client has to have
type GitLabSnippet ¶ added in v1.9.13
type Gitea ¶
type Gitea struct {
// extend the gitea client
*gitea.Client
// contains filtered or unexported fields
}
func (Gitea) GetOrgRepos ¶
GetOrgRepos fetches repo data from a specific group with parallel pagination
func (Gitea) GetUserRepos ¶
GetUserRepos gets all of a users gitea repos with parallel pagination
type Github ¶
type Github struct {
// extend the github client
*github.Client
// contains filtered or unexported fields
}
func (Github) GetOrgRepos ¶
GetOrgRepos gets org repos with parallel pagination for performance
func (Github) GetUserRepos ¶
GetUserRepos gets user repos with parallel pagination for performance
func (Github) SetTokensUsername ¶ added in v1.9.4
func (c Github) SetTokensUsername()
Sets the GitHub username tied to the github token to the package variable tokenUsername Then if https clone method is used the clone url will be https://username:token@github.com/org/repo.git The username is now needed when using the new fine-grained tokens for github
type Gitlab ¶
func (Gitlab) GetGroupRepos ¶ added in v1.7.1
GetGroupRepos fetches repo data from a specific group with parallel pagination
func (Gitlab) GetOrgRepos ¶
GetOrgRepos fetches repo data from a specific group
func (Gitlab) GetSnippets ¶ added in v1.9.13
func (Gitlab) GetTopLevelGroups ¶ added in v1.7.1
GetTopLevelGroups all top level org groups with parallel pagination
func (Gitlab) GetUserRepos ¶
GetUserRepos gets all of a users gitlab repos
type Repo ¶
type Repo struct {
// The ID of the repo that is assigned via the SCM provider. This is used for example with gitlab snippets on cloud gropus where we need to know the repo id to look up all he snippets it has.
ID string
// Name is the name of the repo https://www.github.com/gabrie30/ghorg.git the Name would be ghorg
Name string
// HostPath is the path on the users machine that the repo will be cloned to. Its used in all the git commands to locate the directory of the repo. HostPath is updated for wikis and snippets because the folder for the clone is appended with .wiki and .snippet
HostPath string
// Path where the repo is located within the scm provider. Its mostly used with gitlab repos when the directory structure is preserved. In this case the path becomes where to locate the repo in relation to gitlab.com/group/group/group/repo.git => /group/group/group/repo
Path string
// URL is the web address of the repo
URL string
// CloneURL is the url for cloning the repo, will be different for ssh vs http clones and will have the .git extention
CloneURL string
// CloneBranch the branch to clone. This will be the default branch if not specified. It will always be main for snippets.
CloneBranch string
// IsWiki is set to true when the data is for a wiki page
IsWiki bool
// IsGitLabSnippet is set to true when the data is for a gitlab snippet
IsGitLabSnippet bool
// IsGitLabRootLevelSnippet is set to true when a snippet was not created for a repo
IsGitLabRootLevelSnippet bool
// GitLabSnippetInfo provides additional information when the thing we are cloning is a gitlab snippet
GitLabSnippetInfo GitLabSnippet
Commits RepoCommits
}
Repo represents an SCM repo, should probably be renamed to "cloneable" since we clone wikis and snippets with this
type RepoCommits ¶ added in v1.9.13
type ServerProjectResponse ¶ added in v1.11.5
type ServerProjectResponse struct {
Values []ServerRepository `json:"values"`
Size int `json:"size"`
IsLastPage bool `json:"isLastPage"`
Start int `json:"start"`
}
type ServerRepository ¶ added in v1.11.5
type ServerRepository struct {
Name string `json:"name"`
Slug string `json:"slug"`
Links map[string]any `json:"links"`
Project struct {
Key string `json:"key"`
} `json:"project"`
}
Bitbucket Server API structures
type Sourcehut ¶ added in v1.11.6
func (Sourcehut) GetOrgRepos ¶ added in v1.11.6
GetOrgRepos fetches repo data from a specific group. We emulate this by checking if the repo's owner matches the current user, which is identical to GetUserRepos. It's possible in the future that this will change as the manual (https://docs.sourcehut.org/git.sr.ht/#field-repositories) states that it will. This can be addressed once the changed behaviour is observable, rather than speculative.
func (Sourcehut) GetUserRepos ¶ added in v1.11.6
GetUserRepos gets all of a users sourcehut repos