gitexec

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package gitexec runs the git CLI from inside the codebase. Callers that need plain stdout from `git <args>` (e.g. parsing `rev-parse HEAD` output) get a shared exec.Command + stderr-capture + error-wrap helper.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HeadSHA

func HeadSHA(ctx context.Context, repoRoot string) (string, error)

HeadSHA returns the current HEAD commit hash as a 40-char hex string.

func Run

func Run(ctx context.Context, repoRoot string, args ...string) (string, error)

Run runs `git <args>` in repoRoot and returns stdout as a string. stderr is captured separately and surfaced in the error wrap on non-zero exit. Stdout and stderr are NOT combined — git emits warnings on stderr even on successful commands (shallow-clone notices, safe.directory advisories, etc.) and merging them would corrupt parsed output (e.g., strconv.Atoi on the result of `rev-list --count` would fail).

Types

This section is empty.

Jump to

Keyboard shortcuts

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