git

package
v0.0.0-...-94cc341 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package git provides Git operations for dependency updates

Package git provides Git operations for dependency updates

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckGitInstalled

func CheckGitInstalled() error

CheckGitInstalled checks if git CLI is available

Types

type DefaultGitOperator

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

DefaultGitOperator implements GitOperator interface using system git commands

func NewGitOperator

func NewGitOperator(workingDir string) *DefaultGitOperator

NewGitOperator creates a new Git operator

func (*DefaultGitOperator) CommitChanges

func (g *DefaultGitOperator) CommitChanges(commitMessage string) error

CommitChanges commits all changes with the given message

func (*DefaultGitOperator) CreateBranch

func (g *DefaultGitOperator) CreateBranch(newBranchName string) error

CreateBranch creates a new branch from the current branch

func (*DefaultGitOperator) DeleteBranch

func (g *DefaultGitOperator) DeleteBranch(branchName string) error

func (*DefaultGitOperator) GetCommitID

func (g *DefaultGitOperator) GetCommitID() (string, error)

GetCommitID returns the commit ID of the current branch

func (*DefaultGitOperator) GetCurrentBranch

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

GetCurrentBranch returns the current branch name

func (*DefaultGitOperator) GetRepoURL

func (g *DefaultGitOperator) GetRepoURL() (string, error)

GetRepo retrieves the repository information from the current working directory It returns the repository URL and parses it into a Repository struct

func (*DefaultGitOperator) HasChanges

func (g *DefaultGitOperator) HasChanges() (bool, error)

HasChanges returns true if there are uncommitted changes

func (*DefaultGitOperator) PushBranch

func (g *DefaultGitOperator) PushBranch() error

PushBranch pushes the current branch to remote origin

type GitCloner

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

GitCloner handles automatic repository cloning

func NewGitClonerFromConfig

func NewGitClonerFromConfig(repoConfig *config.RepoConfig) *GitCloner

NewGitClonerFromConfig creates a new git cloner from repository configuration

func (*GitCloner) Cleanup

func (g *GitCloner) Cleanup() error

Cleanup removes the temporary directory and all its contents

func (*GitCloner) CloneRepository

func (g *GitCloner) CloneRepository() (string, error)

CloneRepository clones the repository and returns the path to the cloned directory

func (*GitCloner) GetClonedPath

func (g *GitCloner) GetClonedPath() string

GetClonedPath returns the path to the cloned repository

func (*GitCloner) GetTempDir

func (g *GitCloner) GetTempDir() string

GetTempDir returns the temporary directory path (useful for testing)

type GitOperator

type GitOperator interface {
	// CreateBranch creates a new branch from the current branch
	CreateBranch(branchName string) error

	// CommitChanges commits all changes with the given message
	CommitChanges(commitMessage string) error

	// PushBranch pushes the current branch to remote origin
	PushBranch() error

	// GetCurrentBranch returns the current branch name
	GetCurrentBranch() (string, error)

	// HasChanges returns true if there are uncommitted changes
	HasChanges() (bool, error)
}

GitOperator defines the interface for Git operations

type Repository

type Repository struct {
	Group string
	Repo  string
}

Repository represents a Git repository with its group and name.

func ParseRepoURL

func ParseRepoURL(repoURL string) (*Repository, error)

ParseRepoURL extracts the repository name and owner from a Git repository URL. It supports various formats including: - https://github.com/example/toolbox.git => group: example, repo: toolbox - https://gitlab.com/group/repo.git => group: group, repo: repo - https://gitlab.example.com/group/subgroup/repo.git => group: group/subgroup, repo: repo

func (*Repository) String

func (r *Repository) String() string

String returns the repository in the format "group/repo".

func (*Repository) UrlEncode

func (r *Repository) UrlEncode() string

UrlEncode returns the repository string encoded for use in URLs.

Jump to

Keyboard shortcuts

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