Check if a tracked file has any recorded content. This is a lightweight check that doesn't retrieve the actual content, useful for quickly determining if a file has been recorded. # Arguments `path` - Path to the file (relative to repository root) # Returns `true` if the file is tracked and has recorded content, `false` otherwise.
(&self, path: P)
| 479 | /// |
| 480 | /// `true` if the file is tracked and has recorded content, `false` otherwise. |
| 481 | pub fn has_recorded_content<P: AsRef<Path>>(&self, path: P) -> Result<bool, RepositoryError> { |
| 482 | use atomic_core::record::workflow::retrieve::has_content; |
| 483 | |
| 484 | let path = path.as_ref(); |
| 485 | let normalized = normalize_path(path); |
| 486 | |
| 487 | let txn = self |
| 488 | .pristine |
| 489 | .read_txn() |
| 490 | .map_err(|e| RepositoryError::Database(e.to_string()))?; |
| 491 | |
| 492 | // Check if file is tracked |
| 493 | if !is_tracked(&txn, &normalized).map_err(|e| RepositoryError::Database(e.to_string()))? { |
| 494 | return Ok(false); |
| 495 | } |
| 496 | |
| 497 | // Get the inode for the file |
| 498 | let inode = match get_inode(&txn, &normalized) { |
| 499 | Ok(Some(inode)) => inode, |
| 500 | Ok(None) => return Ok(false), |
| 501 | Err(e) => return Err(RepositoryError::Database(e.to_string())), |
| 502 | }; |
| 503 | |
| 504 | // Get the position for this inode from the INODES table |
| 505 | let position = match txn.inode_position(inode) { |
| 506 | Ok(Some(pos)) => pos, |
| 507 | Ok(None) => return Ok(false), |
| 508 | Err(e) => return Err(RepositoryError::Database(e.to_string())), |
| 509 | }; |
| 510 | |
| 511 | // Check if position has content |
| 512 | let has = has_content(&txn, &self.change_store, position) |
| 513 | .map_err(|e| RepositoryError::Database(e.to_string()))?; |
| 514 | |
| 515 | Ok(has) |
| 516 | } |
| 517 | |
| 518 | // State-Based Content Retrieval |
| 519 |
nothing calls this directly
no test coverage detected