Documentation
¶
Overview ¶
Package gitbridge connects vx to git hosts. It imports upstream branches as changesets and exports effort changes as git commits on vx/ branches.
Each repo has a bare git mirror under the data directory. Imports fetch only the branch in use, shallow at first, and map git objects to vx objects in Postgres so later imports skip everything that did not change.
Index ¶
- Constants
- Variables
- type Bridge
- func (b *Bridge) DefaultBranch(ctx context.Context, repo store.Repo) (string, error)
- func (b *Bridge) ExportBranch(ctx context.Context, repo store.Repo, baseSHA, branch string, ...) ([]string, error)
- func (b *Bridge) OpenPullRequest(ctx context.Context, repo store.Repo, pr provider.PullRequest) (provider.OpenedPR, error)
- func (b *Bridge) SyncBranch(ctx context.Context, repo store.Repo, branch string) (store.Branch, int, error)
Constants ¶
const BranchPrefix = "vx/"
BranchPrefix is the only namespace vx ever pushes to.
Variables ¶
var ErrBranchNotFound = errors.New("branch not found on the remote")
ErrBranchNotFound is returned when the remote has no such branch.
Functions ¶
This section is empty.
Types ¶
type Bridge ¶
type Bridge struct {
Store *store.Store
Blobs blob.Store
Dir string // root for bare mirrors
// GitHubToken returns a token for github.com, or "" for anonymous access.
GitHubToken func() string
// GitHubAPI is the REST API base URL (tests point it at a fake).
GitHubAPI string
// GitHubGitBase is the base URL for git over HTTPS (tests override it).
GitHubGitBase string
// FirstDepth is how many commits the first import of a branch fetches.
FirstDepth int
// SyncDepth bounds how many new commits one sync imports.
SyncDepth int
Log *slog.Logger
// contains filtered or unexported fields
}
Bridge imports from and exports to git remotes.
func (*Bridge) DefaultBranch ¶
DefaultBranch asks the remote which branch HEAD points to.
func (*Bridge) ExportBranch ¶
func (b *Bridge) ExportBranch(ctx context.Context, repo store.Repo, baseSHA, branch string, commits []provider.Commit) ([]string, error)
ExportBranch writes commits on top of the git commit baseSHA and pushes them to branch, which must start with "vx/". It returns the git SHA of every commit, oldest first.