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 ¶
- func GetCommitIO(repo *git.Repository, hash string) (inputs []*object.File, outputs []*object.File, err error)
- func MakeArtifactID(repoURL string, commitHash, filePath string) string
- func MakeCommitArtifactID(repoURL string, commitHash string) string
- func MakeStepID(repoURL string, commitHash string) string
- type GitParser
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 ¶
MakeArtifactID returns a namespaced AStRA artifact ID for a file at a specific commit in the given repository.
func MakeCommitArtifactID ¶
MakeCommitArtifactID returns namespaced AStRA artifact ID for a Git commit. Commit artifact ID format: artifact:gitcommit:<host>/<owner>/<repo>@<commit-hash>
func MakeStepID ¶
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 ¶
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.