git

package
v0.0.0-...-a8401ac Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package git implements the GitParser for AStRA.

GitParser parses Git repositories and maps commits and files into AStRA’s DAG-based artifact graph.

For each commit: - The commit is represented as a step. - Authors are represented as principals. - The Git is treated as a resource. - Files are tracked as input/output artifacts. - Parent commits are mapped as input artifacts. - The commit itself and changed files are mapped as output artifacts.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCommitIO

func GetCommitIO(repo *git.Repository, hash string) (inputs []*object.File, outputs []*object.File, err error)

GetCommitIO computes the input and output files for a commit in a Git repository. - Inputs: files from parent commits that are modified or deleted. - Outputs: files added or modified in this commit. - Returns slices of *object.File for inputs and outputs.

func MakeArtifactID

func MakeArtifactID(repoURL string, commitHash, filePath string) string

MakeArtifactID returns a namespaced AStRA artifact ID for a file at a specific commit in the given repository.

func MakeCommitArtifactID

func MakeCommitArtifactID(repoURL string, commitHash string) string

MakeCommitArtifactID returns namespaced AStRA artifact ID for a Git commit. Commit artifact ID format: artifact:gitcommit:<host>/<owner>/<repo>@<commit-hash>

func MakeStepID

func MakeStepID(repoURL string, commitHash string) string

MakeStepID returns namespaced AStRA Step ID for a Git commit. Step ID format: step:commit:<host>/<owner>/<repo>@<commit-hash>

Types

type GitParser

type GitParser struct{}

GitParser implements parser.Parser for Git repositories.

func (*GitParser) Parse

func (p *GitParser) Parse(r io.Reader) (parser.Mapped, error)

Parse clones the Git repository from the given URL into memory, extracts commits, and maps them into a parser.Mapped structure for AStRA.

Each commit is represented as a step, authors as principals, Git as a resource, parent commits as input artifacts, and the commit itself plus changed files as output artifacts.

Jump to

Keyboard shortcuts

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