Documentation
¶
Index ¶
- type CommitWithTags
- type Project
- func (p Project) BranchName() (string, error)
- func (p Project) CommitDate() (time.Time, time.Time, error)
- func (p Project) CommitFiles(c *object.Commit) ([]string, error)
- func (p Project) CommitHash() (string, error)
- func (p Project) CommitHistory() ([]CommitWithTags, error)
- func (p Project) CommitSinceTag(tag string) ([]*object.Commit, bool, error)
- func (p Project) CreateTag(name, message string) error
- func (p Project) IsHeadTagged(tag string) (bool, error)
- func (p Project) IsShallow() bool
- func (p Project) LastTag(f format.VersionFormat) (string, error)
- func (p Project) PushTags() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CommitWithTags ¶
CommitWithTags groups a commit with the tag names that point directly to it. Tags is nil for most commits.
type Project ¶
type Project struct {
// contains filtered or unexported fields
}
func NewProject ¶
func NewProjectFromRepo ¶
NewProjectFromRepo builds a Project directly from an already-opened repository and a commit hash. Used in tests with in-memory repositories.
func (Project) BranchName ¶
func (Project) CommitDate ¶
CommitDate returns the author and committer timestamps of the HEAD commit.
func (Project) CommitFiles ¶
CommitFiles returns the list of files changed in c relative to its first parent. For the initial commit (no parent), returns all files in the tree.
func (Project) CommitHash ¶
func (Project) CommitHistory ¶
func (p Project) CommitHistory() ([]CommitWithTags, error)
CommitHistory returns all commits reachable from HEAD in topological order (HEAD first, ancestors later), each annotated with the tag names pointing to it. Annotated tags are resolved to their target commit before matching. Tags whose commits cannot be resolved (e.g. shallow clone) are silently skipped.
func (Project) CommitSinceTag ¶
CommitSinceTag returns all commits reachable from HEAD back to (and including) the tagged commit. The bool truncated is true when the tag commit was not found during traversal — this happens in shallow clones where the tag is beyond the clone depth. In that case the returned commits are those that were traversable.
func (Project) CreateTag ¶
CreateTag creates an annotated tag on HEAD with the given message. Returns an error if the tag already exists.
func (Project) IsHeadTagged ¶
IsHeadTagged reports whether the HEAD commit is the same commit pointed to by tag.
func (Project) IsShallow ¶
IsShallow reports whether this repository is a shallow clone. A shallow clone has one or more grafted commits (commits whose parents were artificially cut by git clone --depth=N).