MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / has_recorded_content

Method has_recorded_content

atomic-repository/src/repository/content.rs:481–516  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 7

is_trackedFunction · 0.85
get_inodeFunction · 0.85
has_contentFunction · 0.85
as_refMethod · 0.80
read_txnMethod · 0.80
normalize_pathFunction · 0.50
inode_positionMethod · 0.45

Tested by

no test coverage detected