gitview

package
v0.1.35 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommitInfo added in v0.1.34

type CommitInfo struct {
	Sha1      string   `json:"sha1"`
	Message   string   `json:"message"`
	Author    string   `json:"author"`
	Timestamp int64    `json:"timestamp"`
	Branch    string   `json:"branch"`
	Parents   []string `json:"parents"`
}

type GitView

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

GitView A read-only view of a git repository.

func New

func New(repositoryRoot string) (*GitView, error)

New opens a git repository from the given path. It detects if the repository is bare or a normal one. If the path doesn't contain a valid repository ErrRepositoryNotExists is returned

func (*GitView) BranchName

func (gv *GitView) BranchName() (string, error)

BranchName returns the current branch name on a repository, or an error if the repo head is not on a branch

func (*GitView) ChangeLog

func (gv *GitView) ChangeLog(currentCommit, previousCommit string, logger *logger.Logger) ([]*CommitInfo, error)

ChangeLog attempts to collect the changelog list of commits for an artifact, the changelog is all commits between current commit and the commit from which the previous artifact in Kosli was created. If collecting the changelog fails (e.g. if git history has been rewritten, or the clone depth is too shallow), the changelog only contains the single commit info which is the current commit

func (*GitView) CommitsBetween

func (gv *GitView) CommitsBetween(oldest, newest string, logger *logger.Logger) ([]*CommitInfo, error)

CommitsBetween list all commits that have happened between two commits in a git repo

func (*GitView) RepoUrl

func (gv *GitView) RepoUrl() (string, error)

RepoUrl returns HTTPS URL for the `origin` remote of a repo

Jump to

Keyboard shortcuts

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