You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Failure can occour on Windows as it's likely such a pack or index is already opened
during negotiation. Then, when an empty fetch via `--depth 1` is repeated,
a temporary file would be renamed onto one an mmapped pack or index, causing
a failure.
Now packs or indices aren't written anymore if they are empty.
Copy file name to clipboardExpand all lines: gix-pack/src/bundle/write/mod.rs
+30-24
Original file line number
Diff line number
Diff line change
@@ -300,31 +300,37 @@ impl crate::Bundle {
300
300
)?;
301
301
drop(pack_entries_iter);
302
302
303
-
let data_path = directory.join(format!("pack-{}.pack", outcome.data_hash.to_hex()));
304
-
let index_path = data_path.with_extension("idx");
305
-
let keep_path = data_path.with_extension("keep");
303
+
if outcome.num_objects == 0{
304
+
WriteOutcome{
305
+
outcome,
306
+
data_path:None,
307
+
index_path:None,
308
+
keep_path:None,
309
+
}
310
+
}else{
311
+
let data_path = directory.join(format!("pack-{}.pack", outcome.data_hash.to_hex()));
312
+
let index_path = data_path.with_extension("idx");
313
+
let keep_path = data_path.with_extension("keep");
306
314
307
-
std::fs::write(&keep_path,b"")?;
308
-
Arc::try_unwrap(data_file)
309
-
.expect("only one handle left after pack was consumed")
310
-
.into_inner()
311
-
.into_inner()
312
-
.map_err(|err| Error::from(err.into_error()))?
313
-
.persist(&data_path)?;
314
-
index_file
315
-
.persist(&index_path)
316
-
.map_err(|err| {
317
-
progress.info(format!(
318
-
"pack file at {} is retained despite failing to move the index file into place. You can use plumbing to make it usable.",
319
-
data_path.display()
320
-
));
321
-
err
322
-
})?;
323
-
WriteOutcome{
324
-
outcome,
325
-
data_path:Some(data_path),
326
-
index_path:Some(index_path),
327
-
keep_path:Some(keep_path),
315
+
std::fs::write(&keep_path,b"")?;
316
+
Arc::try_unwrap(data_file)
317
+
.expect("only one handle left after pack was consumed")
318
+
.into_inner()
319
+
.into_inner()
320
+
.map_err(|err| Error::from(err.into_error()))?
321
+
.persist(&data_path)?;
322
+
index_file
323
+
.persist(&index_path)
324
+
.map_err(|err| {
325
+
gix_features::trace::warn!("pack file at \"{}\" is retained despite failing to move the index file into place. You can use plumbing to make it usable.",data_path.display());
0 commit comments