MCPcopy Create free account
hub / github.com/Work-Fisher/code-claw / make_patch

Function make_patch

claw-code/rust/crates/runtime/src/file_ops.rs:430–446  ·  view source on GitHub ↗
(original: &str, updated: &str)

Source from the content-addressed store, hash-verified

428}
429
430fn make_patch(original: &str, updated: &str) -> Vec<StructuredPatchHunk> {
431 let mut lines = Vec::new();
432 for line in original.lines() {
433 lines.push(format!("-{line}"));
434 }
435 for line in updated.lines() {
436 lines.push(format!("+{line}"));
437 }
438
439 vec![StructuredPatchHunk {
440 old_start: 1,
441 old_lines: original.lines().count(),
442 new_start: 1,
443 new_lines: updated.lines().count(),
444 lines,
445 }]
446}
447
448fn normalize_path(path: &str) -> io::Result<PathBuf> {
449 let candidate = if Path::new(path).is_absolute() {

Callers 2

write_fileFunction · 0.85
edit_fileFunction · 0.85

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected