Wrap an EXDEV error from fs::rename with both the source temp path
and the destination — the user needs both to understand which mount
boundary the rename tripped on. Other error kinds delegate to
enrich_fs_error using the destination as the principal path.
Returns true when an io::Error indicates a rename (or other
link-style operation) attempted to bridge two filesystems (EXDEV).
This is what trips when temp_path lands on a different mount than
the destination — typically because TMPDIR is on a different volume,
or the parent directory itself is a bind mount. We match both the
portable ErrorKind::CrossesDevices and the raw EXDEV code.
Returns true when an io::Error indicates a directory could not be
removed because it still contained entries. The apply planner
intentionally skips heddle-ignored entries (.git/, target/,
node_modules/, etc.); when tracked content is removed and the parent
directory still holds those ignored siblings, remove_dir returns
this signal. We need both ErrorKind::DirectoryNotEmpty and the raw
codes — Linux=39, macOS/BSD=66, Windows=145 — because Rust does not
always translate every kernel surface into the portable ErrorKind.
Returns true when an io::Error indicates the path referenced by an
operation does not exist (ENOENT on Unix, ERROR_FILE_NOT_FOUND /
ERROR_PATH_NOT_FOUND on Windows). Use this only at call sites
where the operation expected the path to exist — the predicate alone
can’t distinguish “I expected this” from “I checked optionally”.
Returns true when an io::Error indicates the filesystem is out of
space. Centralised here because it’s the same predicate used by
write_file_atomic (the inner helper) and by the higher-level
cmd_snapshot recovery path that prints the actionable message.
Returns true when an io::Error indicates the operation was denied
for permissions reasons (EACCES on Unix, ERROR_ACCESS_DENIED on
Windows). The portable ErrorKind::PermissionDenied covers most
surfaces; the raw EACCES check handles oddball platforms that
surface the OS code without translating to the portable kind.
Returns true when an io::Error indicates the underlying filesystem
is mounted read-only (EROFS on Unix). The portable
ErrorKind::ReadOnlyFilesystem is preferred when present; we also
match the raw OS code because some platforms (notably older macOS
surfaces and certain remote filesystems) do not always translate.