Documentation ¶
Index ¶
- Constants
- Variables
- func AddGitProtocolEnv(ctx context.Context, req RequestWithGitProtocol, env []string) []string
- func BareCommand(ctx context.Context, stdin io.Reader, stdout, stderr io.Writer, env []string, ...) (*command.Command, error)
- func BuildGitOptions(gitOpts []string, otherOpts ...string) []string
- func Command(ctx context.Context, repo repository.GitRepo, args ...string) (*command.Command, error)
- func CommandWithoutRepo(ctx context.Context, args ...string) (*command.Command, error)
- func HookEnv(req ReceivePackRequest) []string
- func InfoAlternatesPath(repo repository.GitRepo) (string, error)
- func IsValidRef(ctx context.Context, repo *gitalypb.Repository, ref string) bool
- func NoMissingWantErrMessage() bool
- func ReceivePackConfig() []string
- func StdinCommand(ctx context.Context, repo repository.GitRepo, args ...string) (*command.Command, error)
- func SupportsDeltaIslands(versionStr string) (bool, error)
- func ValidateCommitID(id string) error
- func ValidateRevision(revision []byte) error
- func Version() (string, error)
- func VersionLessThan(v1Str, v2Str string) (bool, error)
- type ReceivePackRequest
- type RequestWithGitProtocol
Constants ¶
const ( // EmptyTreeID is the Git tree object hash that corresponds to an empty tree (directory) EmptyTreeID = "4b825dc642cb6eb9a060e54bf8d69288fbee4904" // NullSHA is the special value that Git uses to signal a ref or object does not exist NullSHA = "0000000000000000000000000000000000000000" )
const (
// ProtocolV2 is the special value used by Git clients to request protocol v2
ProtocolV2 = "version=2"
)
Variables ¶
var FallbackTimeValue = time.Unix(1<<63-62135596801, 999999999)
FallbackTimeValue is the value returned by `SafeTimeParse` in case it encounters a parse error. It's the maximum time value possible in golang. See https://gitlab.com/gitlab-org/gitaly/issues/556#note_40289573
Functions ¶
func AddGitProtocolEnv ¶ added in v0.125.0
func AddGitProtocolEnv(ctx context.Context, req RequestWithGitProtocol, env []string) []string
AddGitProtocolEnv checks whether the request has Git protocol v2 and sets this in the environment.
func BareCommand ¶ added in v0.126.0
func BareCommand(ctx context.Context, stdin io.Reader, stdout, stderr io.Writer, env []string, args ...string) (*command.Command, error)
BareCommand creates a git.Command with the given args, stdin/stdout/stderr, and env
func BuildGitOptions ¶ added in v0.118.0
BuildGitOptions helps to generate options to the git command. If gitOpts is not empty then its values are passed as part of the "-c" option of the git command, the other values are passed along with the subcommand.
func Command ¶ added in v0.41.0
func Command(ctx context.Context, repo repository.GitRepo, args ...string) (*command.Command, error)
Command creates a git.Command with the given args and Repository
func CommandWithoutRepo ¶ added in v0.92.0
CommandWithoutRepo works like Command but without a git repository
func HookEnv ¶ added in v1.50.0
func HookEnv(req ReceivePackRequest) []string
HookEnv is information we pass down to the Git hooks during git-receive-pack.
func InfoAlternatesPath ¶ added in v1.31.0
func InfoAlternatesPath(repo repository.GitRepo) (string, error)
InfoAlternatesPath finds the fully qualified path for the alternates file.
func IsValidRef ¶ added in v0.41.0
IsValidRef checks if a ref in a repo is valid
func NoMissingWantErrMessage ¶ added in v1.55.0
func NoMissingWantErrMessage() bool
NoMissingWantErrMessage checks if the git version is before Git 2.22, in which versions the missing objects in the wants didn't yield an explicit error message, but no ouput at all.
func ReceivePackConfig ¶ added in v1.50.0
func ReceivePackConfig() []string
ReceivePackConfig contains config options we want to enforce when receiving a push with git-receive-pack.
func StdinCommand ¶ added in v1.7.0
func StdinCommand(ctx context.Context, repo repository.GitRepo, args ...string) (*command.Command, error)
StdinCommand creates a git.Command with the given args and Repository that is suitable for Write()ing to
func SupportsDeltaIslands ¶ added in v1.30.0
SupportsDeltaIslands checks if a version string (e.g. "2.20.0") corresponds to a Git version that supports delta islands.
func ValidateCommitID ¶ added in v1.13.0
ValidateCommitID checks if id could be a Git commit ID, syntactically.
func ValidateRevision ¶ added in v0.31.0
ValidateRevision checks if a revision looks valid
func VersionLessThan ¶ added in v1.34.0
VersionLessThan returns true if the parsed version value of v1Str is less than the parsed version value of v2Str. An error can be returned if the strings cannot be parsed. Note: this is an extremely simplified semver comparison algorithm
Types ¶
type ReceivePackRequest ¶ added in v1.50.0
type ReceivePackRequest interface { GetGlId() string GetGlUsername() string GetGlRepository() string }
ReceivePackRequest abstracts away the different requests that end up spawning git-receive-pack.
type RequestWithGitProtocol ¶ added in v0.125.0
type RequestWithGitProtocol interface {
GetGitProtocol() string
}
RequestWithGitProtocol holds requests that respond to GitProtocol