Skip to main content

read

Function read 

Source
pub fn read(repo: &Path, commit: &str, file: &str) -> Result<String, Trouble>
Expand description

One file, as that commit had it.

git show and not a read off the disk: what is wanted is the file at that commit, and it saves the worktree, which is the expensive part of everything else here.

Nothing is trimmed. A trim on the way through would eat the trailing newline git wants and the blank lines above it, and a file that comes back different from how it went out is an edit that deletes code silently.