git

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package git provides functionality for Git operations in Shipyard projects.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsGitRepository

func IsGitRepository(workingDir string) bool

IsGitRepository checks if the current directory is a git repository

Types

type GitClient

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

GitClient provides git operations for shipyard using go-git

func NewGitClient

func NewGitClient(workingDir string) (*GitClient, error)

NewGitClient creates a new git client

func (*GitClient) AddFile

func (g *GitClient) AddFile(filepath string) error

AddFile adds a file to git staging

func (*GitClient) AddFiles

func (g *GitClient) AddFiles(filepaths []string) error

AddFiles adds multiple files to git staging

func (*GitClient) Commit

func (g *GitClient) Commit(message string) (string, error)

Commit creates a git commit with the given message

func (*GitClient) CreateTag

func (g *GitClient) CreateTag(tagName, message string) error

CreateTag creates a git tag

func (*GitClient) GetCurrentBranch

func (g *GitClient) GetCurrentBranch() (string, error)

GetCurrentBranch returns the current git branch

func (*GitClient) GetCurrentCommit

func (g *GitClient) GetCurrentCommit() (string, error)

GetCurrentCommit returns the current commit hash

func (*GitClient) GetLatestTag

func (g *GitClient) GetLatestTag() (string, error)

GetLatestTag returns the latest git tag

func (*GitClient) GetTagsForPattern

func (g *GitClient) GetTagsForPattern(pattern string) ([]string, error)

GetTagsForPattern returns all tags matching a pattern

func (*GitClient) HasUncommittedChanges

func (g *GitClient) HasUncommittedChanges() (bool, error)

HasUncommittedChanges checks if there are uncommitted changes

func (*GitClient) Push

func (g *GitClient) Push() error

Push pushes current branch to remote

func (*GitClient) PushTags

func (g *GitClient) PushTags() error

PushTags pushes all tags to remote

func (*GitClient) TagExists

func (g *GitClient) TagExists(tagName string) (bool, error)

TagExists checks if a git tag exists

type GitOperations

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

GitOperations provides high-level git operations for shipyard

func NewGitOperations

func NewGitOperations(projectConfig *config.ProjectConfig) *GitOperations

NewGitOperations creates a new git operations manager

func NewGitOperationsWithDir

func NewGitOperationsWithDir(projectConfig *config.ProjectConfig, workingDir string) *GitOperations

NewGitOperationsWithDir creates a new git operations manager with custom directory

func (*GitOperations) CommitShipmentChanges

func (g *GitOperations) CommitShipmentChanges(filesToCommit []string, commitMessage string) (string, error)

CommitShipmentChanges commits shipment-related changes

func (*GitOperations) CreateShipmentCommitMessage

func (g *GitOperations) CreateShipmentCommitMessage(versions map[string]*semver.Version, consignmentSummaries []string) string

CreateShipmentCommitMessage creates a commit message for a shipment

func (*GitOperations) CreateShipmentTags

func (g *GitOperations) CreateShipmentTags(versions map[string]*semver.Version, commitMessage string) (map[string]string, error)

CreateShipmentTags creates git tags for a shipment

func (*GitOperations) GenerateTagName

func (g *GitOperations) GenerateTagName(packageName string, version *semver.Version) string

GenerateTagName generates a git tag name for a package version

func (*GitOperations) GetFilesToCommit

func (g *GitOperations) GetFilesToCommit(changelogPath string, packages []string) []string

GetFilesToCommit returns the list of files that should be committed for a shipment

func (*GitOperations) IsAvailable

func (g *GitOperations) IsAvailable() bool

IsAvailable checks if git is available and we're in a git repository

func (*GitOperations) PerformShipmentGitOperations

func (g *GitOperations) PerformShipmentGitOperations(versions map[string]*semver.Version, changelogPath string, consignmentSummaries []string, autoCommit, autoPush bool) error

PerformShipmentGitOperations performs all git operations for a shipment

Jump to

Keyboard shortcuts

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