backend

package
v0.0.0-...-ae5e3d9 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package backend provides shared logic for the gitgres CLI and remote-helper: URL parsing (ParseURL), ref listing (ListRefs), and copying objects/refs between a local go-git repo and a Postgres storer (CopyObjectsFromRepoToStorer, etc.).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyFromStorerToRepo

func CopyFromStorerToRepo(ctx context.Context, pgStorer *storer.PostgresStorer, repo *git.Repository) (objN, refN int, err error)

CopyFromStorerToRepo copies all objects and refs from the Postgres storer into the repo. Returns (objectCount, refCount, error).

func CopyObjectsFromRepoToStorer

func CopyObjectsFromRepoToStorer(repo *git.Repository, pgStorer *storer.PostgresStorer) (int, error)

CopyObjectsFromRepoToStorer copies all objects from a local repo into the Postgres storer. Returns the number of objects copied.

func CopyRefsFromRepoToStorer

func CopyRefsFromRepoToStorer(repo *git.Repository, pgStorer *storer.PostgresStorer) (int, error)

CopyRefsFromRepoToStorer copies all refs from a local repo into the Postgres storer. Returns the number of refs copied.

func ParseURL

func ParseURL(url string) (conninfo, reponame string, err error)

ParseURL splits "conninfo/reponame" into conninfo and reponame.

Types

type RefLine

type RefLine struct {
	Hash     string // object ID for hash refs
	Name     string // ref name, e.g. refs/heads/main
	Symbolic string // target ref name for symbolic refs
}

RefLine is one ref for listing. For hash refs, Hash is set and Symbolic is empty; for symbolic refs, Symbolic is the target name and Hash is empty. Name is always set.

func ListRefs

func ListRefs(ctx context.Context, s *storer.PostgresStorer) ([]RefLine, error)

ListRefs returns all refs from the storer for the caller to format or print.

Jump to

Keyboard shortcuts

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