Documentation
¶
Overview ¶
Package vcs provides version control system abstractions.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidType = errors.New("invalid type")
ErrInvalidType is returned when a type assertion fails for vcs types.
Functions ¶
func SetDefaultOpener ¶
func SetDefaultOpener(opener Opener)
SetDefaultOpener sets the default git opener (useful for testing).
Types ¶
type BlameResult ¶
type BlameResult struct {
Lines []BlameLine
}
BlameResult contains blame information for a file.
type Change ¶
type Change interface {
// From returns the source file name (empty for new files).
FromName() string
// To returns the destination file name (empty for deleted files).
ToName() string
// Patch computes the patch for this change.
Patch() (Patch, error)
}
Change represents a single file change.
type Commit ¶
type Commit interface {
// Hash returns the commit hash.
Hash() plumbing.Hash
// NumParents returns the number of parent commits.
NumParents() int
// Parent returns the nth parent commit.
Parent(n int) (Commit, error)
// Tree returns the tree object for this commit.
Tree() (Tree, error)
// Stats returns file stats for this commit.
Stats() (object.FileStats, error)
// Author returns commit author information.
Author() object.Signature
}
Commit represents a git commit.
type CommitIterator ¶
CommitIterator iterates over commits.
type ContextAwareRepository ¶
type ContextAwareRepository interface {
Repository
// LogWithContext returns a commit iterator with context support.
LogWithContext(ctx context.Context, opts *LogOptions) (CommitIterator, error)
}
ContextAwareRepository extends Repository with context-aware operations.
type FilePatch ¶
type FilePatch interface {
Chunks() []Chunk
}
FilePatch represents changes to a single file.
type GitOpener ¶
type GitOpener struct{}
GitOpener opens git repositories using go-git.
func (*GitOpener) PlainOpen ¶
func (o *GitOpener) PlainOpen(path string) (Repository, error)
PlainOpen opens an existing git repository.
func (*GitOpener) PlainOpenWithDetect ¶
func (o *GitOpener) PlainOpenWithDetect(path string) (Repository, error)
PlainOpenWithDetect opens a git repository, detecting .git in parent directories.
type LogOptions ¶
LogOptions configures the commit log query.
type Opener ¶
type Opener interface {
// PlainOpen opens an existing git repository.
PlainOpen(path string) (Repository, error)
// PlainOpenWithDetect opens a git repository, detecting .git in parent directories.
PlainOpenWithDetect(path string) (Repository, error)
}
Opener opens git repositories.
type Repository ¶
type Repository interface {
// Head returns a reference to the HEAD commit.
Head() (Reference, error)
// Log returns a commit iterator starting from HEAD.
Log(opts *LogOptions) (CommitIterator, error)
// CommitObject returns the commit with the given hash.
CommitObject(hash plumbing.Hash) (Commit, error)
// Blame returns blame information for a file at a specific commit.
Blame(commit Commit, path string) (*BlameResult, error)
}
Repository provides access to git repository operations.