git

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Name    = "git"
	Type    = "https://witness.dev/attestations/git/v0.1"
	RunType = attestation.PreMaterialRunType
)

Variables

This section is empty.

Functions

func GitExists added in v0.7.0

func GitExists() bool

GitExists checks if the git binary is available. This can be used to fall back to go-git implementation.

func GitGetBinHash added in v0.7.0

GitGetBinHash retrieves a sha256 hash of the git binary that is located on the system. The path is determined based on exec.LookPath().

func GitGetBinPath added in v0.7.0

func GitGetBinPath() (string, error)

GitGetBinPath retrieves the path to the git binary that is used by the attestor.

func GitGetStatus added in v0.7.0

func GitGetStatus(workDir string) (map[string]Status, error)

GitGetStatus retrieves the status of staging and worktree from the git status --porcelain output

func GoGitGetStatus added in v0.7.0

func GoGitGetStatus(repo *git.Repository) (map[string]Status, error)

Types

type Attestor

type Attestor struct {
	GitTool        string               `json:"gittool"`
	GitBinPath     string               `json:"gitbinpath,omitempty"`
	GitBinHash     cryptoutil.DigestSet `json:"gitbinhash,omitempty"`
	CommitHash     string               `json:"commithash"`
	Author         string               `json:"author"`
	AuthorEmail    string               `json:"authoremail"`
	CommitterName  string               `json:"committername"`
	CommitterEmail string               `json:"committeremail"`
	CommitDate     string               `json:"commitdate"`
	CommitMessage  string               `json:"commitmessage"`
	Status         map[string]Status    `json:"status,omitempty"`
	CommitDigest   cryptoutil.DigestSet `json:"commitdigest,omitempty"`
	Signature      string               `json:"signature,omitempty"`
	ParentHashes   []string             `json:"parenthashes,omitempty"`
	TreeHash       string               `json:"treehash,omitempty"`
	Refs           []string             `json:"refs,omitempty"`
	Remotes        []string             `json:"remotes,omitempty"`
	Tags           []Tag                `json:"tags,omitempty"`
	RefNameShort   string               `json:"branch,omitempty"`
}

func New

func New() *Attestor

func (*Attestor) Attest

func (a *Attestor) Attest(ctx *attestation.AttestationContext) error

func (*Attestor) BackRefs

func (a *Attestor) BackRefs() map[string]cryptoutil.DigestSet

func (*Attestor) Data added in v0.4.0

func (a *Attestor) Data() *Attestor

func (*Attestor) Name

func (a *Attestor) Name() string

func (*Attestor) RunType

func (a *Attestor) RunType() attestation.RunType

func (*Attestor) Schema added in v0.4.0

func (a *Attestor) Schema() *jsonschema.Schema

func (*Attestor) Subjects

func (a *Attestor) Subjects() map[string]cryptoutil.DigestSet

func (*Attestor) Type

func (a *Attestor) Type() string

type GitAttestor added in v0.4.0

type GitAttestor interface {
	// Attestor
	Name() string
	Type() string
	RunType() attestation.RunType
	Attest(ctx *attestation.AttestationContext) error
	Data() *Attestor

	// Subjecter
	Subjects() map[string]cryptoutil.DigestSet

	// Backreffer
	BackRefs() map[string]cryptoutil.DigestSet
}

type Status

type Status struct {
	Staging  string `json:"staging,omitempty"`
	Worktree string `json:"worktree,omitempty"`
}

type Tag

type Tag struct {
	Name         string `json:"name"`
	TaggerName   string `json:"taggername"`
	TaggerEmail  string `json:"taggeremail"`
	When         string `json:"when"`
	PGPSignature string `json:"pgpsignature"`
	Message      string `json:"message"`
}

Jump to

Keyboard shortcuts

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