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

Method files_to_restore

atomic-cli/src/commands/restore.rs:200–217  ·  view source on GitHub ↗

Get the files that need to be restored, paired with their status. Derives the list from a status that was already computed by the caller (so restore doesn't walk the tree twice). Only tracked, dirty states are considered; untracked files are never touched. - `Modified` / `Deleted`: content will be restored from pristine. - `Added`: tracking will be undone (file kept on disk as untracked), so tha

(&self, status: &RepositoryStatus)

Source from the content-addressed store, hash-verified

198 /// - `Added`: tracking will be undone (file kept on disk as untracked),
199 /// so that `status` stops reporting a pending "new file" change.
200 fn files_to_restore(&self, status: &RepositoryStatus) -> Vec<(PathBuf, FileStatus)> {
201 let mut out = Vec::new();
202
203 for entry in status.entries() {
204 let file_status = entry.status();
205 match file_status {
206 FileStatus::Modified | FileStatus::Deleted | FileStatus::Added => {
207 let path_str = entry.path().to_string_lossy();
208 if self.matches_filter(&path_str) {
209 out.push((entry.path().to_path_buf(), file_status));
210 }
211 }
212 _ => {}
213 }
214 }
215
216 out
217 }
218
219 /// Execute dry-run for a single file - output pristine content to stdout.
220 fn dry_run_single_file(&self, repo: &Repository, path: &str) -> CliResult<()> {

Callers 2

runMethod · 0.80

Calls 5

entriesMethod · 0.80
matches_filterMethod · 0.80
statusMethod · 0.45
pathMethod · 0.45
pushMethod · 0.45