git

package
v0.0.0-...-a55c9a4 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Blob

type Blob struct {
	*object.Blob
	// SHA-1 hash of the blob.
	Hash plumbing.Hash
	// Size of the blob content in bytes.
	Size int64
	// True if this blob is not referenced by any commit.
	IsOrphaned bool
	// File path in the repository (empty for orphaned blobs).
	Path string
	// Hash of the commit (empty for orphaned blobs).
	CommitHash plumbing.Hash
	// Message of the commit (empty for orphaned blobs).
	CommitMessage string
	// Author of the commit (empty for orphaned blobs).
	Author object.Signature
	// Committer of the commit (empty for orphaned blobs).
	Committer object.Signature
}

Blob wraps a go-git blob with additional metadata.

func (*Blob) Contents

func (b *Blob) Contents() ([]byte, error)

The contents of the blob as a byte slice.

func (*Blob) ContentsAsString

func (b *Blob) ContentsAsString() (string, error)

Contents of the blob as a string.

type CloneConfig

type CloneConfig struct {
	URL        string
	WorkingDir string
	Type       CloneType
	Verbose    bool
}

CloneConfig holds configuration for clone operations.

type CloneType

type CloneType int

CloneType represents different types of git clone operations

const (
	Normal CloneType = iota
	Shallow
	Mirror
)

type Repository

type Repository struct {
	*gogit.Repository
	// Path is the filesystem path to the repository.
	Path string
}

Repository wraps and embeds a go-git Repository and its local path. Embedded go-git methods are available directly on Repository.

func Clone

func Clone(url, workingDir string, verbose ...bool) (*Repository, error)

Clone the repository in URL to "workingDir/repoName". If the optional verbose parameter is true, progress will be sent to stdout.

func CloneMirror

func CloneMirror(url, workingDir string, verbose ...bool) (*Repository, error)

Create a bare mirror clone like "--mirror".

func CloneShallow

func CloneShallow(url, workingDir string, verbose ...bool) (*Repository, error)

Create a shallow clone like "--depth=1".

func Open

func Open(path string) (*Repository, error)

Opens an existing git repository at the given path and returns a Repository wrapper.

func (*Repository) AllBlobs

func (r *Repository) AllBlobs() ([]*Blob, error)

AllBlobs retrieves all blob objects from the repository. Returns enhanced Blob objects including both commit-referenced and orphaned blobs.

func (*Repository) CommitBlobs

func (r *Repository) CommitBlobs() ([]*Blob, error)

CommitBlobs retrieves all blob objects from the repository by walking through commits. Returns enhanced Blob objects with commit context and file path information.

func (*Repository) OrphanedBlobs

func (r *Repository) OrphanedBlobs() ([]*Blob, error)

OrphanedBlobs retrieves only the orphaned blob objects from the repository. Returns enhanced Blob objects that exist in the object database but are not referenced by any commit.

Jump to

Keyboard shortcuts

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