Sebastian Thielrefactor633cba75 years agoHistory
29 lines · 729 B · Rust
RawDownload
use std::path::PathBuf; mod immutable;mod mutable; #[cfg(not(windows))]fn fixup(v: Vec<u8>) -> Vec<u8> {    v} #[cfg(windows)]fn fixup(v: Vec<u8>) -> Vec<u8> {    // Git checks out text files with line ending conversions, git itself will of course not put '\r\n' anywhere,    // so that wouldn't be expected in an object and doesn't have to be parsed.    use bstr::ByteSlice;    v.replace(b"\r\n", "\n")} pub fn hex_to_id(hex: &str) -> git_hash::ObjectId {    git_hash::ObjectId::from_hex(hex.as_bytes()).expect("40 bytes hex")} pub fn fixture(path: &str) -> PathBuf {    PathBuf::from("tests/fixtures").join(path)} fn fixture_bytes(path: &str) -> Vec<u8> {    fixup(std::fs::read(fixture(path)).unwrap())}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t