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

selfcommit

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2026 License: MPL-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package selfcommit is the single reusable self-commit step for auto-commit scopes. Mechanism only: auto-commit policy, git-root existence, and sync_disabled emission belong to the caller. Commit assumes a git-root and available git; it takes the commit lock, stages matchable paths, and commits.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Commit

func Commit(ctx context.Context, req Request) error

Commit acquires the git-root commit lock and delegates to CommitCore. Callers that already hold the lock must call CommitCore: re-acquiring the same flock in-process blocks forever.

func CommitCore

func CommitCore(ctx context.Context, req Request) error

CommitCore stages matchable paths and commits under the fixed message — no push. Caller must hold the git-root commit lock. Byte-identical rewrite is a clean no-op.

func CommitPaths

func CommitPaths(ctx context.Context, req BatchRequest) error

CommitPaths acquires the git-root commit lock and delegates to CommitPathsCore. Callers that already hold the lock must call CommitPathsCore.

func CommitPathsCore

func CommitPathsCore(ctx context.Context, req BatchRequest) error

CommitPathsCore stages every matchable path and commits — no push. Caller must hold the git-root commit lock.

Types

type BatchRequest

type BatchRequest struct {
	StateDir string
	GitRoot  string
	Message  string
	// Paths are every touched path — new and removed. Each is staged only when matchable.
	Paths []string
}

BatchRequest is a multi-file self-commit: fixed message and every touched path.

type Request

type Request struct {
	StateDir string
	GitRoot  string
	Message  string
	// NewPath is the post-write path; always staged.
	NewPath string
	// OldPath is a path the mutation removed (empty for in-place rewrite).
	// Staged only when matchable so a never-committed old path is omitted.
	OldPath string
}

Request is one self-commit: fixed message, post-write path, and optional old path.

Jump to

Keyboard shortcuts

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