Documentation ¶
Index ¶
- func AddAll(cloneDir string) error
- func AddAllMock(testPath string) error
- func Checkout(cloneDir, branch string, isNew bool) error
- func CheckoutInNewBranch(testPath, branch string) error
- func Commit(cloneDir, message string, author GitUser) error
- func CreateBranchesOnTestRepository(tmpPath string, repo string, branches ...string) error
- func CreateCommit(tmpPath, repo, file, content string) error
- func CreateEmptyFile(tmpPath, repo, file string) error
- func CreateEmptyTestBareRepository(tmpPath, repo string) (func(), error)
- func CreateEmptyTestRepository(tmpPath, repo string) (func(), error)
- func CreateFile(testPath, file, content string) error
- func CreateFolder(tmpPath, repo, folder string) (string, error)
- func CreateOrUpdateConfig(testPath, param, value string) error
- func CreateTag(testPath, tagname string) error
- func CreateTestRepository(tmpPath, repo, file, content string, folders ...string) (func(), error)
- func GetArchive(repo, ref string, format ArchiveFormat) ([]byte, error)
- func GetArchiveUrl(repo, ref, format string) string
- func GetDiff(repo, previousCommit, lastCommit string) ([]byte, error)
- func GetFileContents(repo, ref, path string) ([]byte, error)
- func GetLastHashCommit(tmpPath, repo string) ([]byte, error)
- func GetTree(repo, ref, path string) ([]map[string]string, error)
- func GrantAccess(rNames, uNames []string, readOnly bool) error
- func InitBareRepository(testPath string) error
- func InitRepository(testPath string) error
- func MakeCommit(testPath, content string) error
- func Push(cloneDir, branch string) error
- func Remove(name string) error
- func RevokeAccess(rNames, uNames []string, readOnly bool) error
- func SetCommitter(cloneDir string, committer GitUser) error
- func StatusRepository(testPath string) error
- func TempClone(repo string) (string, func(), error)
- func Update(name string, newData Repository) error
- type ArchiveFormat
- type ContentRetriever
- type GitCommit
- type GitContentRetriever
- func (*GitContentRetriever) AddAll(cloneDir string) error
- func (*GitContentRetriever) Checkout(cloneDir, branch string, isNew bool) error
- func (*GitContentRetriever) Commit(cloneDir, message string, author GitUser) error
- func (*GitContentRetriever) CommitZip(repo string, z *multipart.FileHeader, c GitCommit) (*Ref, error)
- func (*GitContentRetriever) GetArchive(repo, ref string, format ArchiveFormat) ([]byte, error)
- func (*GitContentRetriever) GetBranches(repo string) ([]Ref, error)
- func (*GitContentRetriever) GetContents(repo, ref, path string) ([]byte, error)
- func (*GitContentRetriever) GetDiff(repo, previousCommit, lastCommit string) ([]byte, error)
- func (*GitContentRetriever) GetForEachRef(repo, pattern string) ([]Ref, error)
- func (*GitContentRetriever) GetLogs(repo, hash string, total int, path string) (*GitHistory, error)
- func (*GitContentRetriever) GetTags(repo string) ([]Ref, error)
- func (*GitContentRetriever) GetTree(repo, ref, path string) ([]map[string]string, error)
- func (*GitContentRetriever) Push(cloneDir, branch string) error
- func (*GitContentRetriever) SetCommitter(cloneDir string, committer GitUser) error
- func (*GitContentRetriever) TempClone(repo string) (cloneDir string, cleanUp func(), err error)
- type GitHistory
- type GitLog
- type GitUser
- type Links
- type MockContentRetriever
- func (r *MockContentRetriever) AddAll(cloneDir string) error
- func (r *MockContentRetriever) Checkout(cloneDir, branch string, isNew bool) error
- func (r *MockContentRetriever) Commit(cloneDir, message string, author GitUser) error
- func (r *MockContentRetriever) CommitZip(repo string, z *multipart.FileHeader, c GitCommit) (*Ref, error)
- func (r *MockContentRetriever) GetArchive(repo, ref string, format ArchiveFormat) ([]byte, error)
- func (r *MockContentRetriever) GetBranches(repo string) ([]Ref, error)
- func (r *MockContentRetriever) GetContents(repo, ref, path string) ([]byte, error)
- func (r *MockContentRetriever) GetDiff(repo, previousCommit, lastCommit string) ([]byte, error)
- func (r *MockContentRetriever) GetForEachRef(repo, pattern string) ([]Ref, error)
- func (r *MockContentRetriever) GetLogs(repo, hash string, total int, path string) (*GitHistory, error)
- func (r *MockContentRetriever) GetTags(repo string) ([]Ref, error)
- func (r *MockContentRetriever) GetTree(repo, ref, path string) ([]map[string]string, error)
- func (r *MockContentRetriever) Push(cloneDir, branch string) error
- func (r *MockContentRetriever) SetCommitter(cloneDir string, committer GitUser) error
- func (r *MockContentRetriever) TempClone(repo string) (string, func(), error)
- type Ref
- type Repository
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddAllMock ¶
func CheckoutInNewBranch ¶
func CreateCommit ¶
func CreateEmptyFile ¶
func CreateFile ¶
func CreateFolder ¶
func CreateOrUpdateConfig ¶
func CreateTestRepository ¶
func GetArchive ¶
func GetArchive(repo, ref string, format ArchiveFormat) ([]byte, error)
GetArchive returns the contents for a given file in a given ref for the specified repository
func GetArchiveUrl ¶
func GetFileContents ¶
GetFileContents returns the contents for a given file in a given ref for the specified repository
func GetLastHashCommit ¶
func GrantAccess ¶
GrantAccess gives full or read-only permission for users in all specified repositories. If any of the repositories/users does not exist, GrantAccess just skips it.
func InitBareRepository ¶
func InitRepository ¶
func MakeCommit ¶
func RevokeAccess ¶
RevokeAccess revokes write permission from users in all specified repositories.
func SetCommitter ¶
func StatusRepository ¶
Types ¶
type ContentRetriever ¶
type ContentRetriever interface { GetContents(repo, ref, path string) ([]byte, error) GetArchive(repo, ref string, format ArchiveFormat) ([]byte, error) GetTree(repo, ref, path string) ([]map[string]string, error) GetForEachRef(repo, pattern string) ([]Ref, error) GetBranches(repo string) ([]Ref, error) GetDiff(repo, lastCommit, previousCommit string) ([]byte, error) GetTags(repo string) ([]Ref, error) TempClone(repo string) (string, func(), error) SetCommitter(cloneDir string, committer GitUser) error Checkout(cloneDir, branch string, isNew bool) error AddAll(cloneDir string) error Commit(cloneDir, message string, author GitUser) error Push(cloneDir, branch string) error CommitZip(repo string, z *multipart.FileHeader, c GitCommit) (*Ref, error) GetLogs(repo, hash string, total int, path string) (*GitHistory, error) }
var Retriever ContentRetriever
type GitContentRetriever ¶
type GitContentRetriever struct{}
func (*GitContentRetriever) AddAll ¶
func (*GitContentRetriever) AddAll(cloneDir string) error
func (*GitContentRetriever) Checkout ¶
func (*GitContentRetriever) Checkout(cloneDir, branch string, isNew bool) error
func (*GitContentRetriever) Commit ¶
func (*GitContentRetriever) Commit(cloneDir, message string, author GitUser) error
func (*GitContentRetriever) CommitZip ¶
func (*GitContentRetriever) CommitZip(repo string, z *multipart.FileHeader, c GitCommit) (*Ref, error)
func (*GitContentRetriever) GetArchive ¶
func (*GitContentRetriever) GetArchive(repo, ref string, format ArchiveFormat) ([]byte, error)
func (*GitContentRetriever) GetBranches ¶
func (*GitContentRetriever) GetBranches(repo string) ([]Ref, error)
func (*GitContentRetriever) GetContents ¶
func (*GitContentRetriever) GetContents(repo, ref, path string) ([]byte, error)
func (*GitContentRetriever) GetDiff ¶
func (*GitContentRetriever) GetDiff(repo, previousCommit, lastCommit string) ([]byte, error)
func (*GitContentRetriever) GetForEachRef ¶
func (*GitContentRetriever) GetForEachRef(repo, pattern string) ([]Ref, error)
func (*GitContentRetriever) GetLogs ¶
func (*GitContentRetriever) GetLogs(repo, hash string, total int, path string) (*GitHistory, error)
func (*GitContentRetriever) GetTags ¶
func (*GitContentRetriever) GetTags(repo string) ([]Ref, error)
func (*GitContentRetriever) GetTree ¶
func (*GitContentRetriever) GetTree(repo, ref, path string) ([]map[string]string, error)
func (*GitContentRetriever) Push ¶
func (*GitContentRetriever) Push(cloneDir, branch string) error
func (*GitContentRetriever) SetCommitter ¶
func (*GitContentRetriever) SetCommitter(cloneDir string, committer GitUser) error
type GitHistory ¶
type GitUser ¶
type MockContentRetriever ¶
type MockContentRetriever struct { LastFormat ArchiveFormat LastRef string LastPath string ResultContents []byte Tree []map[string]string Ref Ref Refs []Ref LookPathError error OutputError error ClonePath string CleanUp func() History GitHistory }
func (*MockContentRetriever) AddAll ¶
func (r *MockContentRetriever) AddAll(cloneDir string) error
func (*MockContentRetriever) Checkout ¶
func (r *MockContentRetriever) Checkout(cloneDir, branch string, isNew bool) error
func (*MockContentRetriever) Commit ¶
func (r *MockContentRetriever) Commit(cloneDir, message string, author GitUser) error
func (*MockContentRetriever) CommitZip ¶
func (r *MockContentRetriever) CommitZip(repo string, z *multipart.FileHeader, c GitCommit) (*Ref, error)
func (*MockContentRetriever) GetArchive ¶
func (r *MockContentRetriever) GetArchive(repo, ref string, format ArchiveFormat) ([]byte, error)
func (*MockContentRetriever) GetBranches ¶
func (r *MockContentRetriever) GetBranches(repo string) ([]Ref, error)
func (*MockContentRetriever) GetContents ¶
func (r *MockContentRetriever) GetContents(repo, ref, path string) ([]byte, error)
func (*MockContentRetriever) GetDiff ¶
func (r *MockContentRetriever) GetDiff(repo, previousCommit, lastCommit string) ([]byte, error)
func (*MockContentRetriever) GetForEachRef ¶
func (r *MockContentRetriever) GetForEachRef(repo, pattern string) ([]Ref, error)
func (*MockContentRetriever) GetLogs ¶
func (r *MockContentRetriever) GetLogs(repo, hash string, total int, path string) (*GitHistory, error)
func (*MockContentRetriever) GetTags ¶
func (r *MockContentRetriever) GetTags(repo string) ([]Ref, error)
func (*MockContentRetriever) GetTree ¶
func (r *MockContentRetriever) GetTree(repo, ref, path string) ([]map[string]string, error)
func (*MockContentRetriever) Push ¶
func (r *MockContentRetriever) Push(cloneDir, branch string) error
func (*MockContentRetriever) SetCommitter ¶
func (r *MockContentRetriever) SetCommitter(cloneDir string, committer GitUser) error
type Ref ¶
type Ref struct { Ref string `json:"ref"` Name string `json:"name"` Author *GitUser `json:"author"` Committer *GitUser `json:"committer"` Links *Links `json:"_links"` Subject string `json:"subject"` CreatedAt string `json:"createdAt"` }
func GetBranches ¶
func GetForEachRef ¶
type Repository ¶
type Repository struct { Name string `bson:"_id"` Users []string ReadOnlyUsers []string IsPublic bool }
Repository represents a Git repository. A Git repository is a record in the database and a directory in the filesystem (the bare repository).
func New ¶
func New(name string, users, readOnlyUsers []string, isPublic bool) (*Repository, error)
New creates a representation of a git repository. It creates a Git repository using the "bare-dir" setting and saves repository's meta data in the database.
func (*Repository) MarshalJSON ¶
func (r *Repository) MarshalJSON() ([]byte, error)
MarshalJSON marshals the Repository in json format.
func (*Repository) ReadOnlyURL ¶
func (r *Repository) ReadOnlyURL() string
ReadOnly formats the git url and return it. If no host is configured in gandalf.conf, this method panics.
func (*Repository) ReadWriteURL ¶
func (r *Repository) ReadWriteURL() string
ReadWriteURL formats the git ssh url and return it. If no remote is configured in gandalf.conf, this method panics.