scratchtree

package
v0.9.9-dev.1 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2026 License: Apache-2.0 Imports: 11 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 scratchtree gives an analyzer a copy of a repository it is allowed to write into.

The root AGENTS.md states it without an exception: an indexed repository is never modified. Every analyzer honoured that until Java and C#, which are indexed by *building* them -- scip-java drives Maven or Gradle and scip-dotnet runs `dotnet restore`. A build writes `target/`, `obj/` and `bin/` into the directory it builds, and no flag moves that: it is the build tool's output, not Kivgraph's.

So the pass stops handing the analyzer the repository. It hands it a tree with the same content somewhere else, and throws it away afterwards.

Measured on this repository -- 1652 tracked files, a 3.8 GB working tree once `node_modules`, `.tooling` and `dist` are counted:

copy of the working tree      8154 ms   4.5 GB   55862 files
git worktree add              107 ms    16 MB    1638 files
git archive + dirty overlay   76 ms     16 MB    1637 files

The archive wins on all three axes and is the only one of the three that writes nothing inside the repository at all: `git worktree add` registers metadata under `.git/worktrees/`, which a pass that dies leaves behind. A copy is honest but drags in every build output and vendored dependency that happens to be there, which is what makes it two orders of magnitude slower.

Index

Constants

View Source
const (
	StrategyArchive = "git-archive"
	StrategyCopy    = "copy"
)

Strategies, as they appear in a report.

Variables

This section is empty.

Functions

This section is empty.

Types

type Tree

type Tree struct {
	// Path is the root the analyzer is pointed at.
	Path string
	// Strategy names how it was produced, for the pass to report.
	Strategy string
	// contains filtered or unexported fields
}

Tree is a materialised copy of a repository, and the directory an analyzer may dirty.

func Materialise

func Materialise(ctx context.Context, repository workspace.Repository, base string) (*Tree, error)

Materialise produces a tree with the repository's current content under base, which must be outside every indexed repository.

It reproduces the **working tree**, not the last commit. A user editing code expects the graph to describe what is on disk, and the registry already records whether a repository is dirty; indexing HEAD instead would answer about code nobody has.

func (*Tree) Close

func (tree *Tree) Close() error

Close removes the tree and everything the analyzer wrote into it.

Jump to

Keyboard shortcuts

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