Skip to content

Commit 141b47f

Browse files
committed
fix tar feature in gix-archive
1 parent eab774c commit 141b47f

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

gix-archive/src/write.rs

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,21 +34,20 @@ where
3434

3535
impl<W: std::io::Write> State<W> {
3636
pub fn new(format: Format, mtime: gix_date::SecondsSinceUnixEpoch, out: W) -> Result<Self, Error> {
37-
Ok(match format {
37+
match format {
3838
Format::InternalTransientNonPersistable => unreachable!("handled earlier"),
39-
Format::Zip { .. } => return Err(Error::ZipWithoutSeek),
40-
#[cfg(feature = "tar")]
39+
Format::Zip { .. } => Err(Error::ZipWithoutSeek),
4140
Format::Tar => {
4241
#[cfg(feature = "tar")]
4342
{
44-
State::Tar((
43+
Ok(State::Tar((
4544
{
4645
let mut ar = tar::Builder::new(out);
4746
ar.mode(tar::HeaderMode::Deterministic);
4847
ar
4948
},
5049
Vec::with_capacity(64 * 1024),
51-
))
50+
)))
5251
}
5352
#[cfg(not(feature = "tar"))]
5453
{
@@ -58,7 +57,7 @@ where
5857
Format::TarGz { compression_level } => {
5958
#[cfg(feature = "tar_gz")]
6059
{
61-
State::TarGz((
60+
Ok(State::TarGz((
6261
{
6362
let gz = flate2::GzBuilder::new().mtime(mtime as u32).write(
6463
out,
@@ -72,14 +71,18 @@ where
7271
ar
7372
},
7473
Vec::with_capacity(64 * 1024),
75-
))
74+
)))
7675
}
7776
#[cfg(not(feature = "tar_gz"))]
7877
{
79-
Err(Error::SupportNotCompiledIn { wanted: Format::TarGz })
78+
Err(Error::SupportNotCompiledIn {
79+
wanted: Format::TarGz {
80+
compression_level: None,
81+
},
82+
})
8083
}
8184
}
82-
})
85+
}
8386
}
8487
}
8588

0 commit comments

Comments
 (0)