Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrRelativePathEscapesRoot = errors.New("relative path escapes root directory")
Functions ¶
func IsGitDirectory ¶
IsGitDirectory checks if the directory passed as first argument looks like a valid git directory.
func ValidateRelativePath ¶
ValidateRelativePath validates a relative path by joining it with rootDir and verifying the result is either rootDir or a path within rootDir. Returns clean relative path from rootDir to relativePath or an ErrRelativePathEscapesRoot if the resulting path is not contained within rootDir.
func WriteMetadataFile ¶
WriteMetadataFile marshals and writes a metadata file
Types ¶
type GitalyServers ¶
type GitalyServers map[string]ServerInfo
GitalyServers hold Gitaly servers info like {"default":{"token":"x","address":"y"}}, to be passed in `gitaly-servers` metadata.
type Locator ¶
type Locator interface { // GetRepoPath returns the full path of the repository referenced by an // RPC Repository message. It verifies the path is an existing git directory. // The errors returned are gRPC errors with relevant error codes and should // be passed back to gRPC without further decoration. GetRepoPath(repo repository.GitRepo) (string, error) // GetPath returns the path of the repo passed as first argument. An error is // returned when either the storage can't be found or the path includes // constructs trying to perform directory traversal. GetPath(repo repository.GitRepo) (string, error) // GetStorageByName will return the path for the storage, which is fetched by // its key. An error is return if it cannot be found. GetStorageByName(storageName string) (string, error) // GetObjectDirectoryPath returns the full path of the object directory in a // repository referenced by an RPC Repository message. The errors returned are // gRPC errors with relevant error codes and should be passed back to gRPC // without further decoration. GetObjectDirectoryPath(repo repository.GitRepo) (string, error) // InfoAlternatesPath finds the fully qualified path for the alternates file. InfoAlternatesPath(repo repository.GitRepo) (string, error) }
Locator allows to get info about location of the repository or storage at the local file system.
type Metadata ¶
type Metadata struct {
GitalyFilesystemID string `json:"gitaly_filesystem_id"`
}
Metadata contains metadata about the filesystem
func ReadMetadataFile ¶
ReadMetadataFile reads and decodes the json metadata file
type ServerInfo ¶
ServerInfo contains information about how to reach a Gitaly server or a Praefect virtual storage. This is necessary for Gitaly RPC's involving more than one Gitaly. Without this information, Gitaly would not know how to reach the remote peer.