gitx

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2026 License: Apache-2.0 Imports: 12 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 gitx starts the git commands Djinn runs, each with a deadline: a git that talks to a remote (over ssh, a stalled connection or a prompt nobody sees) or waits on a lock never holds Djinn for good (W504).

Index

Constants

This section is empty.

Variables

View Source
var (
	// Local is the longest a git command that stays in the repository may run: a merge or a checkout of a large one.
	Local = 10 * time.Minute
	// Network is the longest a git command that reaches a remote may run: fetch, push, ls-remote.
	Network = 5 * time.Minute
	// WaitDelay is how long a git stopped at its deadline or at its context's end has to end on SIGTERM, and then, once
	// killed, may keep its output open: an ssh it started may hold it.
	WaitDelay = 5 * time.Second
	// Finish is how long a git that changes a repository may run on once Djinn stops (Uncut), so that the stop leaves no
	// half a move; with WaitDelay, it stays well within the 30 s djinn up gives itself to stop.
	Finish = 15 * time.Second
)

Functions

func Command

func Command(ctx context.Context, dir string, args ...string) (cmd *exec.Cmd, cancel context.CancelFunc)

Command is git with args, run in dir, never prompting for credentials, stopped at the earlier of ctx's end and its own deadline: Network for a command that reaches a remote, Local otherwise. Stopped, git gets SIGTERM, which lets it take its locks away (index.lock), and SIGKILL only WaitDelay later: killed first, it left them, and every later git in that worktree failed (W52). Call cancel once it has run: it logs it.

func FetchBranch added in v0.1.2

func FetchBranch(ctx context.Context, dir, remote, branch string) (string, error)

FetchBranch fetches branch from remote into its remote-tracking ref, refs/remotes/<remote>/<branch>, with the person's own credentials: what the remote holds of it now. It returns that commit; "" when the remote has no such branch, its remote-tracking ref then left as it was; an error when the remote did not answer.

func OnCut added in v0.2.0

func OnCut(ctx context.Context, cut func(what, dir string)) context.Context

OnCut returns ctx telling cut of each git a cancel of ctx stops before it ends: what it ran, "git reset", and the folder it ran in. A git that meets its deadline is not told.

func Uncut added in v0.2.0

func Uncut(ctx context.Context) (kept context.Context, done context.CancelFunc)

Uncut is ctx without its cancel, for a git that changes a repository, or steps that must not stop half way (a merge and its abort, a branch moved and the checkout that follows it, or put back): a stop lets them end, for Finish at most past ctx's end, after which git is stopped as at a cancel, for ctx's cause. A deadline of ctx still holds, and so do its values. Call done once they ran.

Types

This section is empty.

Jump to

Keyboard shortcuts

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