diffstat

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2026 License: MIT Imports: 5 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 diffstat computes added/deleted line counts for a git range via `git diff --numstat`. Used to attribute code volume to a task's branch.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsRepoRoot

func IsRepoRoot(repoDir string) bool

IsRepoRoot reports whether repoDir is the ROOT of its own git repo (not a subdirectory of an enclosing one). A project living inside a monorepo (e.g. a hand-authored seed under dev/) would otherwise diff the OUTER repo's branches and show bogus code volume — this gates that out.

Types

type Stat

type Stat struct {
	Added   int
	Deleted int
	Files   int
}

Stat is the line delta for a git range.

func NumStat

func NumStat(repoDir, from, to string, pathspec ...string) (Stat, error)

NumStat returns the added/deleted/files for `git diff --numstat from..to` in repoDir. Binary files (numstat "-") count toward Files but contribute 0 lines. Optional pathspecs are passed after `--` (e.g. ":(exclude).pact" to drop protocol bookkeeping).

Jump to

Keyboard shortcuts

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