gitlab

package
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 22, 2026 License: MIT Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package gitlab defines the client used to resolve a git_patch's gitlab source (a merge request or commit) against the GitLab REST API. It is a thin wrapper around gitlab.com/gitlab-org/api/client-go so tests can inject a fake.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	// ResolveMR resolves a merge request IID in project (a GitLab project
	// path, e.g. "group/subgroup/project", or a numeric project ID as a
	// string) to its head commit SHA and a unified diff synthesized from
	// its changed files.
	ResolveMR(ctx context.Context, project string, mr int64, token string) (Resolution, error)

	// ResolveCommit resolves a commit sha in project to a unified diff
	// synthesized from its changed files.
	ResolveCommit(ctx context.Context, project, sha, token string) (Resolution, error)
}

Client resolves gitlab patch sources against the GitLab API. An empty token means an unauthenticated request.

func New

func New(opts ...Option) Client

New creates a Client that talks to the GitLab REST API via gitlab.com/gitlab-org/api/client-go.

type Option

type Option func(*client)

Option configures a client constructed via New.

func WithBaseURL

func WithBaseURL(u string) Option

WithBaseURL overrides the API base URL. Intended for tests to point the client at a fake server.

func WithoutRetries

func WithoutRetries() Option

WithoutRetries disables the underlying client's automatic retry-with- backoff behavior on server errors. Intended for tests against a fake server, where retries only add latency rather than resilience.

type Resolution

type Resolution struct {
	SHA  string
	Diff string
}

Resolution is the result of resolving a merge request or commit to a concrete commit SHA and unified diff.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL