gitutil

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package gitutil manages git worktree lifecycle for worker sessions.

It provides DumpWorkerState (captures recent commits and status to a debug file), IsWorktreeClean (detects uncommitted changes), and RemoveWorktree (deletes a worktree directory, prunes metadata, and removes the worker branch). Used by the worker close and spawn paths.

Plane: worker

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BranchName added in v1.4.0

func BranchName(dir string) string

BranchName returns the current git branch for dir. Returns "" if in detached HEAD state or on any error.

func DumpWorkerState

func DumpWorkerState(sessionName, workDir, workerName string) (string, error)

DumpWorkerState captures git state for debugging. Returns the path to the dump file.

func IsWorktreeClean

func IsWorktreeClean(workDir string) (bool, error)

IsWorktreeClean checks whether the worktree has uncommitted changes. Returns (true, nil) if clean, (false, nil) if dirty, or (false, err) if the git command itself failed (e.g. missing directory, timeout).

func RemoveWorktree

func RemoveWorktree(projectDir, workDir, branch string) error

RemoveWorktree removes a git worktree and its branch. Uses os.RemoveAll + git worktree prune instead of git worktree remove for faster cleanup without subprocess timeout risks.

Types

This section is empty.

Jump to

Keyboard shortcuts

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