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 ¶
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 ¶
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.