gitinfo

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package gitinfo is the one place aimux asks git about a folder: its top-level and common dir, its origin and its branch. folders and gitremote both read through it, so a folder costs one `rev-parse` however many of them ask.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Branch

func Branch(ctx context.Context, dir string) (string, error)

Branch returns dir's current branch ("HEAD" when detached). A repository with no commit yet has no HEAD to resolve, so it falls back to the name the first commit will get.

func Origin

func Origin(ctx context.Context, dir string) (string, error)

Origin returns dir's "origin" remote URL with insteadOf rewrites applied.

func Top

func Top(ctx context.Context, dir string) (top, common string, err error)

Top returns the top-level and the common git dir of dir, both absolute. A success is remembered for a minute, so callers that ask about the same folder share one git call; failures are not remembered. gitremote caches its own result for a minute on top of this, so the root it reports can be up to ~120 s stale.

Types

This section is empty.

Jump to

Keyboard shortcuts

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