1#![deny(unsafe_code)]
2pub mod cache;
5pub mod capabilities;
6pub mod clock;
7pub mod compact;
8pub mod config;
9pub mod crdt;
10pub mod dag;
11pub mod db;
12pub mod error;
13pub mod event;
14pub mod graph;
15pub mod lock;
16pub mod model;
17pub mod recovery;
18pub mod shard;
19pub mod sync;
20pub mod timing;
21pub mod undo;
22pub mod verify;
23
24use tracing::{info, instrument};
25
26#[instrument]
32pub fn init() {
33 info!("bones-core initialized");
34 let bones_dir = std::path::Path::new(".bones");
36 if !bones_dir.is_dir() {
37 return;
38 }
39
40 let gitattributes_path = bones_dir.join(".gitattributes");
41 let attr_line = "events merge=union\n";
42
43 let mut content = if gitattributes_path.exists() {
44 std::fs::read_to_string(&gitattributes_path).unwrap_or_default()
45 } else {
46 String::new()
47 };
48
49 if !content.contains("events merge=union") {
50 if !content.is_empty() && !content.ends_with('\n') {
51 content.push('\n');
52 }
53 content.push_str(attr_line);
54 let _ = std::fs::write(gitattributes_path, content);
55 }
56}
57
58#[cfg(test)]
59mod tests {
60 #[test]
61 fn it_works() {
62 assert!(true);
63 }
64}