Documentation ¶
Index ¶
- func CreateTestRepository(tmp_path string, repo string, file string, content string, folders ...string) (func(), error)
- func GetArchive(repo, ref string, format ArchiveFormat) ([]byte, error)
- func GetFileContents(repo, ref, path string) ([]byte, error)
- func GetTree(repo, ref, path string) ([]map[string]string, error)
- func GrantAccess(rNames, uNames []string) error
- func Remove(name string) error
- func Rename(oldName, newName string) error
- func RevokeAccess(rNames, uNames []string) error
- type ArchiveFormat
- type ContentRetriever
- type GitContentRetriever
- type MockContentRetriever
- type Repository
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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 GetFileContents ¶
GetFileContents returns the contents for a given file in a given ref for the specified repository
func GrantAccess ¶
GrantAccess gives write permission for users in all specified repositories. If any of the repositories/users do not exists, GrantAccess just skips it.
func RevokeAccess ¶
RevokeAccess revokes write permission from users in all specified repositories.
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) }
var Retriever ContentRetriever
type GitContentRetriever ¶
type GitContentRetriever struct{}
func (*GitContentRetriever) GetArchive ¶
func (*GitContentRetriever) GetArchive(repo, ref string, format ArchiveFormat) ([]byte, error)
func (*GitContentRetriever) GetContents ¶
func (*GitContentRetriever) GetContents(repo, ref, path string) ([]byte, error)
type MockContentRetriever ¶
type MockContentRetriever struct { LastFormat ArchiveFormat LastRef string LastPath string ResultContents []byte Tree []map[string]string LookPathError error OutputError error }
func (*MockContentRetriever) GetArchive ¶
func (r *MockContentRetriever) GetArchive(repo, ref string, format ArchiveFormat) ([]byte, error)
func (*MockContentRetriever) GetContents ¶
func (r *MockContentRetriever) GetContents(repo, ref, path string) ([]byte, error)
type Repository ¶
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 []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.