git

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Copyright (c) 2025 Guilherme Silva Sousa Licensed under the MIT License See LICENSE file in the project root for full license information.

Copyright (c) 2025 Guilherme Silva Sousa Licensed under the MIT License See LICENSE file in the project root for full license information. Package git provides a client for Git operations.

This package wraps common Git commands needed for ccmd operations, including cloning repositories, checking out tags, and querying repository information.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseRepositoryURL

func ParseRepositoryURL(url string) (string, error)

ParseRepositoryURL parses a repository URL and extracts repo name

Types

type Client

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

Client provides git operations

func NewClient

func NewClient(workDir string) *Client

NewClient creates a new git client

func (*Client) CheckoutTag

func (c *Client) CheckoutTag(repoPath, tag string) error

CheckoutTag checks out a specific tag in the repository

func (*Client) Clone

func (c *Client) Clone(opts CloneOptions) error

Clone clones a repository with the given options

func (*Client) GetCurrentCommit

func (c *Client) GetCurrentCommit(repoPath string) (string, error)

GetCurrentCommit returns the current commit hash

func (*Client) GetLatestTag

func (c *Client) GetLatestTag(repoPath string) (string, error)

GetLatestTag returns the latest tag in the repository

func (*Client) GetTags

func (c *Client) GetTags(repoPath string) ([]string, error)

GetTags returns all tags in the repository

func (*Client) IsGitRepository

func (c *Client) IsGitRepository(path string) bool

IsGitRepository checks if a directory is a git repository

func (*Client) ValidateRemoteRepository

func (c *Client) ValidateRemoteRepository(url string) error

ValidateRemoteRepository checks if a remote repository exists

type CloneOptions

type CloneOptions struct {
	URL     string
	Target  string
	Branch  string
	Tag     string
	Shallow bool
	Depth   int
}

CloneOptions represents options for cloning a repository

Jump to

Keyboard shortcuts

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