MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / record_path

Function record_path

libatomic/src/review/incremental.rs:1191–1212  ·  view source on GitHub ↗
(repo: &Repository, relative: &str, content: &str)

Source from the content-addressed store, hash-verified

1189 }
1190
1191 fn record_path(repo: &Repository, relative: &str, content: &str) -> Hash {
1192 let path = repo.root().join(relative);
1193 std::fs::create_dir_all(path.parent().unwrap()).unwrap();
1194 let exists = path.exists();
1195 std::fs::write(path, content).unwrap();
1196 let wc = repo.require_working_copy_id().unwrap();
1197 if !exists {
1198 repo.add(wc, relative, TrackingOptions::default()).unwrap();
1199 }
1200 *repo
1201 .record(
1202 wc,
1203 ChangeHeader::new(content),
1204 RecordOptions::new()
1205 .with_all(true)
1206 .save_to_store(true)
1207 .apply_after_record(true)
1208 .enrich_kg(false),
1209 )
1210 .unwrap()
1211 .hash()
1212 }
1213
1214 fn work(repo: &Repository, title: &str, session: Option<&str>) -> IntentCreateResult {
1215 repo.vault_intent_create(IntentCreateOptions {

Calls 13

parentMethod · 0.80
enrich_kgMethod · 0.80
apply_after_recordMethod · 0.80
save_to_storeMethod · 0.80
writeFunction · 0.50
rootMethod · 0.45
unwrapMethod · 0.45
existsMethod · 0.45
addMethod · 0.45
hashMethod · 0.45
recordMethod · 0.45