Documentation
¶
Overview ¶
Package branch provides types and functions for working with git branches.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Branch ¶
type Branch struct {
// contains filtered or unexported fields
}
Branch represents a git branch with its name.
It encapsulates the branch name and provides methods to interact with it.
type Name ¶
type Name string
Name represents the name of a git branch.
func (Name) Ticket ¶ added in v1.0.0
Ticket extracts a Ticket from the branch name using the provided regular expression.
The regular expression should contain a capturing group that matches the ticket name. If the branch name is empty or does not match the regular expression, an empty Ticket is returned.
Example usage:
re := regexp.MustCompile(`^(?:feature|bugfix|hotfix)/([A-Z]+-\d+)`)
t := NewName("feature/TASK-1234").Ticket(re)
fmt.Println(t.Name()) // Output: TASK-1234
Click to show internal directories.
Click to hide internal directories.