gitutil

package
v0.0.0-...-7a0dbad Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ModifyCommit

func ModifyCommit(st storer.EncodedObjectStorer, c *object.Commit, newContent map[string]string, message string) (id plumbing.Hash, err error)

func PatchTree

func PatchTree(eos storer.EncodedObjectStorer, t *object.Tree, changes []object.TreeEntry) (id plumbing.Hash, err error)

PatchTree constructs a new tree by applying changes to it. In changes, the ZeroHash signifies deletion of the path.

func SaveBlob

func SaveBlob(st storer.EncodedObjectStorer, data []byte) (id plumbing.Hash, err error)

func SaveCommit

func SaveCommit(st storer.EncodedObjectStorer, c *object.Commit) (id plumbing.Hash, err error)

func SaveTree

func SaveTree(st storer.EncodedObjectStorer, entries []object.TreeEntry) (id plumbing.Hash, err error)

func ServeGit

func ServeGit(root string, l net.Listener)

from go-git common_test.go

func SortTreeEntries

func SortTreeEntries(es []object.TreeEntry)

func Subject

func Subject(c *object.Commit) string

func TestMapToEntries

func TestMapToEntries(st storer.EncodedObjectStorer, in map[string]string) ([]object.TreeEntry, error)

TestMapToEntries provides input to PatchTree. keys are filenames, with suffixes: * '!' = delete * '*' = executable * '@' = symlink * '#' = submodule.

Types

type TestRepo

type TestRepo struct {
	Repo     *git.Repository
	Listener net.Listener
	Name     string
	RepoURL  string

	FileIDs  map[string]plumbing.Hash
	TreeID   plumbing.Hash
	CommitID plumbing.Hash
}

func SetupTestRepo

func SetupTestRepo(root, name string, fileContents map[string]string) (*TestRepo, error)

func (*TestRepo) Close

func (tr *TestRepo) Close()

func (*TestRepo) Serve

func (tr *TestRepo) Serve(root string) error

Jump to

Keyboard shortcuts

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