Help us shape the future of Go! Take the 2026 Go Developer Survey

snapshot

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotGit = errors.New("not inside a git repository")

Functions

func RepoID

func RepoID(commonDir string) string

func SafeName

func SafeName(s string) string

func SessionRef

func SessionRef(sessionID string) string

Types

type Repo

type Repo struct {
	Top        string
	GitDir     string
	CommonDir  string
	ObjectsDir string
	ID         string
}

func Discover

func Discover(dir string) (Repo, error)

func (Repo) Git

func (r Repo) Git() gitx.Git

func (Repo) Head

func (r Repo) Head() string

func (Repo) RemoteURL

func (r Repo) RemoteURL() string

type Shadow

type Shadow struct {
	Path    string
	Repo    Repo
	Exclude []string
}

func Open

func Open(shadowRoot string, r Repo, exclude []string) (*Shadow, error)

func (*Shadow) CommitTree

func (s *Shadow) CommitTree(tree, message string, parents ...string) (string, error)

func (*Shadow) DeleteSession

func (s *Shadow) DeleteSession(sessionID string) error

func (*Shadow) EmptyTree

func (s *Shadow) EmptyTree() (string, error)

func (*Shadow) GC

func (s *Shadow) GC() error

func (*Shadow) Git

func (s *Shadow) Git() gitx.Git

func (*Shadow) Head

func (s *Shadow) Head(sessionID string) string

func (*Shadow) Take

func (s *Shadow) Take(sessionID, label string) (string, error)

Take records the working tree as a new commit on the session's chain. The first snapshot of a session has the user's HEAD as its parent.

func (*Shadow) TreeOf

func (s *Shadow) TreeOf(commit string) (string, error)

func (*Shadow) WriteIndexTree

func (s *Shadow) WriteIndexTree(userIndex string) (string, error)

WriteIndexTree writes the tree of a copy of a user index, so git can not touch the user's index file.

func (*Shadow) WriteTree

func (s *Shadow) WriteTree(indexName string) (string, error)

WriteTree writes the tree of the working tree into the shadow object store. The user's index, refs and objects stay unchanged.

Jump to

Keyboard shortcuts

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