packaging

package
v2.8.1-rc.2 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateTarball

func CreateTarball(records []CommitRecord, meta ArchiveMetadata) (string, error)

CreateTarball writes a tar.gz to a temp file containing:

  • <dir>/commit-metadata.jsonl (one JSON object per line)
  • <dir>/metadata.json (archive metadata)

Files are nested inside a directory named backfill-<org>-<suite>-<timestamp> to follow tar best practices (no top-level files).

Returns the path to the temp file. Caller is responsible for cleanup. The temp file is renamed to include a timestamp on success for easier identification if cleanup is skipped.

func FindTarEntry

func FindTarEntry(t *testing.T, files map[string]string, suffix string) string

FindTarEntry returns the content of the first entry whose name ends with the given suffix. Fails the test if no match is found.

func HasTarEntry

func HasTarEntry(files map[string]string, suffix string) bool

HasTarEntry returns true if any entry name ends with the given suffix.

func ReadTarball

func ReadTarball(t *testing.T, path string) map[string]string

ReadTarball opens a tar.gz file and returns a map of entry name to content. Intended for use in tests across packages.

Types

type ArchiveMetadata

type ArchiveMetadata struct {
	SchemaVersion    int    `json:"schema_version"`
	Tool             string `json:"tool"`
	ToolVersion      string `json:"tool_version"`
	GeneratedAt      string `json:"generated_at"`
	OrganizationSlug string `json:"organization_slug"`
	SuiteSlug        string `json:"suite_slug"`
	CommitCount      int    `json:"commit_count"`
	SkippedCommits   int    `json:"skipped_commits"`
	// Config options used for this export
	Days         int    `json:"days"`
	Remote       string `json:"remote"`
	SkippedDiffs bool   `json:"skipped_diffs"`
	// Date range of commits in the archive (ISO 8601, from CommitterDate)
	MinCommitDate string `json:"min_commit_date,omitempty"`
	MaxCommitDate string `json:"max_commit_date,omitempty"`
}

ArchiveMetadata is the metadata written to metadata.json in the tarball.

type CommitRecord

type CommitRecord struct {
	SchemaVersion  int      `json:"schema_version"`
	CommitSHA      string   `json:"commit_sha"`
	ParentSHAs     []string `json:"parent_shas"`
	AuthorName     string   `json:"author_name"`
	AuthorEmail    string   `json:"author_email"`
	AuthorDate     string   `json:"author_date"`
	CommitterName  string   `json:"committer_name"`
	CommitterEmail string   `json:"committer_email"`
	CommitterDate  string   `json:"committer_date"`
	Message        string   `json:"message"`
	FilesChanged   string   `json:"files_changed"`
	DiffStat       string   `json:"diff_stat"`
	GitDiff        string   `json:"git_diff,omitempty"`
	GitDiffRaw     string   `json:"git_diff_raw,omitempty"`
}

CommitRecord is the per-commit record written to the JSONL file.

Jump to

Keyboard shortcuts

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