Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TempBranchTester ¶
type TempBranchTester struct {
// contains filtered or unexported fields
}
TempBranchTester provides reusable temp branch testing functionality
func NewTempBranchTester ¶
func NewTempBranchTester(repo *hitchgit.Repo) *TempBranchTester
NewTempBranchTester creates a new temp branch tester for safe merge testing. The tester performs all operations in temporary branches to ensure the original repository state is preserved. This is the core safety mechanism for all Hitch operations.
func (*TempBranchTester) TestMerge ¶
func (t *TempBranchTester) TestMerge(ctx context.Context, config TestConfig) TestResult
TestMerge performs the complete temp branch testing according to your safety pattern: 1. CRITICAL: Pre-flight validation before any operations 2. Takes note of pre-command branch 3. Makes a clone branch of the target with unique name 4. Tries merging source into cloned target 5. Checks if successful (no errors and hooks pass) 6. If failed: returns to pre-command branch, deletes cloned target 7. If successful: returns to pre-command branch, deletes cloned target SAFETY: Original repository is never modified during testing
type TestConfig ¶
type TestConfig struct {
// Source branch to merge (e.g., feature branch)
SourceBranch string
// Target branch to merge into (e.g., environment branch)
TargetBranch string
// Base branch for creating temp branch (usually same as target or target's base)
BaseBranch string
// Operation type for naming (e.g., "promote", "release", "rebuild")
Operation string
// Hook executor to run during testing (optional)
HookExecutor *hooks.HookExecutor
// Hook context to pass to hooks (optional)
HookContext hooks.HookContext
// Hook type to run during testing (e.g., hooks.PrePromote)
HookType hooks.HookType
// Additional context for error messages (e.g., environment name)
Context string
}
TestConfig contains configuration for temp branch testing
type TestResult ¶
TestResult contains the result of temp branch testing