Skip to content

Commit

Permalink
Fix path formatting; refactor slightly for clarity
Browse files Browse the repository at this point in the history
Paths of files/blobs with mismatches had been shown literally, even
when containing unusual characters, and had been followed by two
newlines instead of one. This fixes that, and also includes some
small stylistic refactoring.
  • Loading branch information
EliahKagan committed Nov 29, 2024
1 parent 76268f8 commit b17935b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tests/it/src/commands/check_mode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,11 @@ pub(super) mod function {

match mode {
b"100644" if blob_has_shebang(root, oid)? => {
println!("mode -x but has shebang: {}\n", path);
println!("mode -x but has shebang: {path:?}");
Ok(true)
}
b"100755" if !blob_has_shebang(root, oid)? => {
println!("mode +x but no shebang: {}\n", path);
println!("mode +x but no shebang: {path:?}");
Ok(true)
}
_ => Ok(false),
Expand All @@ -114,7 +114,7 @@ pub(super) mod function {
// TODO: Maybe check status? On Unix, it should be 0 or SIGPIPE. Not sure about Windows.
_ = child.wait().context("Failure running `git` subprocess to read blob")?;

let magic = &buf[..count];
Ok(magic == b"#!")
let possible_shebang = &buf[..count];
Ok(possible_shebang == b"#!")
}
}

0 comments on commit b17935b

Please sign in to comment.