Documentation
¶
Overview ¶
Package gitcrypt provides git-crypt functionality as a hook for worktree operations.
Package gitcrypt provides git-crypt functionality as a hook for worktree operations.
Package gitcrypt provides git-crypt functionality as a hook for worktree operations.
Package gitcrypt provides git-crypt functionality as a hook for worktree operations.
Package gitcrypt provides git-crypt functionality as a hook for worktree operations.
Index ¶
- Variables
- type Detector
- type KeyManager
- type WorktreeCheckoutHook
- func (h *WorktreeCheckoutHook) Execute(_ *hooks.HookContext) error
- func (h *WorktreeCheckoutHook) Name() string
- func (h *WorktreeCheckoutHook) OnWorktreeCheckout(ctx *hooks.HookContext) error
- func (h *WorktreeCheckoutHook) Priority() int
- func (h *WorktreeCheckoutHook) RegisterForOperations(registerHook func(operation string, hook hooks.WorktreeCheckoutHook) error) error
- type WorktreeSetup
Constants ¶
This section is empty.
Variables ¶
var ( // ErrKeyFileNotFound indicates that the git-crypt key file was not found. ErrKeyFileNotFound = errors.New("git-crypt key file not found") // ErrKeyFileInvalid indicates that the git-crypt key file is invalid or corrupted. ErrKeyFileInvalid = errors.New("git-crypt key file is invalid or corrupted") // ErrRepositoryPathNotFound indicates that the repository path was not found in the hook context. ErrRepositoryPathNotFound = errors.New("repository path not found in hook context") // ErrWorktreePathNotFound indicates that the worktree path was not found in the hook context. ErrWorktreePathNotFound = errors.New("worktree path not found in hook context") // ErrBranchNotFound indicates that the branch was not found in the hook context. ErrBranchNotFound = errors.New("branch not found in hook context") )
Git-crypt specific errors.
Functions ¶
This section is empty.
Types ¶
type Detector ¶
type Detector struct {
// contains filtered or unexported fields
}
Detector handles detection of git-crypt usage in repositories.
func NewDetector ¶
NewDetector creates a new GitCryptDetector instance.
type KeyManager ¶
type KeyManager struct {
// contains filtered or unexported fields
}
KeyManager handles git-crypt key location and validation.
func NewKeyManager ¶
NewKeyManager creates a new GitCryptKeyManager instance.
func (*KeyManager) FindGitCryptKey ¶
func (k *KeyManager) FindGitCryptKey(repoPath string) (string, error)
FindGitCryptKey looks for git-crypt key in the repository.
func (*KeyManager) PromptUserForKeyPath ¶
func (k *KeyManager) PromptUserForKeyPath() (string, error)
PromptUserForKeyPath prompts the user for the git-crypt key file path.
func (*KeyManager) ValidateKeyFile ¶
func (k *KeyManager) ValidateKeyFile(keyPath string) error
ValidateKeyFile validates that the provided key file exists and is readable.
type WorktreeCheckoutHook ¶
type WorktreeCheckoutHook struct {
// contains filtered or unexported fields
}
WorktreeCheckoutHook provides git-crypt functionality as a worktree checkout hook.
func NewWorktreeCheckoutHook ¶
func NewWorktreeCheckoutHook() *WorktreeCheckoutHook
NewWorktreeCheckoutHook creates a new GitCryptWorktreeCheckoutHook instance.
func (*WorktreeCheckoutHook) Execute ¶
func (h *WorktreeCheckoutHook) Execute(_ *hooks.HookContext) error
Execute is a no-op for GitCryptWorktreeCheckoutHook.
func (*WorktreeCheckoutHook) Name ¶
func (h *WorktreeCheckoutHook) Name() string
Name returns the hook name.
func (*WorktreeCheckoutHook) OnWorktreeCheckout ¶
func (h *WorktreeCheckoutHook) OnWorktreeCheckout(ctx *hooks.HookContext) error
OnWorktreeCheckout handles git-crypt setup before worktree checkout.
func (*WorktreeCheckoutHook) Priority ¶
func (h *WorktreeCheckoutHook) Priority() int
Priority returns the hook priority.
func (*WorktreeCheckoutHook) RegisterForOperations ¶
func (h *WorktreeCheckoutHook) RegisterForOperations( registerHook func(operation string, hook hooks.WorktreeCheckoutHook) error, ) error
RegisterForOperations registers this hook for worktree operations.
type WorktreeSetup ¶
type WorktreeSetup struct {
// contains filtered or unexported fields
}
WorktreeSetup handles git-crypt setup in worktree directories.
func NewWorktreeSetup ¶
func NewWorktreeSetup(fs fs.FS) *WorktreeSetup
NewWorktreeSetup creates a new GitCryptWorktreeSetup instance.
func (*WorktreeSetup) SetupGitCryptForWorktree ¶
func (s *WorktreeSetup) SetupGitCryptForWorktree(repoPath, worktreePath, keyPath string) error
SetupGitCryptForWorktree sets up git-crypt in the worktree by copying the key.