fn remove_credentials_keep_history(
dir: &Path,
history: Option<&str>,
) -> Result<Option<PathBuf>>Expand description
Remove dir, keeping its history child when that child is a real,
non-empty directory. Returns the kept path, or None when the whole
tree was removed.
A history child that is a link (a symlink, or a Windows junction — the
isolated-auth redirect to the always-global history, see
identity_auth_dirs::link_history_if_isolated) does not hold the
history itself, so the whole tree goes; remove_dir_all removes the
link without following it. An empty history child is nothing to keep.
Keeps removing the other entries after one fails, so one locked file doesn’t leave the rest of the credential behind, then reports the first failure.