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

Method files_to_restore

atomic-cli/src/commands/restore.rs:204–225  ·  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

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