resource_git

package
v0.51.2 Latest Latest
Warning

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

Go to latest
Published: May 7, 2026 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SnapshotRepo

func SnapshotRepo(repo *git.Repository, snap *RepoSnapshot) error

SnapshotRepo reads the initial state of the repo into a RepoSnapshot.

Types

type CommitSnapshot

type CommitSnapshot struct {
	// Hash is the commit hash.
	Hash string
	// Message is the commit message.
	Message string
	// AuthorName is the author name.
	AuthorName string
	// AuthorEmail is the author email.
	AuthorEmail string
	// AuthorTimestamp is the author time as Unix seconds.
	AuthorTimestamp int64
}

CommitSnapshot holds snapshot data for a single commit.

type GitRepoResource

type GitRepoResource struct {
	// contains filtered or unexported fields
}

GitRepoResource implements GitRepoResourceService for a git/repo object. Each RPC call re-opens the repo via AccessWorldObjectRepo for read-only access.

func NewGitRepoResource

func NewGitRepoResource(ws world.WorldState, objKey string, snap *RepoSnapshot) *GitRepoResource

NewGitRepoResource creates a new GitRepoResource.

func (*GitRepoResource) GetCommit

GetCommit returns full metadata for a single commit.

func (*GitRepoResource) GetDiffPatch added in v0.51.2

GetDiffPatch returns a unified diff patch between two refs.

func (*GitRepoResource) GetDiffStat

GetDiffStat returns diff stats between two refs.

func (*GitRepoResource) GetMux

func (r *GitRepoResource) GetMux() srpc.Mux

GetMux returns the srpc mux for this resource.

func (*GitRepoResource) GetRepoFilesystemResource

GetRepoFilesystemResource creates a FSHandle sub-resource for the materialized repo filesystem.

func (*GitRepoResource) GetRepoInfo

GetRepoInfo returns repository overview information.

func (*GitRepoResource) GetTreeResource

GetTreeResource creates a FSHandle sub-resource for a ref's tree.

Uses ConstructChildResource to get a sub-context that outlives the RPC call. The persistent block cursors, git store, and FSCursor all use this sub-context and are released when the sub-resource is torn down.

func (*GitRepoResource) ListRefs

ListRefs lists all branches and tags in the repository.

func (*GitRepoResource) Log

Log returns a paginated list of commits starting from a ref.

func (*GitRepoResource) ResolveRef

ResolveRef resolves a ref name to a commit hash and tree hash.

type GitWorktreeResource

type GitWorktreeResource struct {
	// contains filtered or unexported fields
}

GitWorktreeResource implements GitWorktreeResourceService for a git/worktree object.

func NewGitWorktreeResource

func NewGitWorktreeResource(ws world.WorldState, engine world.Engine, objKey string, snap *WorktreeSnapshot) *GitWorktreeResource

NewGitWorktreeResource creates a new GitWorktreeResource.

func (*GitWorktreeResource) GetMux

func (r *GitWorktreeResource) GetMux() srpc.Mux

GetMux returns the srpc mux for this resource.

func (*GitWorktreeResource) GetRepoResource

GetRepoResource creates a GitRepoResource sub-resource for the linked git/repo object.

func (*GitWorktreeResource) GetWorkdirResource

GetWorkdirResource creates a FSHandle sub-resource for the mutable workdir.

func (*GitWorktreeResource) GetWorktreeInfo

GetWorktreeInfo returns worktree metadata.

func (*GitWorktreeResource) StageFiles

StageFiles stages files in the git index.

func (*GitWorktreeResource) UnstageFiles

UnstageFiles unstages files from the git index.

func (*GitWorktreeResource) WatchStatus

WatchStatus streams git index state as the worktree changes.

type RefSnapshot

type RefSnapshot struct {
	// Name is the short reference name.
	Name string
	// CommitHash is the commit hash.
	CommitHash string
	// IsHead is true if this ref matches HEAD.
	IsHead bool
}

RefSnapshot holds snapshot data for a single reference.

type RepoSnapshot

type RepoSnapshot struct {
	// HeadRef is the short name of HEAD's target reference.
	HeadRef string
	// HeadCommitHash is the commit hash HEAD resolves to.
	HeadCommitHash string
	// ReadmePath is the path to the README file in the root tree.
	ReadmePath string
	// LastCommit contains info about the HEAD commit.
	LastCommit *CommitSnapshot
	// IsEmpty is true if the repo has no commits.
	IsEmpty bool
	// Branches is the list of branch refs.
	Branches []RefSnapshot
	// Tags is the list of tag refs.
	Tags []RefSnapshot
}

RepoSnapshot holds a snapshot of repo state collected during factory init.

type WorktreeSnapshot

type WorktreeSnapshot struct {
	// RepoObjectKey is the object key of the linked git/repo.
	RepoObjectKey string
	// WorkdirObjectKey is the object key of the linked workdir.
	WorkdirObjectKey string
	// WorkdirRef is the unixfs reference to the workdir.
	WorkdirRef *unixfs_world.UnixfsRef
	// CheckedOutRef is the short name of the checked-out ref.
	CheckedOutRef string
	// HeadCommitHash is the commit hash of the checked-out ref.
	HeadCommitHash string
	// HasWorkdir is true if a workdir is linked.
	HasWorkdir bool
}

WorktreeSnapshot holds a snapshot of worktree state collected during factory init.

Jump to

Keyboard shortcuts

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