fix: separate the paths of a -z entry with a NUL, not an arrow

This commit is contained in:
2026-09-08 14:40:21 +00:00
parent b372472de6
commit 23b7fde0ea

View File

@@ -53,10 +53,19 @@ pub fn check(
fn print_porcelain(exposed: &[Exposed], null: bool) { fn print_porcelain(exposed: &[Exposed], null: bool) {
let end = if null { '\0' } else { '\n' }; let end = if null { '\0' } else { '\n' };
// a filename can hold an arrow but not a NUL, so -z separates the two paths
// with one the way `git status -z` does for a rename. the two character code
// stays where it is: it cannot be mistaken for part of a path
let between = if null { "\0" } else { " -> " };
for item in exposed { for item in exposed {
match &item.dest { match &item.dest {
Some(dest) => text!("{} {} -> {}{end}", item.code(), item.name, dest.display()), Some(dest) => text!(
"{} {}{between}{}{end}",
item.code(),
item.name,
dest.display()
),
None => text!("{} {}{end}", item.code(), item.name), None => text!("{} {}{end}", item.code(), item.name),
} }
} }