Help us shape the future of Go! Take the 2026 Go Developer Survey

gitcommit

package
v0.0.68 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetPersistOp

func GetPersistOp() ops.RegisterableOp

func GetRestoreOp

func GetRestoreOp() ops.RegisterableOp

Types

type GenerateDiffInput

type GenerateDiffInput struct {
	RepoPath        string // Path to the repository
	FromHash        string // Source commit hash
	ToHash          string // Target commit hash (usually HEAD)
	StorageLocation string // Directory where diff will be saved
	ContextLines    int    // Number of context lines (before/after)
}

GenerateDiffInput defines parameters for generating git diffs

type GenerateDiffOutput

type GenerateDiffOutput struct {
	DiffPath string // Path to generated diff file
	DiffSize int64  // Size of diff file in bytes
}

GenerateDiffOutput represents the result of diff generation

func GenerateDiff

func GenerateDiff(ctx context.Context, input GenerateDiffInput) (*GenerateDiffOutput, error)

GenerateDiff creates a diff between two commits with the specified context

type PersistCommitActivity

type PersistCommitActivity struct {
	// Required inputs
	RepoPath        string `json:"repo_path"`        // Path to the local Git repository
	StorageLocation string `json:"storage_location"` // Directory path where thin packs will be stored
	RootHash        string `json:"root_hash"`        // Base commit hash this set was built upon

	// Optional configuration
	ExpectedHeadHash string        `json:"expected_head_hash,omitempty"` // HEAD hash expected before persistence starts; used to detect history-only changes
	CommitMessage    string        `json:"commit_message,omitempty"`     // Message for the commit
	Author           string        `json:"author,omitempty"`             // Author name and email
	Timeout          time.Duration `json:"timeout,omitempty"`            // Operation timeout
}

PersistCommitActivity defines the recipe operation for persisting Git commits

type PersistCommitActivityWrapper

type PersistCommitActivityWrapper struct{}

PersistCommitActivityWrapper implements the RegisterableOp interface

func (*PersistCommitActivityWrapper) Execute

Execute runs the activity with provided configuration and inputs

func (*PersistCommitActivityWrapper) GetMetadata

func (a *PersistCommitActivityWrapper) GetMetadata() ops.OpMetadata

GetMetadata returns activity metadata for registration

type PersistCommitInput

type PersistCommitInput struct {
	RepoPath        string        `json:"repo_path" default:"{{ context.environment.worktree_path }}" validate:"required,dir"`              // Required: path to the local Git repository
	StorageLocation string        `json:"storage_location" validate:"required"`                                                             // Required: directory path where thin packs will be stored
	RootHash        string        `json:"root_hash" default:"{{ context.git.resolved_hash }}" validate:"required,hexadecimal,min=7,max=40"` // Required: base commit hash this set was built upon
	CommitMessage   string        `json:"commit_message,omitempty"`                                                                         // Optional: message for the commit
	Author          string        `json:"author,omitempty" default:"{{ context.git.author }}"`                                              // Optional: author name and email
	Timeout         time.Duration `json:"timeout,omitempty"`                                                                                // Optional: operation timeout
}

PersistCommitInput defines the input for persist commit activities - ALL fields MUST have json tags

type PersistCommitOutput

type PersistCommitOutput struct {
	CommitHash   string    `json:"commit_hash"`    // SHA-1 hash of the persisted HEAD commit
	ParentHash   string    `json:"parent_hash"`    // SHA-1 hash of the persisted commit's parent
	ThinPackPath string    `json:"thin_pack_path"` // Full path to generated thin pack
	ThinPackSize int64     `json:"thin_pack_size"` // Size of thin pack in bytes
	CreatedAt    time.Time `json:"created_at"`     // Timestamp of operation
	HasChanges   bool      `json:"has_changes"`    // True when repository history advanced or new worktree changes were committed
}

PersistCommitOutput represents the output from persist operation

func PersistCommit

func PersistCommit(ctx context.Context, input PersistCommitActivity) (*PersistCommitOutput, error)

PersistCommit performs the Git commit and thin pack generation

type PersistWithDiffsOutput

type PersistWithDiffsOutput struct {
	PersistCommitOutput        // Embedded commit and thin pack info
	DiffFromParentPath  string `json:"diff_from_parent_path"` // Path to diff from parent commit
	DiffFromParentSize  int64  `json:"diff_from_parent_size"` // Size of parent diff in bytes
	DiffFromBasePath    string `json:"diff_from_base_path"`   // Path to diff from base commit
	DiffFromBaseSize    int64  `json:"diff_from_base_size"`   // Size of base diff in bytes
}

PersistWithDiffsOutput extends PersistCommitOutput with diff artifacts

func PersistCommitWithDiffs

func PersistCommitWithDiffs(ctx context.Context, input PersistCommitActivity, baseHash string) (*PersistWithDiffsOutput, error)

PersistCommitWithDiffs performs commit, thin pack generation, and creates diffs from parent and base

type RestoreCommitActivity

type RestoreCommitActivity struct {
	// Required inputs
	RepoPath        string `json:"repo_path"`        // Path to the local Git repository
	TargetCommit    string `json:"target_commit"`    // Commit hash to restore to
	RootHash        string `json:"root_hash"`        // Root commit hash for this set
	StorageLocation string `json:"storage_location"` // Directory containing thin packs

	// Optional configuration
	Force   bool          `json:"force,omitempty"`   // Force checkout even with uncommitted changes
	Timeout time.Duration `json:"timeout,omitempty"` // Operation timeout
}

RestoreCommitActivity defines the recipe operation for restoring Git commits

type RestoreCommitActivityWrapper

type RestoreCommitActivityWrapper struct{}

RestoreCommitActivityWrapper implements the RegisterableOp interface

func NewRestoreCommitActivity

func NewRestoreCommitActivity() *RestoreCommitActivityWrapper

NewRestoreCommitActivity creates a new restore commit activity that implements RegisterableOp

func (*RestoreCommitActivityWrapper) Execute

Execute runs the activity with provided configuration and inputs

func (*RestoreCommitActivityWrapper) GetMetadata

func (a *RestoreCommitActivityWrapper) GetMetadata() ops.OpMetadata

GetMetadata returns activity metadata for registration

type RestoreCommitInput

type RestoreCommitInput struct {
	RepoPath        string        `json:"repo_path" default:"{{ context.environment.worktree_path }}" validate:"required,dir"`              // Required: path to the local Git repository
	TargetCommit    string        `json:"target_commit" validate:"required,hexadecimal,min=7,max=40"`                                       // Required: commit hash to restore to
	RootHash        string        `json:"root_hash" default:"{{ context.git.resolved_hash }}" validate:"required,hexadecimal,min=7,max=40"` // Required: root commit hash for this set
	StorageLocation string        `json:"storage_location" validate:"required"`                                                             // Required: directory containing thin packs
	Force           bool          `json:"force,omitempty"`                                                                                  // Optional: force checkout even with uncommitted changes
	Timeout         time.Duration `json:"timeout,omitempty"`                                                                                // Optional: operation timeout
}

RestoreCommitInput defines the input for restore commit activities - ALL fields MUST have json tags

type RestoreCommitOutput

type RestoreCommitOutput struct {
	Success          bool      `json:"success"`                      // Whether restore succeeded
	CurrentCommit    string    `json:"current_commit"`               // Current commit hash after restore
	RestoredFrom     string    `json:"restored_from"`                // Source of restore: "repository" or "thin_packs"
	ThinPacksApplied []string  `json:"thin_packs_applied,omitempty"` // List of applied thin packs
	RestoredAt       time.Time `json:"restored_at"`                  // Timestamp of operation
}

RestoreCommitOutput represents the output from restore operation

func RestoreCommit

func RestoreCommit(ctx context.Context, input RestoreCommitActivity) (*RestoreCommitOutput, error)

RestoreCommit restores repository to a specific commit state

Jump to

Keyboard shortcuts

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