| 822 | /// Export an ostree commit to an (uncompressed) tar archive stream. |
| 823 | #[context("Exporting commit")] |
| 824 | pub fn export_commit( |
| 825 | repo: &ostree::Repo, |
| 826 | rev: &str, |
| 827 | out: impl std::io::Write, |
| 828 | options: Option<ExportOptions>, |
| 829 | ) -> Result<()> { |
| 830 | let commit = repo.require_rev(rev)?; |
| 831 | let mut tar = tar::Builder::new(out); |
| 832 | let options = options.unwrap_or_default(); |
| 833 | impl_export(repo, commit.as_str(), &mut tar, options)?; |
| 834 | tar.finish()?; |
| 835 | Ok(()) |
| 836 | } |
| 837 | |
| 838 | /// Chunked (or version 1) tar streams don't have a leading `./`. |
| 839 | fn path_for_tar_v1(p: &Utf8Path) -> &Utf8Path { |