Skip to main content

Module diff

Module diff 

Source
Expand description

PatchSet computation from working directory diff (§5.4).

Builds a PatchSet by comparing a workspace’s working directory against a base epoch commit using git diff and git ls-files.

§Overview

compute_patchset does three things:

  1. Runs git diff --find-renames --name-status <epoch> in workspace_path to enumerate tracked changes (added, modified, deleted, renamed files).
  2. Runs git ls-files --others --exclude-standard to collect untracked files, recording each as an additional PatchValue::Add entry.
  3. For each change, looks up or computes the relevant blob OID(s) using git hash-object -w and git rev-parse <epoch>:<path>.

§FileId allocation

File identity is resolved in this order:

  1. .manifold/fileids mapping (when present) for stable cross-run IDs.
  2. Deterministic fallback from the epoch blob OID (existing files).
  3. Deterministic fallback from path hash (new files not yet in map).

§Example flow

compute_patchset(repo_root, workspace_path, &epoch)
  ├── git diff --find-renames --name-status <epoch>  → A/M/D/R lines
  ├── git ls-files --others --exclude-standard        → untracked paths
  ├── git hash-object -w <file>                       → new blob OIDs
  └── git rev-parse <epoch>:<path>                    → base blob OIDs

Enums§

DiffError
Errors that can occur when computing a PatchSet from a working dir diff.

Functions§

compute_patchset
Compute a PatchSet from a workspace’s current working directory state relative to the given base epoch commit.