Skip to main content

compute_patchset

Function compute_patchset 

Source
pub fn compute_patchset(
    workspace_path: &Path,
    base_epoch: &EpochId,
) -> Result<PatchSet, DiffError>
Expand description

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

§Arguments

  • workspace_path — absolute path to the workspace working directory.
  • base_epoch — the epoch commit to diff against (an ancestor of the workspace’s current state).

§What this does

  1. Runs git diff --find-renames --name-status <epoch> to detect tracked changes: added, modified, deleted, and renamed files.
  2. Runs git ls-files --others --exclude-standard to collect untracked files (new files not yet staged), recording them as Add entries.
  3. For each change, computes the relevant blob OIDs:
    • Working-directory file content → git hash-object -w
    • Epoch tree blob → git rev-parse <epoch>:<path>

§FileId note

FileIds come from .manifold/fileids when available, with deterministic fallbacks for repositories that do not yet have an identity map.

§Errors

Returns DiffError if any git command fails or produces unexpected output.