mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 09:15:42 +02:00
Fix commit ID hex formatting in gstat (#16309)
Fix commit ID hex formatting in gstat, closes #16307 Leading zeros are preserved, maintaining the correct hex representation This issue is relatively easy to fix, but it's not very easy to verify. However, I have already tested several scenarios, it works for commit sha like `000baeef`, `000003c7` and `00000002` etc.
This commit is contained in:
@ -294,7 +294,7 @@ impl Stats {
|
||||
if let Ok(commit) = head.peel_to_commit() {
|
||||
let mut id = String::new();
|
||||
for byte in &commit.id().as_bytes()[..4] {
|
||||
write!(&mut id, "{byte:x}").unwrap();
|
||||
write!(&mut id, "{byte:02x}").unwrap();
|
||||
}
|
||||
id
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user