gitdiff

package
v2.40.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package gitdiff resolves the merge-base commit between HEAD and a base ref using go-git, then reads file content from that commit's tree. It has no GraphQL-specific knowledge; the graphql lint --diff subcommand combines its output with the working tree's own content to compute the violations that are new.

Index

Constants

This section is empty.

Variables

View Source
var ErrShallowClone = errors.New("shallow clone: deepen it (e.g. `git fetch --unshallow`) before using --diff")

ErrShallowClone is returned by MergeBaseFiles when the repository is a shallow clone. A shallow clone's object store can be missing the merge-base commit, so --diff mode fails fast rather than risk an incomplete or wrong comparison. Deepen the clone (for example, `git fetch --unshallow origin <branch> <base>`) and retry.

Functions

func MergeBaseFiles

func MergeBaseFiles(dir, base string, files []string) (map[string]string, error)

MergeBaseFiles opens the git repository containing dir, resolves the merge-base commit between HEAD and base, and reads each of files (paths relative to dir) from that commit's tree. The returned map is keyed by the same strings given in files; a file that did not yet exist at the merge-base is omitted rather than treated as an error, since it can't have had any violations at that point.

Types

This section is empty.

Jump to

Keyboard shortcuts

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