(args: &super::status::Status)
| 241 | } |
| 242 | |
| 243 | pub fn status(args: &super::status::Status) -> CliResult<bool> { |
| 244 | if args.debug_ignore || args.no_reconcile || args.git { |
| 245 | return Ok(false); |
| 246 | } |
| 247 | if !super::workspace_txn::prepare_service_query(true)? { |
| 248 | return Ok(false); |
| 249 | } |
| 250 | let Some(session) = Service::open()? else { |
| 251 | return Ok(false); |
| 252 | }; |
| 253 | // `--reindex` rebuilds the working-copy index through the wire's |
| 254 | // repair action, then falls through to the status read — the same |
| 255 | // compose the local body performs. The line renders from the wire's |
| 256 | // reindexed count with a client-side clock, byte-for-byte with the |
| 257 | // local reindex report. |
| 258 | if args.reindex { |
| 259 | let start = std::time::Instant::now(); |
| 260 | let repair = session.repair(pb::RepairRequest { |
| 261 | repository: Some(session.reference.clone()), |
| 262 | meta: None, |
| 263 | action: pb::RepairAction::ReindexWorkingCopy as i32, |
| 264 | force: false, |
| 265 | view: String::new(), |
| 266 | }); |
| 267 | match repair { |
| 268 | Ok(response) => { |
| 269 | if !args.json { |
| 270 | print_info(&format!( |
| 271 | "Reindexed {} files in {:.1}s", |
| 272 | response.reindexed, |
| 273 | start.elapsed().as_secs_f64() |
| 274 | )); |
| 275 | } |
| 276 | } |
| 277 | Err(error) if args.json => return Err(error), |
| 278 | Err(error) => { |
| 279 | print_warning(&format!("Reindex failed: {error}")); |
| 280 | } |
| 281 | } |
| 282 | } |
| 283 | let request = pb::StatusRequest { |
| 284 | repository: Some(session.reference.clone()), |
| 285 | options: Some(status_options_proto(&args.get_status_options())), |
| 286 | }; |
| 287 | let response = session.status(request)?; |
| 288 | |
| 289 | args.render_service_status(response)?; |
| 290 | Ok(true) |
| 291 | } |
| 292 | |
| 293 | // --------------------------------------------------------------------------- |
| 294 | // log |
no test coverage detected