Skip to content

Commit 193bf23

Browse files
author
fossdd
committed
Update pijul
1 parent 976ee58 commit 193bf23

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

libpijul/src/change/printable.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,9 @@ impl PrintableHunk {
412412
Escaped(encoding_label(encoding)),
413413
)?;
414414
writeln!(w, "{}", PrintableAtom::Edges(del_edges.to_vec()))?;
415-
writeln!(w, "{}", PrintableAtom::Edges(content_edges.to_vec()))?;
415+
if !content_edges.is_empty() {
416+
writeln!(w, "{}", PrintableAtom::Edges(content_edges.to_vec()))?;
417+
}
416418
print_contents(w, "-", contents, encoding)?;
417419
}
418420
FileUndel {
@@ -431,7 +433,9 @@ impl PrintableHunk {
431433
Escaped(encoding_label(encoding)),
432434
)?;
433435
writeln!(w, "{}", PrintableAtom::Edges(undel_edges.to_vec()))?;
434-
writeln!(w, "{}", PrintableAtom::Edges(content_edges.to_vec()))?;
436+
if !content_edges.is_empty() {
437+
writeln!(w, "{}", PrintableAtom::Edges(content_edges.to_vec()))?;
438+
}
435439
print_contents(w, "+", contents, encoding)?;
436440
}
437441

@@ -622,6 +626,9 @@ fn print_contents<W: WriteChangeLine>(
622626
contents: &[u8],
623627
encoding: &Option<Encoding>,
624628
) -> Result<(), std::io::Error> {
629+
if contents.is_empty() {
630+
return Ok(())
631+
}
625632
if let Some(encoding) = encoding {
626633
let dec = encoding.decode(&contents);
627634
let ends_with_newline = dec.ends_with("\n");

libpijul/src/record.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1121,7 +1121,6 @@ impl Recorded {
11211121
pub fn take_updatables(&mut self) -> HashMap<usize, InodeUpdate> {
11221122
std::mem::replace(&mut self.updatables, HashMap::default())
11231123
}
1124-
11251124
pub fn into_change<T: ChannelTxnT + DepsTxnT<DepsError = <T as GraphTxnT>::GraphError>>(
11261125
self,
11271126
txn: &T,
@@ -1246,6 +1245,8 @@ where
12461245
let mut previous_name = Vec::new();
12471246
let mut last_alive_meta = None;
12481247
let mut is_first_parent = true;
1248+
// Check for any renaming as that's a priority change
1249+
let mut is_any_rename = false;
12491250
for parent in iter_adjacent(
12501251
txn,
12511252
channel,
@@ -1300,8 +1301,14 @@ where
13001301
"parent_dest {:?} {:?} {:?}",
13011302
parent_dest, parent_meta, parent_name
13021303
);
1304+
if parent_name != name {
1305+
is_any_rename = true;
1306+
}
13031307
debug!("new_meta = {:?}, parent_meta = {:?}", new_meta, parent_meta);
13041308
let name_changed = parent_name != name;
1309+
if is_any_rename && !name_changed {
1310+
continue;
1311+
}
13051312
let mut meta_changed = new_meta != parent_meta;
13061313
if cfg!(windows) && !meta_changed {
13071314
if let Some(m) = last_alive_meta {
@@ -1484,13 +1491,15 @@ impl Recorded {
14841491
debug!("record_deleted_file {:?} {:?}", current_vertex, full_path);
14851492
let mut stack = vec![(current_vertex.inode_vertex(), None)];
14861493
let mut visited = HashSet::default();
1494+
let mut full_path = std::borrow::Cow::Borrowed(full_path);
14871495
while let Some((vertex, inode)) = stack.pop() {
14881496
debug!("vertex {:?}, inode {:?}", vertex, inode);
14891497
if let Some(path) = tree_path(txn, &vertex.start_pos())? {
14901498
if working_copy.file_metadata(&path).is_ok() {
14911499
debug!("not deleting {:?}", path);
14921500
continue;
14931501
}
1502+
full_path = path.into()
14941503
}
14951504

14961505
// Kill this vertex
@@ -1522,7 +1531,7 @@ impl Recorded {
15221531
channel,
15231532
vertex,
15241533
vertex.start_pos(),
1525-
full_path,
1534+
&full_path,
15261535
)?
15271536
}
15281537

0 commit comments

Comments
 (0)