sim

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2026 License: AGPL-3.0, AGPL-3.0-or-later Imports: 3 Imported by: 0

Documentation

Overview

Package sim proves a parsed CEM patch against exact base-tree bytes, per interop/cem-0.1/ALGORITHMS.md "Patch/base simulation". It is a simulation only: the patch is never executed, and old bytes are never invented — every context and removed payload must match the base byte-for-byte.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyHunks

func ApplyHunks(group *patch.Group, oldBytes []byte) ([]byte, error)

ApplyHunks copies untouched base lines, compares every context and removed payload byte-for-byte, appends context and added payloads, and verifies every old and new cursor.

func Simulate

func Simulate(parsed *patch.Patch, source BlobSource) error

Simulate verifies every file group of the patch against the base tree.

Types

type BlobSource

type BlobSource interface {
	// BaseBlob returns the bounded blob bytes and tree mode at path in the
	// base tree and whether the path exists as a regular blob.
	BaseBlob(path string) (data []byte, mode string, exists bool, err error)
}

BlobSource reads base-tree blobs through Git object identity.

Jump to

Keyboard shortcuts

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