gitbridge

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RefHeadsPrefix = "refs/heads/"
	RefTagsPrefix  = "refs/tags/"
)

Branch ref prefixes.

Variables

This section is empty.

Functions

func ExportRevisions

func ExportRevisions(ws *revision.Workspace, repo *store.Repo, opts PushOptions) ([]string, error)

ExportRevisions writes the revisions to dest as git commits on Branch and returns the commit shas written. It creates a fresh repo per run and force-pushes the branch, so it is idempotent for the exported tip. EasyVCS's own object store is never written as git objects — git only exists here in a temporary worktree.

When opts.Squash is true, all revisions are collapsed into a single commit (whose tree is the newest revision's snapshot). When opts.Tags is non-empty, each entry is exported as a lightweight git tag refs/tags/<name> pointing at the commit that exported the revision.

func ImportBranch

func ImportBranch(ws *revision.Workspace, repo *store.Repo, opts ImportOptions) ([]string, error)

ImportBranch pulls a git branch into easyvcs. Each git commit becomes a revision (reusing the `revision:` header id when known, else generating a new one) and returns the local revision ids created, oldest first.

Types

type ImportOptions

type ImportOptions struct {
	Source string
	Branch string
	Token  string
	// SSHKey, when set, authenticates ssh:// and git@host remotes via a PEM key.
	SSHKey string
	// SSHKeyPassphrase, if the SSHKey is encrypted.
	SSHKeyPassphrase string
}

ImportOptions configures a pull.

type PushOptions

type PushOptions struct {
	Dest      string
	Branch    string
	Revisions []string
	// Tags, if set, are exported as lightweight git tags (refs/tags/<name>)
	// pointing at the tip commit of each revision.
	Tags   []TagRef
	Author store.Author
	Token  string
	// SSHKey, when set (a path to a PEM private key), authenticates ssh:// and
	// git@host remotes via public key. When empty, an SSH agent is used.
	SSHKey string
	// SSHKeyPassphrase, if the SSHKey is encrypted.
	SSHKeyPassphrase string
	// Squash, when true, collapses every revision into a single commit.
	Squash bool
}

PushOptions configures an export.

type TagRef

type TagRef struct {
	Name string
	Rev  string
}

TagRef is a git tag name -> easyvcs revision id to export as refs/tags/<name>.

Jump to

Keyboard shortcuts

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