Documentation ¶
Overview ¶
Package gitrepo provides operations on git repos.
Index ¶
- Variables
- func AllCommitDates(repo *git.Repository, refName ReferenceName, prefix string) (dates map[string]Dates, err error)
- func Clone(ctx context.Context, repoURL string) (repo *git.Repository, err error)
- func CloneOrOpen(ctx context.Context, repoPath string) (*git.Repository, error)
- func HeadHash(repo *git.Repository) (plumbing.Hash, error)
- func Open(ctx context.Context, dirpath string) (repo *git.Repository, err error)
- func ParseGitHubRepo(s string) (owner, repoName string, err error)
- func ReadTxtarRepo(filename string, now time.Time) (_ *git.Repository, err error)
- func Root(repo *git.Repository) (root *object.Tree, err error)
- type Dates
- type ReferenceName
Constants ¶
This section is empty.
Variables ¶
View Source
var ( HeadReference = ReferenceName{plumbing.HEAD} // HEAD MainReference = ReferenceName{plumbing.NewRemoteReferenceName("origin", "master")} // origin/master )
Functions ¶
func AllCommitDates ¶
func AllCommitDates(repo *git.Repository, refName ReferenceName, prefix string) (dates map[string]Dates, err error)
AllCommitDates returns the oldest and newest commit timestamps for every file in the repo at the given reference, where the filename begins with prefix. The supplied prefix should include the trailing /.
func CloneOrOpen ¶
CloneOrOpen clones repoPath if it is an HTTP(S) URL, or opens it from the local disk otherwise.
func ParseGitHubRepo ¶
ParseGitHubRepo parses a string of the form owner/repo or github.com/owner/repo.
func ReadTxtarRepo ¶
ReadTxtarRepo converts a txtar file to a single-commit repo. It is intended for testing.
Types ¶
type ReferenceName ¶
type ReferenceName struct{ plumbing.ReferenceName }
ReferenceName is a git reference.
Click to show internal directories.
Click to hide internal directories.