(
archive: &mut tar::Builder<W>,
local_path: &Path,
archive_path: &Path,
metadata: &fs::Metadata,
)
| 709 | } |
| 710 | |
| 711 | fn append_upload_symlink<W: Write>( |
| 712 | archive: &mut tar::Builder<W>, |
| 713 | local_path: &Path, |
| 714 | archive_path: &Path, |
| 715 | metadata: &fs::Metadata, |
| 716 | ) -> Result<()> { |
| 717 | let target = fs::read_link(local_path) |
| 718 | .into_diagnostic() |
| 719 | .wrap_err_with(|| format!("failed to read symlink {}", local_path.display()))?; |
| 720 | let mut header = tar::Header::new_gnu(); |
| 721 | header.set_metadata(metadata); |
| 722 | header.set_entry_type(tar::EntryType::Symlink); |
| 723 | header.set_size(0); |
| 724 | header.set_cksum(); |
| 725 | archive |
| 726 | .append_link(&mut header, archive_path, target) |
| 727 | .into_diagnostic() |
| 728 | .wrap_err_with(|| { |
| 729 | format!( |
| 730 | "failed to add symlink {} to tar archive", |
| 731 | archive_path.display() |
| 732 | ) |
| 733 | })?; |
| 734 | Ok(()) |
| 735 | } |
| 736 | |
| 737 | fn local_upload_path_is_file_like(path: &Path) -> bool { |
| 738 | fs::symlink_metadata(path).is_ok_and(|metadata| { |
no outgoing calls
no test coverage detected