| 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 { |