(repository: &Path)
| 887 | } |
| 888 | |
| 889 | fn serve(repository: &Path) -> CliResult<()> { |
| 890 | let dot_dir = Repository::canonical_dot_dir(repository)?; |
| 891 | let owner_lock = acquire_owner_lock(&dot_dir)?; |
| 892 | let store_path = Repository::canonical_change_store_path(repository)?; |
| 893 | let store = Arc::new( |
| 894 | RedbChangeStore::open(&store_path) |
| 895 | .with_context(|| format!("failed to open {}", store_path.display()))?, |
| 896 | ); |
| 897 | let endpoint = endpoint_name(&dot_dir); |
| 898 | runtime()?.block_on(run_server(&endpoint, store))?; |
| 899 | FileExt::unlock(&owner_lock).context("failed to release database-owner lock")?; |
| 900 | Ok(()) |
| 901 | } |
| 902 | |
| 903 | fn acquire_owner_lock(dot_dir: &Path) -> anyhow::Result<File> { |
| 904 | let path = dot_dir.join(OWNER_LOCK_FILE); |
no test coverage detected