git

package
v0.10.3 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Port

type Port interface {
	// GetContainedTags returns the list of tags contained by the given branch.
	GetContainedTags(branch string) ([]*Tag, error)
	GuessGHRepo() (owner string, repo string)
	GuessDefaultBranch() string
}

Port is the interface that must be implemented by git adapters.

type Tag

type Tag struct {
	Name   string          // tag name (without modification)
	Time   time.Time       // commit time of the tag
	Semver *semver.Version // semver version read from tag name (nil if the tag name is not in the expected format)
	Prefix string          // Prefix read before the semver version
}

Tag represents a git tag with its name, creation time and semantic version.

func NewTag

func NewTag(name string, date time.Time) *Tag

NewTag creates a new Tag instance with the given name and date. It also parses the name to extract the semantic version of the tag: if the tag name has a prefix "v", the prefix will be removed before parsing the version, if the tag name is in the form foo/v1.2.3, the prefix part ("foo/") will be removed before parsing If the name is not in the expected format, the Semver field of the returned Tag will be nil.

func (*Tag) LessThan

func (t1 *Tag) LessThan(t2 *Tag) bool

LessThan compares the current Tag instance with another Tag instance and returns true if the current Tag is less than the other Tag. It compares the semantic versions of the tags and if they are equal, it compares the creation time of the tags.

func (*Tag) NewName

func (t *Tag) NewName(newVersion semver.Version) string

NewName returns the new name for the tag based on the provided new version. If the current tag name has a prefix ("v"...), the new name will also have the same prefix. Otherwise, the new name will not have any prefix.

Jump to

Keyboard shortcuts

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