gitdiff

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package gitdiff reads local working-tree changes from git for the `commd review --diff` flow. It shells out to the git binary; paths are always relative to the directory the Repo was opened in.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Repo

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

Repo runs git commands inside a working tree directory.

func Open

func Open(dir string) (*Repo, error)

Open verifies that dir is inside a git working tree.

func (*Repo) ChangedMarkdownFiles

func (r *Repo) ChangedMarkdownFiles(base string) ([]string, error)

ChangedMarkdownFiles lists .md files under the repo directory that differ from base in the working tree, plus untracked .md files. Deleted files are excluded. Paths are relative to the directory Open was called with.

func (*Repo) FilePatch

func (r *Repo) FilePatch(base, path string) (string, error)

FilePatch returns the unified diff of path against base, starting at the first hunk header so diff.ParsePatch can consume it. Untracked files yield an all-added patch. Returns "" when the file has no changes.

func (*Repo) VerifyRef

func (r *Repo) VerifyRef(base string) error

VerifyRef checks that base resolves to a commit.

Jump to

Keyboard shortcuts

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