local

package
v0.0.0-...-e389aed Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2025 License: BSD-3-Clause Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidSpec        = errors.New("invalid spec")
	ErrNoBranchSpec       = errors.New("empty branch spec")
	ErrInvalidBranchName  = errors.New("invalid branch spec")
	ErrEmptySourceSpec    = errors.New("empty source spec")
	ErrEmptyTargetSpec    = errors.New("empty target spec")
	ErrSourceEqualsTarget = errors.New("source and target files are the same")
)

Functions

func ParseCopySpec

func ParseCopySpec(spec, separator string) (branch, source, target string, err error)

ParseCopySpec parses a file specification into remote source andtarget file paths. The separator is used to split the source and target file paths. All file paths are cleaned before being returned.

func ParseUpdateSpec

func ParseUpdateSpec(spec, separator string) (source, target string, err error)

ParseUpdateSpec parses a file specification into source and target file paths. The separator is used to split the source and target file paths, if present. All file paths are cleaned before being returned.

Types

type DeletionSet

type DeletionSet map[string]struct{}

func (DeletionSet) Keys

func (d DeletionSet) Keys() []string

type PathContent

type PathContent map[string][]byte

func (PathContent) Keys

func (p PathContent) Keys() []string

type Repository

type Repository struct {
	Repository *git.Repository `json:"-"`
	Owner      string          `json:"owner"`
	Name       string          `json:"name"`
	Path       string          `json:"path" default:"."`
	Branch     string          `json:"branch" default:"main"`
	User       struct {
		Name  string `json:"name"`
		Email string `json:"email"`
	} `json:"user"`
}

func (*Repository) HeadCommit

func (r *Repository) HeadCommit() (hash string)

func (*Repository) SetDefaults

func (r *Repository) SetDefaults()

SetDefaults implements defaults.Setter interface

func (*Repository) Staged

func (r *Repository) Staged(gitStatus git.Status) (
	pathContent PathContent,
	deletionSet DeletionSet,
	err error,
)

Staged returns all changes to staged files in the repository. If the file is added or modified, the contents are read from the git index.

func (*Repository) Status

func (r *Repository) Status() (status git.Status, err error)

func (*Repository) Tracked

func (r *Repository) Tracked(gitStatus git.Status) (
	pathContent PathContent,
	deletionSet DeletionSet,
	err error,
)

Tracked returns all changes to tracked files in the repository. If the file is added or modified, the contents are read from the filesystem.

Jump to

Keyboard shortcuts

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