cmd

package
v0.0.0-...-aa656b0 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

* Handles invoking Git as a subprocess.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LogFilters

type LogFilters struct {
	Since    string
	Until    string
	Authors  []string
	Nauthors []string
}

func (LogFilters) ToArgs

func (f LogFilters) ToArgs() []string

Turn into CLI args we can pass to `git log`

type Subprocess

type Subprocess struct {
	// contains filtered or unexported fields
}

func RunConfigGet

func RunConfigGet(ctx context.Context, args []string) (*Subprocess, error)

func RunLog

func RunLog(
	ctx context.Context,
	revs []string,
	pathspecs []string,
	filters LogFilters,
	needDiffs bool,
	useMailmap bool,
) (*Subprocess, error)

Runs git log

func RunLsFiles

func RunLsFiles(ctx context.Context, pathspecs []string) (*Subprocess, error)

func RunRevList

func RunRevList(
	ctx context.Context,
	revs []string,
	pathspecs []string,
	filters LogFilters,
) (*Subprocess, error)

Runs git rev-list. When countOnly is true, passes --count, which is much faster than printing then getting all the revisions when all you need is the count.

func RunRevParse

func RunRevParse(ctx context.Context, args []string) (*Subprocess, error)

Runs git rev-parse

func RunRevParseTopLevel

func RunRevParseTopLevel(ctx context.Context) (*Subprocess, error)

func RunStdinLog

func RunStdinLog(
	ctx context.Context,
	pathspecs []string,
	needDiffs bool,
	useMailmap bool,
) (*Subprocess, error)

Runs git log --stdin

func (Subprocess) StdinWriter

func (s Subprocess) StdinWriter() (_ *bufio.Writer, closer func() error)

func (Subprocess) StdoutLines

func (s Subprocess) StdoutLines() (iter.Seq[string], func() error)

Returns a single-use iterator over the output of the command, line by line.

func (Subprocess) StdoutNullDelimitedLines

func (s Subprocess) StdoutNullDelimitedLines() (
	iter.Seq[string],
	func() error,
)

Returns a single-use iterator over the output from git log.

Lines are split on NULLs with some additional processing.

func (Subprocess) StdoutText

func (s Subprocess) StdoutText() (string, error)

func (Subprocess) Wait

func (s Subprocess) Wait() error

type SubprocessErr

type SubprocessErr struct {
	ExitCode int
	Stderr   string
	Err      error
}

func (*SubprocessErr) Error

func (err *SubprocessErr) Error() string

func (*SubprocessErr) Unwrap

func (err *SubprocessErr) Unwrap() error

Jump to

Keyboard shortcuts

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