gitutils

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: May 23, 2023 License: BSD-3-Clause Imports: 14 Imported by: 9

Documentation

Index

Constants

View Source
const (
	GIT_SERVICE_CONFIG_FILE = "GitServiceConfig.yaml"
)

Variables

View Source
var (
	CHECKMATE_USER = "checkmate"
)

Functions

func GetCheckoutLocation

func GetCheckoutLocation(repository, baseDirectory string) (string, error)

returns the checkout location on disk for the specified git repository, given a base directory The pattern for base directory is baseDirectory := path.Join(pm.GetCodeBaseDir(), projectID)

func GitToHTTPS added in v0.8.6

func GitToHTTPS(repository string) string

replaces git@ with https:// in repository URL

Types

type Author

type Author struct {
	Name, Email string
}

type CloneDetail added in v0.8.8

type CloneDetail struct {
	Repository, Location string
	Branch               *string
}

func Clone

func Clone(ctx context.Context, repository string, options *GitCloneOptions) (CloneDetail, error)

Clone a repository,returning the location on disk where the clone is placed

type Commit

type Commit struct {
	Author
	Hash, Branch string
	//Commit time
	Time time.Time
	//is the default branch to scan?
	IsHead bool
}

type GitAuth

type GitAuth struct {
	User, Credential string
}

Authentication parameters

type GitCloneOptions

type GitCloneOptions struct {
	// Directory to clone into
	BaseDir string
	// Authentication detail
	Auth *GitAuth
	// Depth limit cloning/fetching to the specified number of commits from the tip of
	// each remote branch history.
	Depth int
	// If set, checkout the specified commit
	CommitHash string
}

type GitConfigManager

type GitConfigManager interface {
	GetConfig() (*GitServiceConfig, error)
	SaveConfig(*GitServiceConfig) error
}

func NewGitConfigManager

func NewGitConfigManager(baseDirectory string) GitConfigManager

Git Service Config Manager

type GitService

type GitService struct {
	InstanceURL     string
	GraphQLEndPoint string
	APIEndPoint     string
	API_Key         string
	ID              string         //some unique ID for this service instance
	Name            string         //user-friendly name
	AccountName     string         //used to track Github user/org name
	AccountType     string         //(GitHub) User or Organization
	Type            GitServiceType `json:"_"`
}

func (GitService) MakeAuth

func (svc GitService) MakeAuth() *GitAuth

type GitServiceConfig

type GitServiceConfig struct {
	GitServices map[GitServiceType]map[string]*GitService
	// contains filtered or unexported fields
}

func (*GitServiceConfig) AddService

func (gsc *GitServiceConfig) AddService(service *GitService) error

func (GitServiceConfig) FindService

func (gsc GitServiceConfig) FindService(serviceID string) (*GitService, error)

func (GitServiceConfig) GetConfigManager added in v0.8.9

func (gsc GitServiceConfig) GetConfigManager() GitConfigManager

func (GitServiceConfig) GetService

func (gsc GitServiceConfig) GetService(serviceType GitServiceType, serviceID string) (*GitService, error)

func (GitServiceConfig) IsServiceConfigured

func (gsc GitServiceConfig) IsServiceConfigured(service GitServiceType) bool

func (*GitServiceConfig) SetConfigManager added in v0.8.9

func (gsc *GitServiceConfig) SetConfigManager(manager GitConfigManager)

type GitServiceType

type GitServiceType int
const (
	GitHub GitServiceType = iota
	GitLab
)

type RepositoryCloneSpec

type RepositoryCloneSpec struct {
	Repository string
	ServiceID  string // the Github or Gitlab service ID
	Options    GitCloneOptions
}

Jump to

Keyboard shortcuts

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