Documentation ¶
Index ¶
- Variables
- func ByteSliceHasAnyPrefix(s []byte, prefixes ...string) bool
- func DecorateError(code codes.Code, err error) error
- func ExitStatus(err error) (int, bool)
- func GetPath(repo *pb.Repository) (string, error)
- func GetRepoPath(repo *pb.Repository) (string, error)
- func GitPath() string
- func IsGitDirectory(dir string) bool
- func IsNumber(s []byte) bool
- func IsValidRef(ctx context.Context, path, ref string) bool
- func UnquoteBytes(s []byte) []byte
- type Command
Constants ¶
This section is empty.
Variables ¶
var Unimplemented = grpc.Errorf(codes.Unimplemented, "this rpc is not implemented")
Unimplemented is a Go error with gRPC error code 'Unimplemented'
Functions ¶
func ByteSliceHasAnyPrefix ¶ added in v0.3.0
ByteSliceHasAnyPrefix tests whether the byte slice s begins with any of the prefixes.
func DecorateError ¶ added in v0.11.0
DecorateError unless it's already a grpc error.
If given nil it will return nil.
func ExitStatus ¶ added in v0.4.0
ExitStatus will return the exit-code from an error
func GetPath ¶ added in v0.15.0
func GetPath(repo *pb.Repository) (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.
func GetRepoPath ¶ added in v0.5.0
func GetRepoPath(repo *pb.Repository) (string, error)
GetRepoPath returns the full path of the 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.
func GitPath ¶ added in v0.18.0
func GitPath() string
GitPath returns the path to the `git` binary. See `SetGitPath` for details on how this is set
func IsGitDirectory ¶ added in v0.15.0
IsGitDirectory checks if the directory passed as first argument looks like a valid git directory.
func IsValidRef ¶ added in v0.23.0
IsValidRef checks if a ref in a repo is valid
func UnquoteBytes ¶ added in v0.9.0
UnquoteBytes removes surrounding double-quotes from a byte slice returning a new slice if they exist, otherwise it returns the same byte slice passed.
Types ¶
type Command ¶ added in v0.3.0
Command encapsulates operations with commands creates with NewCommand
func GitCommandReader ¶ added in v0.3.0
GitCommandReader creates a git Command with the given args
func GitlabShellCommandReader ¶ added in v0.31.0
GitlabShellCommandReader creates a gitlab-shell Command with the given args