Preserve native presentation (including Git overlays and snapshot notices) after the service has performed the working-copy query.
(
&self,
response: libatomic::atomic::StatusResponse,
)
| 241 | /// Preserve native presentation (including Git overlays and snapshot |
| 242 | /// notices) after the service has performed the working-copy query. |
| 243 | pub(crate) fn render_service_status( |
| 244 | &self, |
| 245 | response: libatomic::atomic::StatusResponse, |
| 246 | ) -> CliResult<()> { |
| 247 | use libatomic::atomic as pb; |
| 248 | let root = find_repository_root()?; |
| 249 | let state = response.view_merkle.as_ref().and_then(|hash| { |
| 250 | let bytes: [u8; 32] = hash.value.as_slice().try_into().ok()?; |
| 251 | Some(atomic_core::types::Merkle::from_bytes(bytes)) |
| 252 | }); |
| 253 | let mut status = RepositoryStatus::new(response.view, state); |
| 254 | for file in response.files { |
| 255 | let kind = match pb::FileStatus::try_from(file.status) { |
| 256 | Ok(pb::FileStatus::Modified) |
| 257 | if file.details.as_deref() |
| 258 | == Some(libatomic::daemon::convert::TYPE_CHANGED_DETAIL) => |
| 259 | { |
| 260 | FileStatus::TypeChanged |
| 261 | } |
| 262 | Ok(pb::FileStatus::Modified) |
| 263 | if file.details.as_deref() |
| 264 | == Some(libatomic::daemon::convert::PERMISSIONS_CHANGED_DETAIL) => |
| 265 | { |
| 266 | FileStatus::PermissionsChanged |
| 267 | } |
| 268 | Ok(pb::FileStatus::Modified) => FileStatus::Modified, |
| 269 | Ok(pb::FileStatus::Deleted) => FileStatus::Deleted, |
| 270 | Ok(pb::FileStatus::Untracked) => FileStatus::Untracked, |
| 271 | Ok(pb::FileStatus::Added) => FileStatus::Added, |
| 272 | Ok(pb::FileStatus::Conflicted) => FileStatus::Conflicted, |
| 273 | Ok(pb::FileStatus::PendingUntrack) => FileStatus::PendingUntrack, |
| 274 | _ => FileStatus::Clean, |
| 275 | }; |
| 276 | let path = PathBuf::from(file.path); |
| 277 | if (self.no_untracked && kind == FileStatus::Untracked) |
| 278 | || self |
| 279 | .path |
| 280 | .as_ref() |
| 281 | .is_some_and(|prefix| !path.starts_with(prefix)) |
| 282 | { |
| 283 | continue; |
| 284 | } |
| 285 | let mut entry = atomic_repository::FileStatusEntry::new(path, kind); |
| 286 | if let Some(details) = file.details { |
| 287 | entry.set_details(details); |
| 288 | } |
| 289 | status.add_entry(entry); |
| 290 | } |
| 291 | for _ in 0..response.stale_index_count { |
| 292 | status.add_stale_index_hit(); |
| 293 | } |
| 294 | let repo = Repository::open_readonly_wait(&root, atomic_repository::database_lock_wait()) |
| 295 | .map_err(CliError::Repository)?; |
| 296 | crate::commands::status_git::apply_git_informed_overlays(&repo, &root, &mut status)?; |
| 297 | crate::commands::git::ref_mapping::print_divergence_notices(&repo)?; |
| 298 | if repo.shim_workspace_active().map_err(CliError::Repository)? { |
| 299 | if let Ok(git) = git2::Repository::discover(&root) { |
| 300 | if git.state() != git2::RepositoryState::Clean { |
no test coverage detected