Skip to content

Commit

Permalink
adapt to changes in gix-archive
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Aug 7, 2023
1 parent 088adad commit feba76d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 3 additions & 1 deletion gitoxide-core/src/repository/archive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ fn format_from_ext(path: &Path) -> anyhow::Result<archive::Format> {
Ok(match path.extension().and_then(std::ffi::OsStr::to_str) {
None => bail!("Cannot derive archive format from a file without extension"),
Some("tar") => archive::Format::Tar,
Some("gz") => archive::Format::TarGz,
Some("gz") => archive::Format::TarGz {
compression_level: None,
},
Some("zip") => archive::Format::Zip {
compression_level: None,
},
Expand Down
4 changes: 3 additions & 1 deletion src/plumbing/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,9 @@ pub fn main() -> Result<()> {
gix::worktree::archive::Format::InternalTransientNonPersistable
}
crate::plumbing::options::archive::Format::Tar => gix::worktree::archive::Format::Tar,
crate::plumbing::options::archive::Format::TarGz => gix::worktree::archive::Format::TarGz,
crate::plumbing::options::archive::Format::TarGz => {
gix::worktree::archive::Format::TarGz { compression_level }
}
crate::plumbing::options::archive::Format::Zip => {
gix::worktree::archive::Format::Zip { compression_level }
}
Expand Down
4 changes: 2 additions & 2 deletions src/plumbing/options/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,8 @@ pub mod archive {
/// Apply the prefix verbatim to any path we add to the archive. Use a trailing `/` if prefix is a directory.
#[clap(long)]
pub prefix: Option<String>,
/// The compression strength to use. Currently only used for `.zip` archives, valid from 0-9.
#[clap(long, short = 'l', value_enum)]
/// The compression strength to use for `.zip` and `.tar.gz` archives, valid from 0-9.
#[clap(long, short = 'l', requires = "format")]
pub compression_level: Option<u8>,
/// Add the given path to the archive. Directories will always be empty.
#[clap(long, short = 'p')]
Expand Down

0 comments on commit feba76d

Please sign in to comment.