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 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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