gitclient

package
v0.9.8 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package git provides Git integration for detecting changed files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChangedModulesDetector

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

ChangedModulesDetector detects which modules have changed.

func NewChangedModulesDetector

func NewChangedModulesDetector(gitClient *Client, index *discovery.ModuleIndex, rootDir string) *ChangedModulesDetector

NewChangedModulesDetector creates a new detector.

func (*ChangedModulesDetector) DetectChangedLibraryModules

func (d *ChangedModulesDetector) DetectChangedLibraryModules(baseRef string, libraryPaths []string) ([]string, error)

DetectChangedLibraryModules returns library module paths that have changed files.

func (*ChangedModulesDetector) DetectChangedModules

func (d *ChangedModulesDetector) DetectChangedModules(baseRef string) ([]*discovery.Module, error)

DetectChangedModules returns modules affected by changed files.

func (*ChangedModulesDetector) DetectChangedModulesVerbose

func (d *ChangedModulesDetector) DetectChangedModulesVerbose(baseRef string) ([]*discovery.Module, []string, error)

DetectChangedModulesVerbose returns modules and the raw changed file list.

func (*ChangedModulesDetector) DetectUncommittedModules

func (d *ChangedModulesDetector) DetectUncommittedModules() ([]*discovery.Module, error)

DetectUncommittedModules returns modules with uncommitted changes.

func (*ChangedModulesDetector) GetChangedModuleIDs

func (d *ChangedModulesDetector) GetChangedModuleIDs(baseRef string) ([]string, error)

GetChangedModuleIDs returns IDs of changed modules.

type Client

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

Client provides Git operations using go-git.

func NewClient

func NewClient(workDir string) *Client

NewClient creates a new Git client.

func (*Client) Fetch

func (c *Client) Fetch() error

Fetch fetches all refs from the origin remote.

func (*Client) GetChangedFiles

func (c *Client) GetChangedFiles(baseRef string) ([]string, error)

GetChangedFiles returns files changed between base ref and HEAD.

func (*Client) GetChangedFilesFromCommit

func (c *Client) GetChangedFilesFromCommit(commitHash string) ([]string, error)

GetChangedFilesFromCommit returns files changed in a specific commit.

func (*Client) GetDefaultBranch

func (c *Client) GetDefaultBranch() string

GetDefaultBranch attempts to determine the default branch.

func (*Client) GetUncommittedChanges

func (c *Client) GetUncommittedChanges() ([]string, error)

GetUncommittedChanges returns uncommitted changed files.

func (*Client) IsGitRepo

func (c *Client) IsGitRepo() bool

IsGitRepo checks if the directory is a git repository.

Jump to

Keyboard shortcuts

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