Documentation
¶
Overview ¶
Package mirror manages bare git mirrors on disk.
Index ¶
- func RemoteSha(ctx context.Context, url, branch string, sshEnv []string) (string, error)
- func SshEnv(privateKeyFile, knownHostsFile, hostKeyPolicy string) []string
- type Repo
- func (repo *Repo) DiffFiles(ctx context.Context, oldSha, newSha string) ([]string, error)
- func (repo *Repo) EnsureCommit(ctx context.Context, sha string) error
- func (repo *Repo) HasCommit(ctx context.Context, sha string) bool
- func (repo *Repo) IsAncestor(ctx context.Context, ancestor, descendant string) bool
- func (repo *Repo) ListFiles(ctx context.Context, sha, path string) ([]string, error)
- func (repo *Repo) LocalHead(branch string) (string, error)
- func (repo *Repo) ReadFile(ctx context.Context, sha, filePath string) ([]byte, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Repo ¶
type Repo struct {
// contains filtered or unexported fields
}
func Open ¶
func Open(ctx context.Context, url, dataPath string, sshEnv []string, logger *slog.Logger) (*Repo, error)
Returns a repo for url, cloning it as a bare mirror if it does not exist yet.
func (*Repo) EnsureCommit ¶
Guarantees that the sha is present in the local mirror.
func (*Repo) IsAncestor ¶
IsAncestor reports whether ancestor is reachable from descendant in the local mirror.
Click to show internal directories.
Click to hide internal directories.