Skip to main content

Module git

Module git 

Source
Expand description

Git backend.

  • add_workspace: git worktree add --detach <ws> <base|commit>, then for Checkout::Patches, apply each patch bottom-to-top with git apply --index --3way and commit it.
  • update_workspace: git checkout --detach onto the new base, then re-apply patches. Every add_workspace/update_workspace call pins its resulting head under refs/review-queue/<name>/<version> (git update-ref, never overwritten), so a prior version stays reachable once a later call moves the workspace on.
  • is_dirty: git status --porcelain is non-empty, or HEAD isn’t the expected id (the stack tip) or one of its ancestors.
  • position: git checkout --detach <commit>, to sit on one patch of a stack.
  • remove_workspace: git worktree remove, plus every refs/review-queue/<name>/* ref.

A failed patch application leaves the workspace in place (the caller should record Status::ApplyFailed) rather than being silently cleaned up.

Structs§

GitVcs